Skip to content

Instantly share code, notes, and snippets.

@5car1z
Last active December 19, 2021 10:57
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save 5car1z/7254095c24299bef28e8 to your computer and use it in GitHub Desktop.
Save 5car1z/7254095c24299bef28e8 to your computer and use it in GitHub Desktop.
Debian 8 DO Locale Issues Fix

Debian 8 DO Locale Issues Fix

Problem

"Locale problems" in both the 32-bit & 64-bit versions of Debian 8 droplets

Create a new Debian 8 droplet and login as root:

$ locale

Output:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Upon creating a new user with useradd :

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Upon ssh login with newly added user:

_____________________________________________________________________
WARNING! Your environment specifies an invalid locale.
 This can affect your user experience significantly, including the
 ability to manage packages. You may install the locales by running:

   sudo apt-get install language-pack-en
     or
   sudo locale-gen en_US.UTF-8

To see all available language packs, run:
   apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
   sudo touch /var/lib/cloud/instance/locale-check.skip
_____________________________________________________________________

Note: apt-get install language-pack-en gives a package not found error (as root again).

Fix

As root :

$ locale-gen en_US.UTF-8
$ dpkg-reconfigure locales
  • Toggled en_US.UTF-8 UTF-8 in the configuration process with SPACE.
  • Then ENTER on the en_US.UTF-8 option within the next screen.
$ vi /etc/environment

Added these two lines to said file:

LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
$ reboot now

Login again:

$ locale

Everything with locales seems fixed when logging in with users or runninglocale again now.

Also sudo is not installed in this Debian 8 build, is this intentional? or part of Jessie by default now?

@5car1z
Copy link
Author

5car1z commented Jun 12, 2016

Fixed in later updated droplet OS images by DO! ^_^

@damian87x
Copy link

fixed, thanks

@normancarcamo
Copy link

Thanks!

@ramazans
Copy link

thanks it's worked.

@ow4mm23
Copy link

ow4mm23 commented Dec 19, 2021

Thanks, it's worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment