qubes-issues icon indicating copy to clipboard operation
qubes-issues copied to clipboard

perl: warning: Setting locale failed

Open adrelanos opened this issue 5 years ago • 16 comments

Qubes OS version:

4.0

Affected component(s) or functionality:

Whonix


Steps to reproduce the behavior:

in terminal:

vrms

Expected or desired behavior:

normal output

Actual behavior:

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

No non-free or contrib packages installed on host!  rms would be proud.

General notes:

Doesn't only happen (with obscure example) vrms also with many other applications, users reported it happening with youtube-dl.

This randomly started happening. Some update must have introduced it. No Whonix code related to this was changed in years.

A "lazy" fix would be installing package locales-all. But disk space could be pushing it?

After this operation, 130 MB of additional disk space will be used.

Anyone having this issue outside of Whonix?

During template build we have: https://github.com/QubesOS/qubes-builder-debian/blob/master/template_debian/distribution.sh#L354-L358

function updateLocale() {
    debug "Updating locales"
    chroot_cmd localedef -f UTF-8 -i en_US -c en_US.UTF-8
    chroot_cmd update-locale LANG=en_US.UTF-8
}

I wonder why this randomly stops working now?

adrelanos avatar Mar 15 '19 21:03 adrelanos

The issue exactly happened after installing "qubes-core-agent-passwordless-root " in debian-qubes-minimal

cc @marmarek

TNTBOMBOM avatar Jun 19 '19 14:06 TNTBOMBOM

On Wed, Jun 19, 2019 at 07:35:30AM -0700, TNT BOM BOM wrote:

The issue exactly happened after installing "qubes-core-agent-passwordless-root " in debian-qubes-minimal

No, it's present in the minimal template - nothing to do with installing that package.

unman avatar Jun 20 '19 00:06 unman

No, it's present in the minimal template - nothing to do with installing that package.

It just showed up after installing it. If you see its not the case , what do you think causing that?

TNTBOMBOM avatar Jun 23 '19 21:06 TNTBOMBOM

Getting the same error when installing whonix-15. Locale info is in /etc/locale.conf, but on installing the new whonix he can't set the locale nl_BE.UTF-8. It's a warning and doesn't block the installation.

XStreamke avatar Jul 23 '19 07:07 XStreamke

I haven't seen this issue anymore for a while. No idea why it went away.

This is also the case in these new Qubes-Whonix templates which are currently being tested (but announcement not written yet) (and which might become the new stable version shouldn't there be any other release blockers):

  • https://github.com/QubesOS/updates-status/issues/1661
  • https://github.com/QubesOS/updates-status/issues/1662
  • https://www.whonix.org/wiki/Qubes/Install/Testing

Therefore closing.

Anyone feel free to re-open this if this is still happening.

adrelanos avatar Mar 01 '20 18:03 adrelanos

Same issue as before.

locale
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=C.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=

A messed up locale can be confusing and break scripts (for example breaks str_replace but can be worked around using LANG=C str_replace).

It is now re-happening after Qubes-Whonix 15 (Debian bullseye based) to Qubes-Whonix 16 (bullseye based) release upgrade, Release Upgrade Whonix 15 to Whonix 16.

The issue does not happen in Non-Qubes-Whonix. I therefore suspect there must be something wrong with how Qubes build process creates the Debian base image. https://github.com/QubesOS/qubes-issues/issues/1055 would probably solve that.

sudo locale-gen does not fix the issue.

cat /etc/default/locale
#  File generated by update-locale
LANG=en_US.UTF-8

Output of cat /etc/locale.gen | grep --invert-match \# is empty.

adrelanos avatar Aug 22 '21 20:08 adrelanos

Installing locales-all fixes the problem

DemiMarie avatar Aug 23 '21 06:08 DemiMarie

@DemiMarie

Installing locales-all fixes the problem

I was about to write with concerns about insufficient space on Qubes installer DVD but then saw @marmarek did that already here: https://github.com/QubesOS/qubes-core-agent-linux/pull/322#issuecomment-903579127

adrelanos avatar Aug 23 '21 16:08 adrelanos

@adrelanos does it happen only on release upgrade from Whonix 15, or on a fresh build of Whonix 16 too?

This is how the locale is generated: https://github.com/QubesOS/qubes-builder-debian/blob/master/template_debian/distribution.sh#L359-L363 I guess it should be also added to /etc/locale.gen, right?

An alternative idea is to set LC_CTYPE=C.UTF-8 instead of LANG=en_US.UTF-8 - to just enable UTF-8 in applications output, but don't specify explicit language. By reading comments in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609306, it seems setting LANG=C.UTF-8 would be a bad choice.

marmarek avatar Aug 23 '21 16:08 marmarek

(Added a workaround to Whonix. Referenced by github above. But that's just a band aid. A proper fix would be great.)

@adrelanos does it happen only on release upgrade from Whonix 15, or on a fresh build of Whonix 16 too?

Only on release upgrade from Whonix 15. Fresh build not yet tested. (Will do in near future.)

This is how the locale is generated: https://github.com/QubesOS/qubes-builder-debian/blob/master/template_debian/distribution.sh#L359-L363 I guess it should be also added to /etc/locale.gen, right?

(From https://github.com/grml/grml-debootstrap/issues/25) grml-debootstrap had the same issue (new builds) (https://github.com/grml/grml-debootstrap/issues/25) and the solution was this (https://github.com/grml/grml-debootstrap/commit/430c060be15f60f508428edbc03ea70d9bf04399). Perhaps have a look.

This is how the locale is generated: https://github.com/QubesOS/qubes-builder-debian/blob/master/template_debian/distribution.sh#L359-L363 I guess it should be also added to /etc/locale.gen, right?

Could be. But doing that after the issue happened and then running sudo locale-genand/or sudo update-locale did not fix the issue for me. Maybe it would for new builds but I wouldn't know why.

adrelanos avatar Aug 23 '21 17:08 adrelanos

Hm, sudo locale-gen should fix that, if en_US.UTF-8 UTF-8 line is uncommented in /etc/locale.gen. Maybe wrong line?

marmarek avatar Aug 23 '21 17:08 marmarek

(From grml/grml-debootstrap#25) grml-debootstrap had the same issue (new builds) (grml/grml-debootstrap#25) and the solution was this (grml/grml-debootstrap@430c060). Perhaps have a look.

So, they have en_US.UTF-8 locale generated by default via /etc/locale.gen. Sounds like we should do that too.

marmarek avatar Aug 23 '21 17:08 marmarek

Same problem is still happening with a fresh debian-11-minimal template from the repo on a fresh Qubes 4.1.1 installation.

andrewdavidwong avatar Jul 21 '22 07:07 andrewdavidwong

Reverted title change based on https://github.com/QubesOS/qubes-core-agent-linux/pull/322#issuecomment-903579127.

andrewdavidwong avatar Jul 21 '22 07:07 andrewdavidwong

We need to figure out what locales the user needs, and generate them via /etc/locale.gen.

DemiMarie avatar Jul 21 '22 18:07 DemiMarie

We need to figure out what locales the user needs, and generate them via /etc/locale.gen.

Just use the default which is en_US.UTF-8 no need further expansion.

TNTBOMBOM avatar Jul 24 '22 18:07 TNTBOMBOM