GNU bug report logs - #63921
Activation snippets in reverse order, prevent boot

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Tue, 6 Jun 2023 08:17:02 UTC

Severity: serious

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63921 in the body.
You can then email your comments to 63921 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Tue, 06 Jun 2023 08:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 06 Jun 2023 08:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-guix <at> gnu.org
Subject: Activation snippets in reverse order, prevent boot
Date: Tue, 06 Jun 2023 10:15:54 +0200
Booting a system reconfigured from
eed55a6544d5bda2245ec853e5fa4b28e1865bea fails with shepherd saying:

  error: while opening socket '/var/run/shepherd/socket': Address already in use

The root cause appears to be that the ‘boot’ program has expressions
reversed:

--8<---------------cut here---------------start------------->8---
$ guix gc --references $(guix gc --derivers $(readlink -f /var/guix/profiles/system-236-link)) | grep boot
/gnu/store/21ldhyrpji6lkkdxi4lgr5k9l5fr2b7l-boot.drv
$ cat $(guix build /gnu/store/21ldhyrpji6lkkdxi4lgr5k9l5fr2b7l-boot.drv)
(eval-when (expand load eval) (let ((extensions (quote ())) (prepend (lambda (items lst) (let loop ((items items) (lst lst)) (if (null? items) lst (loop (cdr items) (cons (car items) (delete (car items) lst)))))))) (set! %load-path (prepend (cons "/gnu/store/pj751v3199vmv6i6sf0szp185ryzcfdg-module-import" (map (lambda (extension) (string-append extension "/share/guile/site/" (effective-version))) extensions)) %load-path)) (set! %load-compiled-path (prepend (cons "/gnu/store/pql80c2hy38bb60c68sng74s4xa35vwk-module-import-compiled" (map (lambda (extension) (string-append extension "/lib/guile/" (effective-version) "/site-ccache")) extensions)) %load-compiled-path))))(begin (begin (false-if-exception (delete-file "/run/booted-system")) (symlink (canonicalize-path "/run/current-system") "/run/booted-system") (let loop ((fd 3)) (when (< fd 1024) (false-if-exception (let ((flags (fcntl fd F_GETFD))) (when (zero? (logand flags FD_CLOEXEC)) (fcntl fd F_SETFD (logior FD_CLOEXEC flags))))) (loop (+ fd 1)))) (execl "/gnu/store/wj5i6x3xgai7p8whwqybxwqdjdbmbzha-shepherd-0.10.99-git/bin/shepherd" "shepherd" "--config" "/gnu/store/gnjghlc3n5qbala5jfdslgfi0n3vy8v7-shepherd.conf")) (primitive-load "/gnu/store/riabgidmf6fh76klc1yam7k9j1478vvw-activate.scm") (begin (use-modules (guix build utils)) (letrec-syntax ((fail-safe (syntax-rules () ((_ exp rest ...) (begin (catch (quote system-error) (lambda () exp) (const #f)) (fail-safe rest ...))) ((_) #t)))) (fail-safe (delete-file "/etc/group.lock") (delete-file "/etc/passwd.lock") (delete-file "/etc/.pwd.lock") (setenv "GUIX_LOCPATH" "/gnu/store/5fmqijrs5f7vx8mc2q2pmq26yvhb74sm-glibc-utf8-locales-2.35/lib/locale") (setlocale LC_CTYPE "en_US.utf8") (delete-file-recursively "/tmp") (delete-file-recursively "/var/run") (mkdir "/tmp") (chmod "/tmp" 1023) (mkdir "/var/run") (chmod "/var/run" 493) (delete-file-recursively "/run/udev/watch.old")))))
--8<---------------cut here---------------end--------------->8---

Namely, (execl "…/bin/shepherd") comes before the cleanup expressions,
which is why /var/run/shepherd/socket is still around when we boot.

Ludo’.




Severity set to 'serious' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 06 Jun 2023 09:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Tue, 06 Jun 2023 09:59:02 GMT) Full text and rfc822 format available.

Message #10 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 63921 <at> debbugs.gnu.org
Cc: Brian Cully <bjc <at> spork.org>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Tue, 06 Jun 2023 11:58:40 +0200
Ludovic Courtès <ludo <at> gnu.org> skribis:

> Booting a system reconfigured from
> eed55a6544d5bda2245ec853e5fa4b28e1865bea fails with shepherd saying:
>
>   error: while opening socket '/var/run/shepherd/socket': Address already in use
>
> The root cause appears to be that the ‘boot’ program has expressions
> reversed:
>
> $ guix gc --references $(guix gc --derivers $(readlink -f /var/guix/profiles/system-236-link)) | grep boot
> /gnu/store/21ldhyrpji6lkkdxi4lgr5k9l5fr2b7l-boot.drv
> $ cat $(guix build /gnu/store/21ldhyrpji6lkkdxi4lgr5k9l5fr2b7l-boot.drv)
> (eval-when (expand load eval) (let ((extensions (quote ())) (prepend (lambda (items lst) (let loop ((items items) (lst lst)) (if (null? items) lst (loop (cdr items) (cons (car items) (delete (car items) lst)))))))) (set! %load-path (prepend (cons "/gnu/store/pj751v3199vmv6i6sf0szp185ryzcfdg-module-import" (map (lambda (extension) (string-append extension "/share/guile/site/" (effective-version))) extensions)) %load-path)) (set! %load-compiled-path (prepend (cons "/gnu/store/pql80c2hy38bb60c68sng74s4xa35vwk-module-import-compiled" (map (lambda (extension) (string-append extension "/lib/guile/" (effective-version) "/site-ccache")) extensions)) %load-compiled-path))))(begin (begin (false-if-exception (delete-file "/run/booted-system")) (symlink (canonicalize-path "/run/current-system") "/run/booted-system") (let loop ((fd 3)) (when (< fd 1024) (false-if-exception (let ((flags (fcntl fd F_GETFD))) (when (zero? (logand flags FD_CLOEXEC)) (fcntl fd F_SETFD (logior FD_CLOEXEC flags))))) (loop (+ fd 1)))) (execl "/gnu/store/wj5i6x3xgai7p8whwqybxwqdjdbmbzha-shepherd-0.10.99-git/bin/shepherd" "shepherd" "--config" "/gnu/store/gnjghlc3n5qbala5jfdslgfi0n3vy8v7-shepherd.conf")) (primitive-load "/gnu/store/riabgidmf6fh76klc1yam7k9j1478vvw-activate.scm") (begin (use-modules (guix build utils)) (letrec-syntax ((fail-safe (syntax-rules () ((_ exp rest ...) (begin (catch (quote system-error) (lambda () exp) (const #f)) (fail-safe rest ...))) ((_) #t)))) (fail-safe (delete-file "/etc/group.lock") (delete-file "/etc/passwd.lock") (delete-file "/etc/.pwd.lock") (setenv "GUIX_LOCPATH" "/gnu/store/5fmqijrs5f7vx8mc2q2pmq26yvhb74sm-glibc-utf8-locales-2.35/lib/locale") (setlocale LC_CTYPE "en_US.utf8") (delete-file-recursively "/tmp") (delete-file-recursively "/var/run") (mkdir "/tmp") (chmod "/tmp" 1023) (mkdir "/var/run") (chmod "/var/run" 493) (delete-file-recursively "/run/udev/watch.old")))))
>
> Namely, (execl "…/bin/shepherd") comes before the cleanup expressions,
> which is why /var/run/shepherd/socket is still around when we boot.

Fixed in 181951207339508789b28ba7cb914f983319920f.

The regression came from dbbc7e946131ba257728f1d05b96c4339b7ee88b, which
led ‘modify-services’ to change the order of services (something I had
completely overlooked while reviewing, apologies!).  I ended up
rewriting ‘modify-services’.  Good news is we now have tests for this.

Ludo’.




bug closed, send any further explanations to 63921 <at> debbugs.gnu.org and Ludovic Courtès <ludo <at> gnu.org> Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 06 Jun 2023 09:59:02 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Jun 2023 08:47:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Wed, 07 Jun 2023 08:58:02 GMT) Full text and rfc822 format available.

Message #17 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 63921 <at> debbugs.gnu.org, Brian Cully <bjc <at> spork.org>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Wed, 07 Jun 2023 10:57:18 +0200
Hi Ludo, hi all.

Ludovic Courtès <ludo <at> gnu.org> writes:
> I ended up
> rewriting ‘modify-services’.  Good news is we now have tests for this.

In the rewrite, you wrote:
> +(define (apply-clauses clauses services)
> +  "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICES, a list
> +of services.  Use each clause at most once; raise an error if a clause was not
> +used."

Using clauses at most once broke the greetd example in the manual:
> (append
>  (modify-services %base-services
>    ;; greetd-service-type provides "greetd" PAM service
>    (delete login-service-type)
>    ;; and can be used in place of mingetty-service-type
>    (delete mingetty-service-type))
>  (list
>   (service greetd-service-type

But there are multiple instances of mingetty-service-type in
%base-services.  Now an error is raised on reconfigure because there are
two term-tty2 services.

I’m not sure, isn’t it more explicit if we keep your change of deleting
at most once, but change the greetd example?

The following works for me now …

(modify-services %base-services
                 (delete login-service-type)
                 (delete mingetty-service-type)
                 (delete mingetty-service-type)
                 (delete mingetty-service-type)
                 (delete mingetty-service-type)
                 (delete mingetty-service-type)
                 (delete mingetty-service-type))

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Wed, 07 Jun 2023 09:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 63921 <at> debbugs.gnu.org, Brian Cully <bjc <at> spork.org>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Wed, 07 Jun 2023 11:19:04 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> writes:
> Using clauses at most once broke the greetd example in the manual:

Jelle Licht already reported this on IRC, see the end of
<http://logs.guix.gnu.org/guix/2023-06-06.log>

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Wed, 07 Jun 2023 09:32:02 GMT) Full text and rfc822 format available.

Message #23 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Jelle Licht <jlicht <at> fsfe.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 63921 <at> debbugs.gnu.org,
 Brian Cully <bjc <at> spork.org>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Wed, 07 Jun 2023 11:30:48 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> writes:
> "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> writes:
>> Using clauses at most once broke the greetd example in the manual:
> Jelle Licht already reported this on IRC, see the end of
> <http://logs.guix.gnu.org/guix/2023-06-06.log>

Cc Jelle Licht




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Wed, 07 Jun 2023 17:45:02 GMT) Full text and rfc822 format available.

Message #26 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: Jelle Licht <jlicht <at> fsfe.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>, Ludovic
 Courtès <ludo <at> gnu.org>
Cc: 63921 <at> debbugs.gnu.org, Brian Cully <bjc <at> spork.org>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Wed, 07 Jun 2023 19:44:11 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> writes:

> Hi Ludo, hi all.
>
[snip]

> The following works for me now …
>
> (modify-services %base-services
>                  (delete login-service-type)
>                  (delete mingetty-service-type)
>                  (delete mingetty-service-type)
>                  (delete mingetty-service-type)
>                  (delete mingetty-service-type)
>                  (delete mingetty-service-type)
>                  (delete mingetty-service-type))

Thanks for the workaround! Is this "thou shall delete N times, and
_exactly_ N times" effect of the recently pushed change functioning as
intended?  It imho seems pretty brittle and verbose compared to how
things were before.

- Jelle




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Wed, 07 Jun 2023 22:08:02 GMT) Full text and rfc822 format available.

Message #29 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: Brian Cully <bjc <at> spork.org>
To: Jelle Licht <jlicht <at> fsfe.org>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 63921 <at> debbugs.gnu.org,
 "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Wed, 07 Jun 2023 18:02:39 -0400
Jelle Licht <jlicht <at> fsfe.org> writes:

> Thanks for the workaround! Is this "thou shall delete N times, 
> and
> _exactly_ N times" effect of the recently pushed change 
> functioning as
> intended?  It imho seems pretty brittle and verbose compared to 
> how
> things were before.

We could add a ‘delete-all’ in addition to the existing ‘delete’ 
behavior. Alternately, we could change ‘delete’ back to deleting 
everything and adding ‘delete-one’. Or have both ‘delete-all’ and 
‘delete-one’ where ‘delete’ is a deprecated alias for ‘delete-all’ 
to add a path forward for older configs.

Of the three I'm most partial to the last, though I love none of 
them. I keep thinking the right solution is to have a delete that 
can match with a predicate, but then why not just use ‘filter’ or 
‘remove’?

-bjc




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Wed, 07 Jun 2023 23:08:02 GMT) Full text and rfc822 format available.

Message #32 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: 63921 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Jelle Licht <jlicht <at> fsfe.org>, Brian Cully <bjc <at> spork.org>
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Thu, 08 Jun 2023 01:07:21 +0200
Jelle is right, multiple (delete mingetty-service-type) is not useful.
With more thought, what I imagined as more explicit is probably more
like (delete "term-tty2") than (delete mingetty-service-type).  Also I
wouldn’t actually need it.

And as Brian says, just use filter.  modify-services need not do more
than what is already documented.

I would be happy if someone else would undo the change to “delete at
most once”.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Sat, 17 Jun 2023 14:00:02 GMT) Full text and rfc822 format available.

Message #35 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: 63921 <at> debbugs.gnu.org
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Sat, 17 Jun 2023 15:59:21 +0200
David Wilson has described a way to fix this bug in Guix
<https://issues.guix.gnu.org/64106>

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#63921; Package guix. (Mon, 26 Jun 2023 19:28:02 GMT) Full text and rfc822 format available.

Message #38 received at 63921 <at> debbugs.gnu.org (full text, mbox):

From: Felix Lechner <felix.lechner <at> lease-up.com>
To: 63921 <at> debbugs.gnu.org
Subject: Patch proposed
Date: Mon, 26 Jun 2023 12:26:47 -0700
Hi,

A patch to resolve this issue was proposed at the other bug

  https://issues.guix.gnu.org/64106#5

Kind regards
Felix




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Fri, 01 Sep 2023 11:45:01 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludo <at> gnu.org>:
bug acknowledged by developer. (Fri, 01 Sep 2023 11:45:02 GMT) Full text and rfc822 format available.

Message #43 received at 63921-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Felix Lechner <felix.lechner <at> lease-up.com>
Cc: 63921-done <at> debbugs.gnu.org
Subject: Re: bug#63921: Activation snippets in reverse order, prevent boot
Date: Fri, 01 Sep 2023 07:43:50 -0400
Hello,

Felix Lechner <felix.lechner <at> lease-up.com> writes:

> Hi,
>
> A patch to resolve this issue was proposed at the other bug
>
>   https://issues.guix.gnu.org/64106#5

Brian's patch in https://issues.guix.gnu.org/64106#7 was installed; it
came with tests and also cause an error to be raised when attempting to
modify a phase already deleted.

Closing, thanks for the reminder.

-- 
Thanks,
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Sep 2023 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.