New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix locale in fedora-*-minimal #2435

Closed
andrewdavidwong opened this Issue Nov 14, 2016 · 22 comments

Comments

Projects
None yet
6 participants
@andrewdavidwong
Member

andrewdavidwong commented Nov 14, 2016

Qubes OS version (e.g., R3.1):

R3.2

Affected TemplateVMs (e.g., fedora-23, if applicable):

fedora-24-minimal


When updating the fedora-24-minimal template, there are warnings of this type:

/etc/profile.d/lang.sh: line 19: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory

(Repeated for LC_COLLATE, LC_MESSAGES, LC_NUMERIC, and LC_TIME.)

And after the update is finished:

Failed to set locale, defaulting to C
@rustybird

This comment has been minimized.

Show comment
Hide comment
@rustybird

rustybird Nov 14, 2016

This can be fixed by installing the glibc-langpack-en package, or alternatively by running localectl set-locale LANG=C and restarting

rustybird commented Nov 14, 2016

This can be fixed by installing the glibc-langpack-en package, or alternatively by running localectl set-locale LANG=C and restarting

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Nov 15, 2016

Contributor

Yeah, I noticed this too.

% env | grep LANG
LANG=en_US.UTF-8
% env | grep LC_
% strace -o trace man man > /dev/null
man: can't set the locale; make sure $LC_* and $LANG are correct
% grep locale trace                  
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "can't set the locale; make sure "..., 59) = 59
open("/usr/lib/locale/en_US.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Changing /etc/locale.conf from LANG=en_US.UTF-8 to LANG=C also seems to work.

Contributor

jpouellet commented Nov 15, 2016

Yeah, I noticed this too.

% env | grep LANG
LANG=en_US.UTF-8
% env | grep LC_
% strace -o trace man man > /dev/null
man: can't set the locale; make sure $LC_* and $LANG are correct
% grep locale trace                  
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "can't set the locale; make sure "..., 59) = 59
open("/usr/lib/locale/en_US.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en_US/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en.utf8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/en/LC_CTYPE", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Changing /etc/locale.conf from LANG=en_US.UTF-8 to LANG=C also seems to work.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Nov 22, 2016

Contributor

@marmarek what do you think the appropriate path forward is here?

I propose installing glibc-langpack-en for fedora24 and only setting LANG=C for -minimal.

Contributor

jpouellet commented Nov 22, 2016

@marmarek what do you think the appropriate path forward is here?

I propose installing glibc-langpack-en for fedora24 and only setting LANG=C for -minimal.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 22, 2016

Member

Seems like a good idea.

Member

marmarek commented Nov 22, 2016

Seems like a good idea.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 22, 2016

Member

Hmm, looking the commit setting locale, it is done for gnome-terminal. Here are more details: #1033
But I've just checked and gnome-terminal seems to run just fine with either LANG=C or LANG=. So, maybe setting default locale isn't needed at all anymore?

On the other hand - changing this right now (as a stable update) isn't the best idea... So this would be (if at all) for Qubes 4.0. And for now LANG=C just for minimal template.

Member

marmarek commented Nov 22, 2016

Hmm, looking the commit setting locale, it is done for gnome-terminal. Here are more details: #1033
But I've just checked and gnome-terminal seems to run just fine with either LANG=C or LANG=. So, maybe setting default locale isn't needed at all anymore?

On the other hand - changing this right now (as a stable update) isn't the best idea... So this would be (if at all) for Qubes 4.0. And for now LANG=C just for minimal template.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Nov 22, 2016

Contributor

Not the best idea because why? A desire to avoid churn for everybody for minimal benefit? Or some other reason?

Contributor

jpouellet commented Nov 22, 2016

Not the best idea because why? A desire to avoid churn for everybody for minimal benefit? Or some other reason?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 22, 2016

Member

Risk of regression or other unwanted side effects - like the one with gnome-terminal mentioned above.

Member

marmarek commented Nov 22, 2016

Risk of regression or other unwanted side effects - like the one with gnome-terminal mentioned above.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Nov 22, 2016

Contributor

Makes sense.

Sounds to me like that's an argument for just installing glibc-langpack-en instead of trying to switch to LANG=C? Or just leave this unresolved?

Contributor

jpouellet commented Nov 22, 2016

Makes sense.

Sounds to me like that's an argument for just installing glibc-langpack-en instead of trying to switch to LANG=C? Or just leave this unresolved?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 22, 2016

Member

How many packages are pulled in by glibc-langpack-en on minimal template? If not many (for example just one), that's ok.

Member

marmarek commented Nov 22, 2016

How many packages are pulled in by glibc-langpack-en on minimal template? If not many (for example just one), that's ok.

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Nov 22, 2016

Contributor

Deps are small:

$ rpm -qR glibc-langpack-en
glibc = 2.23.1-11.fc24
glibc-common = 2.23.1-11.fc24
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1

Install log on clean fedora-24-minimal here.

Contributor

jpouellet commented Nov 22, 2016

Deps are small:

$ rpm -qR glibc-langpack-en
glibc = 2.23.1-11.fc24
glibc-common = 2.23.1-11.fc24
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1

Install log on clean fedora-24-minimal here.

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Nov 22, 2016

Member

I propose installing glibc-langpack-en for fedora24

Why? Is there a problem on fedora-24? I only noticed it on fedora-24-minimal.

only setting LANG=C for -minimal

This seems preferable to installing any additional packages, especially in the minimal template. More packages, larger attack surface, right?

Member

andrewdavidwong commented Nov 22, 2016

I propose installing glibc-langpack-en for fedora24

Why? Is there a problem on fedora-24? I only noticed it on fedora-24-minimal.

only setting LANG=C for -minimal

This seems preferable to installing any additional packages, especially in the minimal template. More packages, larger attack surface, right?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 22, 2016

Member

Why? Is there a problem on fedora-24? I only noticed it on fedora-24-minimal.

Indeed non-minimal template have glibc-all-langpacks installed.

This seems preferable to installing any additional packages, especially in the minimal template. More packages, larger attack surface, right?

I don't think glibc-langpack-en enlarge attack surface in any way (unless it would pull in some other package that would do so) - it doesn't expose any additional interface - package brings in only some data (translations), not code. IMO the only concern here for minimal template is its size, but the package is relatively small (275k compressed, about 4MB uncompressed).

Member

marmarek commented Nov 22, 2016

Why? Is there a problem on fedora-24? I only noticed it on fedora-24-minimal.

Indeed non-minimal template have glibc-all-langpacks installed.

This seems preferable to installing any additional packages, especially in the minimal template. More packages, larger attack surface, right?

I don't think glibc-langpack-en enlarge attack surface in any way (unless it would pull in some other package that would do so) - it doesn't expose any additional interface - package brings in only some data (translations), not code. IMO the only concern here for minimal template is its size, but the package is relatively small (275k compressed, about 4MB uncompressed).

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Nov 22, 2016

Member

I don't think glibc-langpack-en enlarge attack surface in any way (unless it would pull in some other package that would do so) - it doesn't expose any additional interface - package brings in only some data (translations), not code.

But the attack surface isn't just the code; it also includes the package maintainer(s), their signing keys, development machines, etc., any/all of which could be compromised, right? (In any case, I agree that this one package doesn't make much of a difference, but ceteris paribus, it seems preferable to adhere to principles.)

Member

andrewdavidwong commented Nov 22, 2016

I don't think glibc-langpack-en enlarge attack surface in any way (unless it would pull in some other package that would do so) - it doesn't expose any additional interface - package brings in only some data (translations), not code.

But the attack surface isn't just the code; it also includes the package maintainer(s), their signing keys, development machines, etc., any/all of which could be compromised, right? (In any case, I agree that this one package doesn't make much of a difference, but ceteris paribus, it seems preferable to adhere to principles.)

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Nov 22, 2016

Contributor

While I agree that simply having utf8 errno value -> string conversions and such should be totally fine, safe utf8 handling in general is quite difficult, and if using the C locale would cause programs to handle input as ASCII and bypass utf8 handling code paths, then perhaps there is something to be said for that.

For example, my IRC client displays all unicode characters as \u1234 instead of the actual character, and this did in practice save me from some font rendering bug on OS X a while back (the details of which have been lost to memory).

Unicode is just too complex to ever be secure. -- Bruce Schneier

Contributor

jpouellet commented Nov 22, 2016

While I agree that simply having utf8 errno value -> string conversions and such should be totally fine, safe utf8 handling in general is quite difficult, and if using the C locale would cause programs to handle input as ASCII and bypass utf8 handling code paths, then perhaps there is something to be said for that.

For example, my IRC client displays all unicode characters as \u1234 instead of the actual character, and this did in practice save me from some font rendering bug on OS X a while back (the details of which have been lost to memory).

Unicode is just too complex to ever be secure. -- Bruce Schneier

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Nov 26, 2016

Member

Updated template uploaded to the repository.

Member

marmarek commented Nov 26, 2016

Updated template uploaded to the repository.

@entr0py

This comment has been minimized.

Show comment
Hide comment
@entr0py

entr0py Dec 15, 2016

Hmm, looking the commit setting locale, it is done for gnome-terminal. Here are more details: #1033
But I've just checked and gnome-terminal seems to run just fine with either LANG=C or LANG=. So, maybe setting default locale isn't needed at all anymore?

Not sure what I'm doing differently but gnome-terminal does not run for me in fedora-24-minimal with LANG=C. Installing glibc-langpack-en, followed by localectl set-locale LANG=en_US.utf8 solves the issue. If glibc-langpack-en is left out for space considerations, perhaps a note could be added to fedora-24-minimal documentation?

Also, not to play favorites, maybe uninstall glibc-langpack-zu (South African isiZulu) from the default template? :-P

$ localectl list-locales
C.utf8
zu_ZA
zu_ZA.utf8

entr0py commented Dec 15, 2016

Hmm, looking the commit setting locale, it is done for gnome-terminal. Here are more details: #1033
But I've just checked and gnome-terminal seems to run just fine with either LANG=C or LANG=. So, maybe setting default locale isn't needed at all anymore?

Not sure what I'm doing differently but gnome-terminal does not run for me in fedora-24-minimal with LANG=C. Installing glibc-langpack-en, followed by localectl set-locale LANG=en_US.utf8 solves the issue. If glibc-langpack-en is left out for space considerations, perhaps a note could be added to fedora-24-minimal documentation?

Also, not to play favorites, maybe uninstall glibc-langpack-zu (South African isiZulu) from the default template? :-P

$ localectl list-locales
C.utf8
zu_ZA
zu_ZA.utf8
@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Dec 22, 2016

Member

Also, not to play favorites, maybe uninstall glibc-langpack-zu (South African isiZulu) from the default template? :-P

$ sudo dnf remove glibc-langpack-zu
Dependencies resolved.
Error: The operation would result in removing the following protected packages: dnf, systemd.

Odd.

Member

andrewdavidwong commented Dec 22, 2016

Also, not to play favorites, maybe uninstall glibc-langpack-zu (South African isiZulu) from the default template? :-P

$ sudo dnf remove glibc-langpack-zu
Dependencies resolved.
Error: The operation would result in removing the following protected packages: dnf, systemd.

Odd.

@entr0py

This comment has been minimized.

Show comment
Hide comment
@entr0py

entr0py Dec 22, 2016

Ah, now it makes sense. I didn't get that error because I installed glibc-lanpack-en before removing zu. It must be that one langpack is required and that's why zu was not removed from the template in the first place.

entr0py commented Dec 22, 2016

Ah, now it makes sense. I didn't get that error because I installed glibc-lanpack-en before removing zu. It must be that one langpack is required and that's why zu was not removed from the template in the first place.

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Dec 22, 2016

Member

Yes, you're right. After installing glibc-lanpack-en, I was able to remove glibc-langpack-zu. Since we have to have one installed anyway by default, it might as well be glibc-lanpack-en. What do you think @marmarek?

Member

andrewdavidwong commented Dec 22, 2016

Yes, you're right. After installing glibc-lanpack-en, I was able to remove glibc-langpack-zu. Since we have to have one installed anyway by default, it might as well be glibc-lanpack-en. What do you think @marmarek?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Dec 22, 2016

Member

Makes sense. Interesting why glibc-langpack-zu is chosen by default...

Member

marmarek commented Dec 22, 2016

Makes sense. Interesting why glibc-langpack-zu is chosen by default...

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Aug 6, 2017

Member

This is also a problem on fedora-25-minimal.

Member

andrewdavidwong commented Aug 6, 2017

This is also a problem on fedora-25-minimal.

@andrewdavidwong andrewdavidwong changed the title from Fix locale in fedora-24-minimal to Fix locale in fedora-*-minimal Nov 3, 2017

@Polygonbugs

This comment has been minimized.

Show comment
Hide comment
@Polygonbugs

Polygonbugs Feb 14, 2018

This also applied to fedora-26-minimal.

This also applied to fedora-26-minimal.

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