GNU bug report logs -
#46560
[PATCH 0/2] Activate system when switching generations.
Previous Next
Reported by: Brice Waegeneire <brice <at> waegenei.re>
Date: Tue, 16 Feb 2021 13:01:01 UTC
Severity: normal
Tags: patch
Done: Brice Waegeneire <brice <at> waegenei.re>
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 46560 in the body.
You can then email your comments to 46560 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Tue, 16 Feb 2021 13:01:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Brice Waegeneire <brice <at> waegenei.re>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 16 Feb 2021 13:01:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
As reported on previous bug report, rolling-back or switching generation
doesn't activate the system as a system reconfiguration would do. This is
especially problematic when modifying in /run/setuid-programs, as it can't be
reverted easily. Also it hinder modification in the activation script since
it's not straight forward to revert change made by those script without a
functional roll-back mechanism.
I'm not sure it's the right approach but at least it work: it add the
activate.scm script to the system profile and then load it when
switching-generation.
This is related to issues:
- #37596 and #38884 (they are duplicate)
- #36855 a more wider discussion
Cheers,
- Brice
Brice Waegeneire (2):
gnu: services: Add activate script to the profile system directory.
scripts: system: Activate system when switching generations.
gnu/services.scm | 10 +++++++++-
guix/scripts/system.scm | 8 ++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
--
2.30.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Tue, 16 Feb 2021 13:23:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 46560 <at> debbugs.gnu.org (full text, mbox):
* gnu/services.scm (activation-profile-entry): New procedure...
(activation-service-type): ... use it.
---
gnu/services.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gnu/services.scm b/gnu/services.scm
index 13259dfaee..ddd1bac30c 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -617,13 +617,21 @@ ACTIVATION-SCRIPT-TYPE."
"Return a gexp that runs the activation script containing GEXPS."
#~(primitive-load #$(activation-script gexps)))
+(define (activation-profile-entry gexps)
+ "Return, as a monadic value, an entry for the activation script in the
+system directory."
+ (mlet %store-monad ((activate (lower-object (activation-script gexps))))
+ (return `(("activate" ,activate)))))
+
(define (second-argument a b) b)
(define activation-service-type
(service-type (name 'activate)
(extensions
(list (service-extension boot-service-type
- gexps->activation-gexp)))
+ gexps->activation-gexp)
+ (service-extension system-service-type
+ activation-profile-entry)))
(compose identity)
(extend second-argument)
(description
--
2.30.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Tue, 16 Feb 2021 13:23:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 46560 <at> debbugs.gnu.org (full text, mbox):
Fixes #38884.
* guix/scripts/system.scm (switch-to-system-generation): Load the
activate script for that generation.
---
guix/scripts/system.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 19b8c5163c..4c7af52ad5 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
;;; Copyright © 2020 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -363,11 +364,14 @@ connection to the store."
"Switch the system profile to the generation specified by SPEC, and
re-install bootloader with a configuration file that uses the specified system
generation as its default entry. STORE is an open connection to the store."
- (let ((number (relative-generation-spec->number %system-profile spec)))
+ (let* ((number (relative-generation-spec->number %system-profile spec))
+ (generation (generation-file-name %system-profile number))
+ (activate (string-append generation "/activate")))
(if number
(begin
(reinstall-bootloader store number)
- (switch-to-generation* %system-profile number))
+ (switch-to-generation* %system-profile number)
+ (primitive-load activate))
(leave (G_ "cannot switch to system generation '~a'~%") spec))))
(define* (system-bootloader-name #:optional (system %system-profile))
--
2.30.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Mon, 01 Mar 2021 15:56:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 46560 <at> debbugs.gnu.org (full text, mbox):
Hi,
Brice Waegeneire <brice <at> waegenei.re> skribis:
> * gnu/services.scm (activation-profile-entry): New procedure...
> (activation-service-type): ... use it.
[...]
> +(define (activation-profile-entry gexps)
> + "Return, as a monadic value, an entry for the activation script in the
> +system directory."
> + (mlet %store-monad ((activate (lower-object (activation-script gexps))))
> + (return `(("activate" ,activate)))))
> +
> (define (second-argument a b) b)
>
> (define activation-service-type
> (service-type (name 'activate)
> (extensions
> (list (service-extension boot-service-type
> - gexps->activation-gexp)))
> + gexps->activation-gexp)
> + (service-extension system-service-type
> + activation-profile-entry)))
Good idea, LGTM!
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Mon, 01 Mar 2021 15:57:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 46560 <at> debbugs.gnu.org (full text, mbox):
Brice Waegeneire <brice <at> waegenei.re> skribis:
> Fixes #38884.
Nitpick: “Fixes <https://bugs.gnu.org/38884>.”
> * guix/scripts/system.scm (switch-to-system-generation): Load the
> activate script for that generation.
[...]
> + (switch-to-generation* %system-profile number)
> + (primitive-load activate))
I suppose you need to wrap catch 'system-error here and to keep going
upon ENOENT.
Could you send an updated patch?
Thanks!
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Thu, 04 Mar 2021 06:59:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 46560 <at> debbugs.gnu.org (full text, mbox):
Hello Ludovic,
Ludovic Courtès <ludo <at> gnu.org> writes:
> Brice Waegeneire <brice <at> waegenei.re> skribis:
>
> > Fixes #38884.
>
> Nitpick: “Fixes <https://bugs.gnu.org/38884>.”
>
> > * guix/scripts/system.scm (switch-to-system-generation): Load the
> > activate script for that generation.
>
> [...]
>
> > + (switch-to-generation* %system-profile number)
> > + (primitive-load activate))
>
> I suppose you need to wrap catch 'system-error here and to keep going
> upon ENOENT.
This patch set fixes both issues.
Cheers,
- Brice
Brice Waegeneire (2):
gnu: services: Add activate script to the profile system directory.
scripts: system: Activate system when switching generations.
gnu/services.scm | 10 +++++++++-
guix/scripts/system.scm | 8 ++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
--
2.30.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Thu, 04 Mar 2021 06:59:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 46560 <at> debbugs.gnu.org (full text, mbox):
* gnu/services.scm (activation-profile-entry): New procedure...
(activation-service-type): ... use it.
---
gnu/services.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gnu/services.scm b/gnu/services.scm
index 13259dfaee..ddd1bac30c 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -617,13 +617,21 @@ ACTIVATION-SCRIPT-TYPE."
"Return a gexp that runs the activation script containing GEXPS."
#~(primitive-load #$(activation-script gexps)))
+(define (activation-profile-entry gexps)
+ "Return, as a monadic value, an entry for the activation script in the
+system directory."
+ (mlet %store-monad ((activate (lower-object (activation-script gexps))))
+ (return `(("activate" ,activate)))))
+
(define (second-argument a b) b)
(define activation-service-type
(service-type (name 'activate)
(extensions
(list (service-extension boot-service-type
- gexps->activation-gexp)))
+ gexps->activation-gexp)
+ (service-extension system-service-type
+ activation-profile-entry)))
(compose identity)
(extend second-argument)
(description
--
2.30.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Thu, 04 Mar 2021 06:59:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 46560 <at> debbugs.gnu.org (full text, mbox):
Fixes <https://bugs.gnu.org/38884>.
* guix/scripts/system.scm (switch-to-system-generation): Load the
activate script for that generation.
squash! scripts: system: Activate system when switching generations.
---
guix/scripts/system.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index e3cf99acc6..c226f08371 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
;;; Copyright © 2020 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -363,11 +364,14 @@ connection to the store."
"Switch the system profile to the generation specified by SPEC, and
re-install bootloader with a configuration file that uses the specified system
generation as its default entry. STORE is an open connection to the store."
- (let ((number (relative-generation-spec->number %system-profile spec)))
+ (let* ((number (relative-generation-spec->number %system-profile spec))
+ (generation (generation-file-name %system-profile number))
+ (activate (string-append generation "/activate")))
(if number
(begin
(reinstall-bootloader store number)
- (switch-to-generation* %system-profile number))
+ (switch-to-generation* %system-profile number)
+ (unless-file-not-found (primitive-load activate)))
(leave (G_ "cannot switch to system generation '~a'~%") spec))))
(define* (system-bootloader-name #:optional (system %system-profile))
--
2.30.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#46560
; Package
guix-patches
.
(Mon, 08 Mar 2021 14:16:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 46560 <at> debbugs.gnu.org (full text, mbox):
Hi Brice,
Brice Waegeneire <brice <at> waegenei.re> skribis:
> Brice Waegeneire (2):
> gnu: services: Add activate script to the profile system directory.
> scripts: system: Activate system when switching generations.
LGTM, thanks!
Ludo’.
Reply sent
to
Brice Waegeneire <brice <at> waegenei.re>
:
You have taken responsibility.
(Tue, 09 Mar 2021 06:13:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Brice Waegeneire <brice <at> waegenei.re>
:
bug acknowledged by developer.
(Tue, 09 Mar 2021 06:13:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 46560-done <at> debbugs.gnu.org (full text, mbox):
Hello Ludo,
Ludovic Courtès <ludo <at> gnu.org> writes:
> Brice Waegeneire <brice <at> waegenei.re> skribis:
>
>> Brice Waegeneire (2):
>> gnu: services: Add activate script to the profile system directory.
>> scripts: system: Activate system when switching generations.
>
> LGTM, thanks!
Pushed as df138dc20858725b90ed77be85f3318cbe1be73a and later. I'll close
#38884 and will do the same or comment #36855 and #37596 about the new
feature.
Cheers,
- Brice.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 06 Apr 2021 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 74 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.