[installer] Locale problems with nss-certs

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Famulari
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Leo Famulari
Severity
normal
L
L
Leo Famulari wrote on 27 Dec 2021 20:52
(address . bug-guix@gnu.org)
YcoZfztDWn8a7cYJ@jasmine.lan
While testing the Guix System installer, I noticed that installation of
nss-certs has some problems that seem related to locales.

Some of the certificate's filenames are encoded in a way that isn't
supported by the environment in which they are being handled, and so
these certificates are not installed into the new system.

I've attached a screenshot of the error messages in the installer. The
problematic certificates are listed there.
Attachment: installer.png
M
M
Mathieu Othacehe wrote on 29 Dec 2021 18:26
(name . Leo Famulari)(address . leo@famulari.name)(address . 52831@debbugs.gnu.org)
878rw3l3v6.fsf@gnu.org
Hello Leo,

Toggle quote (3 lines)
> While testing the Guix System installer, I noticed that installation of
> nss-certs has some problems that seem related to locales.

What locale did you pick in the installer?

I think the issue lies in the (gnu installer utils) module, run-command
procedure:

Toggle snippet (13 lines)
(when locale
(let ((supported? (false-if-exception
(setlocale LC_ALL locale))))
;; If LOCALE is not supported, then set LANGUAGE, which might at
;; least give us translated messages.
(if supported?
(setenv "LC_ALL" locale)
(setenv "LANGUAGE"
(string-take locale
(or (string-index locale #\_)
(string-length locale)))))))

If you pick a locale such as en_AG.utf8 which is not supported by the
glibc-utf8-locales package, then supported? is #f, which means that
LC_ALL is never set.

The following patch fixes it for me.

Toggle snippet (23 lines)
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
index bb97bc5560..d745996a3a 100644
--- a/gnu/installer/utils.scm
+++ b/gnu/installer/utils.scm
@@ -97,10 +97,12 @@ (define (pause)
;; least give us translated messages.
(if supported?
(setenv "LC_ALL" locale)
- (setenv "LANGUAGE"
- (string-take locale
- (or (string-index locale #\_)
- (string-length locale)))))))
+ (begin
+ (setlocale LC_ALL "en_US.utf8")
+ (setenv "LANGUAGE"
+ (string-take locale
+ (or (string-index locale #\_)
+ (string-length locale))))))))
(guard (c ((invoke-error? c)
(newline)

WDYT?

Thanks,

Mathieu
L
L
Leo Famulari wrote on 29 Dec 2021 19:47
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 52831@debbugs.gnu.org)
YcytU85qlu3kt5zl@jasmine.lan
On Wed, Dec 29, 2021 at 06:26:05PM +0100, Mathieu Othacehe wrote:
Toggle quote (5 lines)
> > While testing the Guix System installer, I noticed that installation of
> > nss-certs has some problems that seem related to locales.
>
> What locale did you pick in the installer?

I chose the first items in the lists, which are "English" of the
territory "Antigua and Barbuda". That's "en_AG.utf8"

When I use "en_US.utf8", the problem does not occur.

Toggle quote (28 lines)
> The following patch fixes it for me.
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
> index bb97bc5560..d745996a3a 100644
> --- a/gnu/installer/utils.scm
> +++ b/gnu/installer/utils.scm
> @@ -97,10 +97,12 @@ (define (pause)
> ;; least give us translated messages.
> (if supported?
> (setenv "LC_ALL" locale)
> - (setenv "LANGUAGE"
> - (string-take locale
> - (or (string-index locale #\_)
> - (string-length locale)))))))
> + (begin
> + (setlocale LC_ALL "en_US.utf8")
> + (setenv "LANGUAGE"
> + (string-take locale
> + (or (string-index locale #\_)
> + (string-length locale))))))))
>
> (guard (c ((invoke-error? c)
> (newline)
> --8<---------------cut here---------------end--------------->8---
>
> WDYT?

I applied this patch to my Git repo and built a new installer like this:

`./pre-inst-env guix system image -t uncompressed-iso9660 --label="GUIX_x86_64-linux-leo" --system=x86_64-linux gnu/system/install.scm`

Then I copied the image out of the store and booted it in QEMU.

But, I still had the problem during installation. Did I miss a step?
M
M
Mathieu Othacehe wrote on 29 Dec 2021 23:02
(name . Leo Famulari)(address . leo@famulari.name)(address . 52831@debbugs.gnu.org)
878rw3ax2y.fsf@gnu.org
Hello Leo,

Toggle quote (4 lines)
> Then I copied the image out of the store and booted it in QEMU.
>
> But, I still had the problem during installation. Did I miss a step?

No, I just sent you a wrong version of my patch, sorry about
that. LC_ALL needs to be set as an environment variable and with a
setlocale call.

Toggle snippet (21 lines)
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
index bb97bc5560..24c16e7e12 100644
--- a/gnu/installer/utils.scm
+++ b/gnu/installer/utils.scm
@@ -97,10 +97,13 @@ (define (pause)
;; least give us translated messages.
(if supported?
(setenv "LC_ALL" locale)
- (setenv "LANGUAGE"
- (string-take locale
- (or (string-index locale #\_)
- (string-length locale)))))))
+ (begin
+ (setlocale LC_ALL "en_US.utf8")
+ (setenv "LC_ALL" "en_US.utf8")
+ (setenv "LANGUAGE"
+ (string-take locale
+ (or (string-index locale #\_)
+ (string-length locale))))))))

Thanks,

Mathieu
L
L
Leo Famulari wrote on 30 Dec 2021 01:11
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 52831@debbugs.gnu.org)
Ycz5KVExa1s0dU8p@jasmine.lan
On Wed, Dec 29, 2021 at 11:02:45PM +0100, Mathieu Othacehe wrote:
Toggle quote (26 lines)
> No, I just sent you a wrong version of my patch, sorry about
> that. LC_ALL needs to be set as an environment variable and with a
> setlocale call.
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
> index bb97bc5560..24c16e7e12 100644
> --- a/gnu/installer/utils.scm
> +++ b/gnu/installer/utils.scm
> @@ -97,10 +97,13 @@ (define (pause)
> ;; least give us translated messages.
> (if supported?
> (setenv "LC_ALL" locale)
> - (setenv "LANGUAGE"
> - (string-take locale
> - (or (string-index locale #\_)
> - (string-length locale)))))))
> + (begin
> + (setlocale LC_ALL "en_US.utf8")
> + (setenv "LC_ALL" "en_US.utf8")
> + (setenv "LANGUAGE"
> + (string-take locale
> + (or (string-index locale #\_)
> + (string-length locale))))))))
> --8<---------------cut here---------------end--------------->8---

Thanks, that does fix the issue with installing nss-certs.

But, now the installer always crashes at the end, after initializing the
system on /mnt, when I "Press Enter to continue". A screenshot of the
error message is attached. I can't scroll down to view more of it.
M
M
Mathieu Othacehe wrote on 30 Dec 2021 10:37
(name . Leo Famulari)(address . leo@famulari.name)(address . 52831@debbugs.gnu.org)
87sfuafn6e.fsf@gnu.org
Hey,

Toggle quote (4 lines)
> But, now the installer always crashes at the end, after initializing the
> system on /mnt, when I "Press Enter to continue". A screenshot of the
> error message is attached. I can't scroll down to view more of it.

Oh right, system tests are failing here:
https://ci.guix.gnu.org/eval/19842.Looks like the final umount fails,
that's strange.

Mathieu
M
M
Mathieu Othacehe wrote on 30 Dec 2021 12:21
(name . Leo Famulari)(address . leo@famulari.name)(address . 52831@debbugs.gnu.org)
87fsqafics.fsf@gnu.org
Toggle quote (4 lines)
> Oh right, system tests are failing here:
> https://ci.guix.gnu.org/eval/19842. Looks like the final umount fails,
> that's strange.

Found why. Turns out installing the locale was preventing the cow-store
umount. This is now fixed in the wip-harden-installer branch. The
installer tests are passing, and I can use supported (fr_FR.utf8) and
unsupported (en_AG.utf8) locales without hitting the nss-certs copy
issue.

Thanks,

Mathieu
L
L
Leo Famulari wrote on 30 Dec 2021 19:11
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 52831@debbugs.gnu.org)
Yc32bvsig3lWtB69@jasmine.lan
On Thu, Dec 30, 2021 at 12:21:55PM +0100, Mathieu Othacehe wrote:
Toggle quote (6 lines)
> Found why. Turns out installing the locale was preventing the cow-store
> umount. This is now fixed in the wip-harden-installer branch. The
> installer tests are passing, and I can use supported (fr_FR.utf8) and
> unsupported (en_AG.utf8) locales without hitting the nss-certs copy
> issue.

Great, with your latest patch all seems to work well.

The plan is to use wip-harden-installer for the release, right?
M
M
Mathieu Othacehe wrote on 30 Dec 2021 20:34
(name . Leo Famulari)(address . leo@famulari.name)(address . 52831-done@debbugs.gnu.org)
87wnjlga4q.fsf@gnu.org
Toggle quote (4 lines)
> Great, with your latest patch all seems to work well.
>
> The plan is to use wip-harden-installer for the release, right?

Yup, that's the plan :) In the meantime, I think we can close this one.

Thanks,

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 52831@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 52831
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch