apt-get warning: No support for locale: en_US.utf8

I get this error each time I update the system using apt-get. What does this error mean? Any ideas on how to correct it? (I am running Ubuntu 11.10)

2

5 Answers

Usually this error means that you could have been changing between different languages (locales) and something has caused this to error erroneously.

You could try regenerating your list of locales with

sudo dpkg-reconfigure locales

For me the result was:

Generating locales... en_AG.UTF-8... done en_AU.UTF-8... done en_BW.UTF-8... done en_CA.UTF-8... done en_DK.UTF-8... done en_GB.UTF-8... done en_HK.UTF-8... done en_IE.UTF-8... done en_IN.UTF-8... done en_NG.UTF-8... done en_NZ.UTF-8... done en_PH.UTF-8... done en_SG.UTF-8... done en_US.UTF-8... up-to-date en_ZA.UTF-8... done en_ZM.UTF-8... done en_ZW.UTF-8... done
Generation complete.

Then resetting your local locale with:

sudo update-locale LANG=en_US.UTF-8

i.e. use one of the Locale values in the output above

In my case, the problem was that /usr/share/initramfs-tools/hooks/root_locale is expecting to see individual locale directories in /usr/lib/locale but locale-gen is configured to generate an archive file by default.

I fixed it by running:

sudo locale-gen --purge --no-archive
3

The problem may come from the lower case in the "utf8" instead of "UTF8"??

Warning: No support for locale: en_US.utf8

This code seem to solve the problem.

> sudo update-locale LANG=en_US.UTF-8
> echo $LANG
en_US.UTF-8

It is also possible to go in local languages settings in theory.

enter image description here

Then "Apply System-Wide" should also update the local.

I see you are running ubuntu11.10 (oneric) @2011, although the above answers may have solved this issue in that version, the warning message still exists, and the answers provided did not fix the problem in my case:

From a fresh install of Ubuntu 14,04 (trusty[Mint 17.1 ISO]) and upgrading to ubuntu 18.04 (bionic[Mint 19.3]) applying 6 upgrades in total. I ignored the persistent warning message, as it did not affect the running of my system in any given upgrade nor any changes I made to my kernel.

Puzzled, however , I found the following:

On close inspection,I found the file located at /usr/share/initramfs-tools/hooks/root_locale (date Mar 11 2011!) from which I presume is executed by ../hook-functions (found in initramfs-tools in the aforementioned Ubuntu releases found here and more!, the warnings origin, in my case, is here:

[ -r /etc/default/locale ] && . /etc/default/locale
[ -z "$ROOT_LOCALE" ] && ROOT_LOCALE=`echo $LANG | sed -e 's/UTF/utf/' -e 's/utf-8/utf8/'`
if [ -n "$ROOT_LOCALE" ] && [ -d /usr/lib/locale/$ROOT_LOCALE ]; then [ "${verbose}" = "y" ] && echo "Adding locale: $ROOT_LOCALE" mkdir -p "$DESTDIR/usr/lib/locale" cp -r /usr/lib/locale/$ROOT_LOCALE "$DESTDIR/usr/lib/locale" echo "ROOT_LOCALE=$ROOT_LOCALE" > $CONF echo "export ROOT_LOCALE" >> $CONF echo "export FSTYPE" >> $CONF
else echo "Warning: No support for locale: $ROOT_LOCALE" >&2
fi

Note that this script explicitly references /usr/lib/locale/en_US.utf8, being parsed unsuccessfully in my case.

At the time this answer was posted, none of the other solutions given above, address the issue with utf8 being in lower-case, namely in ubuntu 14 > 20, locale-gen simply parses each line in /etc/locale.gen to localedef, see Ubuntu man pages locale-gen from 16.04 to 20.04 (and does not have any of the options given above), nor does locale.gen have a single entry using utf8 lower-case.

To resolve this issue:

First, check the language you use in your Ubuntu/Debian based distro:

echo $LANG

Then, change en_US below, to your __lang__uage (e.g. fr_FR)

cd /usr/lib/locale

localedef -f UTF-8 -i en_US ./en_US.utf8

This creates the following structure:

ls /usr/lib/locale/en_US.utf8/

LC_ADDRESS LC_IDENTIFICATION LC_MONETARY LC_PAPER LC_COLLATE LC_MEASUREMENT LC_NAME LC_TELEPHONE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_TIME

Note1: Both locale-gen(shell script) and dpkg-reconfigure locales (which calls localedef), just parse /etc/locale.gen, in the Ubuntu versions 16.04 > 20.04, your distro may provide different functionality.

Note2: I have no idea where ___/usr/share/initramfs-tools/hooks/root_locale___ came from as it is not found in any aforementioned releases, and can only presume it was part of/left over from Mint 17.1, your distro may be different.

3

Reinstalling locales worked for me

sudo apt reinstall locales

Before running the above command, I would see this

$ locale -a
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_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
...
Generating locales (this might take a while)... en_AG.UTF-8...[error] cannot open locale definition file `en_GB': No such file or directory done en_AU.UTF-8...[error] cannot open locale definition file `en_AU': No such file or directory
...

After reinstalling locales, I see the correct output

$ locale -a
C
C.UTF-8
...
en_US.utf8
...
$ sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
... en_US.UTF-8... done
...
Generation complete.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like