unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52831: [installer] Locale problems with nss-certs
@ 2021-12-27 19:52 Leo Famulari
  2021-12-29 17:26 ` Mathieu Othacehe
  0 siblings, 1 reply; 9+ messages in thread
From: Leo Famulari @ 2021-12-27 19:52 UTC (permalink / raw)
  To: 52831

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

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 #2: installer.png --]
[-- Type: image/png, Size: 178764 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-27 19:52 bug#52831: [installer] Locale problems with nss-certs Leo Famulari
@ 2021-12-29 17:26 ` Mathieu Othacehe
  2021-12-29 18:47   ` Leo Famulari
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Othacehe @ 2021-12-29 17:26 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 52831


Hello Leo,

> 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:

--8<---------------cut here---------------start------------->8---
  (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)))))))
--8<---------------cut here---------------end--------------->8---

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.

--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?

Thanks,

Mathieu




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-29 17:26 ` Mathieu Othacehe
@ 2021-12-29 18:47   ` Leo Famulari
  2021-12-29 22:02     ` Mathieu Othacehe
  0 siblings, 1 reply; 9+ messages in thread
From: Leo Famulari @ 2021-12-29 18:47 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 52831

On Wed, Dec 29, 2021 at 06:26:05PM +0100, Mathieu Othacehe wrote:
> > 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.

> 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?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-29 18:47   ` Leo Famulari
@ 2021-12-29 22:02     ` Mathieu Othacehe
  2021-12-30  0:11       ` Leo Famulari
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Othacehe @ 2021-12-29 22:02 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 52831


Hello Leo,

> 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.

--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,

Mathieu




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-29 22:02     ` Mathieu Othacehe
@ 2021-12-30  0:11       ` Leo Famulari
  2021-12-30  9:37         ` Mathieu Othacehe
  0 siblings, 1 reply; 9+ messages in thread
From: Leo Famulari @ 2021-12-30  0:11 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 52831

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

On Wed, Dec 29, 2021 at 11:02:45PM +0100, Mathieu Othacehe wrote:
> 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.

[-- Attachment #2: installer-crash.png --]
[-- Type: image/png, Size: 131750 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-30  0:11       ` Leo Famulari
@ 2021-12-30  9:37         ` Mathieu Othacehe
  2021-12-30 11:21           ` Mathieu Othacehe
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Othacehe @ 2021-12-30  9:37 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 52831


Hey,

> 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-30  9:37         ` Mathieu Othacehe
@ 2021-12-30 11:21           ` Mathieu Othacehe
  2021-12-30 18:11             ` Leo Famulari
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Othacehe @ 2021-12-30 11:21 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 52831


> 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-30 11:21           ` Mathieu Othacehe
@ 2021-12-30 18:11             ` Leo Famulari
  2021-12-30 19:34               ` Mathieu Othacehe
  0 siblings, 1 reply; 9+ messages in thread
From: Leo Famulari @ 2021-12-30 18:11 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 52831

On Thu, Dec 30, 2021 at 12:21:55PM +0100, Mathieu Othacehe wrote:
> 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?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#52831: [installer] Locale problems with nss-certs
  2021-12-30 18:11             ` Leo Famulari
@ 2021-12-30 19:34               ` Mathieu Othacehe
  0 siblings, 0 replies; 9+ messages in thread
From: Mathieu Othacehe @ 2021-12-30 19:34 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 52831-done


> 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-30 19:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 19:52 bug#52831: [installer] Locale problems with nss-certs Leo Famulari
2021-12-29 17:26 ` Mathieu Othacehe
2021-12-29 18:47   ` Leo Famulari
2021-12-29 22:02     ` Mathieu Othacehe
2021-12-30  0:11       ` Leo Famulari
2021-12-30  9:37         ` Mathieu Othacehe
2021-12-30 11:21           ` Mathieu Othacehe
2021-12-30 18:11             ` Leo Famulari
2021-12-30 19:34               ` Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).