GNU Guile warning: failed to install locale

Hello everybunny :rabbit2: ,

I’ve installed GNU Guile over Guix on my Debian VM recently.
I’m able to use guile(1) but I always get the message:

guile: warning: failed to install locale
warning: failed to install locale: Invalid argument

at the beginning.
Installing glibc-locales and glibc-utf8-locales-2.29 didn’t resolve the issue.
My guile(1) version is GNU Guile 3.0.9.
Is someone having the same issue?

Bunny regards
Fyrfaras :rabbit:

I’m neither a Guix user, nor a Guile user, but let’s try. I guess that guix shell guile -- guile reproduces the behavior. So let’s use strace to see whether something interesting happens before the warning:

guix shell guile glibc-locales strace -- strace guile --version |& grep -E "warning:.*install locale"  -B6
openat(AT_FDCWD, "/run/current-system/locale/2.33/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en_US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en_US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "guile: warning: failed to instal"..., 41guile: warning: failed to install locale

In case you don’t know openat(...), it’s what actually opens files. Or at least tries to. In this case, the openat call returns ENOENT: the file does not exist.

My LANG environment variable is en_US.UTF-8, which explains all those tries. Either way, this shows that the locale system looks for the locales within /run/current-system, a path that does not exist on Debian. I guess that /run/current-system/ is a Guix thing about the, well, current system configuration, but that’s not available on Debian.

However, the important part here is that my LANG was used within the guix shell environment. The issue vanishes as soon as we use a --pure (or --container) shell, as this won’t transfer the LANG env:

$ guix shell --pure guile glibc-locales strace -- strace guile --version |& grep -E "warning:.*install locale"  -B6

No output, therefore no warning. So all in all, I guess this is an issue of Guix@Debian not setting the current-system correctly.

2 Likes

I’ve seen that message pop up as well from time to time, but now I can’t reproduce it.

I don’t know if this helps at all, but since you don’t mention it I’ll ask: did you also set the GUIX_LOCPATH environment variable mentioned in the documentation?

1 Like

Some distributions differ where to set environment variables for login shells or other shells. Putting to GUIX_LOC_PATH into .bashrc works here on ASAHI Ubuntu

Great find! Can confirm that this works.

Without the environment variable
$ guix shell guile glibc-locales strace -- strace -e trace=openat guile --version |& grep -E "warning|locale"
openat(AT_FDCWD, "/run/current-system/locale/2.33/locale-archive", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/run/current-system/locale/2.33/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en_US.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en_US/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en.utf8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/current-system/locale/2.33/en/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
guile: warning: failed to install locale
With the environment variable
$ GUIX_LOCPATH=$HOME/.guix-profile/lib/locale guix shell guile glibc-locales strace -- strace -e trace=openat guile --version |& grep -E "warning|locale"
openat(AT_FDCWD, "/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_IDENTIFICATION", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_MEASUREMENT", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_TELEPHONE", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_ADDRESS", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_NAME", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_PAPER", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_MESSAGES", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_MESSAGES/SYS_LC_MESSAGES", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_MONETARY", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_COLLATE", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_TIME", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/ashraz/.guix-profile/lib/locale/2.33/en_US.UTF-8/LC_CTYPE", O_RDONLY|O_CLOEXEC) = 3

# snip, rest not relevant. no warning though!

So @fyrfaras, you want to set the GUIX_LOCPATH as described within info "(guix) Application Setup" (e.g. use export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale in your .profile or your shell’s equivalent) :slight_smile:

1 Like

Yep, this is a common pitfall of using Guix as a package manager and these steps are required on “foreign” distributions.

1 Like

Yeah the first little while I used it I had these troubles, I’m really thankful that this page was in the documentation :smiley:

There are still some issues I don’t know how to get around, though… sometimes trying to install things from the AUR (btw I use Arch) fails to compile because it mistakenly tries to build against the wrong libc or glib or something along those lines. Going full-in on Guix fixes that, but sometimes it’s easier to do yay -S some-package than guix shell --pure coreutils bash gcc pkg-config dep1 dep2 dep3 ... :slight_smile:

Thank you so much everybunny :rabbit: !!

I inserted the GUIX_LOCPATH in my .profile.
Now it works like a charm and there aren’t any warnings :sparkler:
Thanks again @ashraz, @ryuslash, @ennoausberlin and @daviwil :heart:

@ashraz Your indepth view with strace is really cool. For future debuggings I will keep this in mind for my toolbox :toolbox: Also I should rely more on info :information_source:

2 Likes