GNU bug report logs - #46560
[PATCH 0/2] Activate system when switching generations.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Brice Waegeneire <brice@HIDDEN>; Keywords: patch; dated Tue, 16 Feb 2021 13:01:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 46560 <at> debbugs.gnu.org:


Received: (at 46560) by debbugs.gnu.org; 1 Mar 2021 15:56:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 01 10:56:58 2021
Received: from localhost ([127.0.0.1]:50501 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lGkuo-0001QJ-DD
	for submit <at> debbugs.gnu.org; Mon, 01 Mar 2021 10:56:58 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50068)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1lGkum-0001Q7-8N
 for 46560 <at> debbugs.gnu.org; Mon, 01 Mar 2021 10:56:56 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47540)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1lGkuh-0004fr-0h; Mon, 01 Mar 2021 10:56:51 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55392 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1lGkub-0003Zw-Db; Mon, 01 Mar 2021 10:56:47 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Brice Waegeneire <brice@HIDDEN>
Subject: Re: bug#46560: [PATCH 0/2] Activate system when switching generations.
References: <87czx06ubt.fsf@HIDDEN>
 <20210216132235.15811-2-brice@HIDDEN>
Date: Mon, 01 Mar 2021 16:56:44 +0100
In-Reply-To: <20210216132235.15811-2-brice@HIDDEN> (Brice Waegeneire's
 message of "Tue, 16 Feb 2021 14:22:35 +0100")
Message-ID: <87im6arhoj.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 46560
Cc: 46560 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Brice Waegeneire <brice@HIDDEN> skribis:

> Fixes #38884.

Nitpick: =E2=80=9CFixes <https://bugs.gnu.org/38884>.=E2=80=9D

> * 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=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#46560; Package guix-patches. Full text available.

Message received at 46560 <at> debbugs.gnu.org:


Received: (at 46560) by debbugs.gnu.org; 1 Mar 2021 15:55:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 01 10:55:39 2021
Received: from localhost ([127.0.0.1]:50497 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lGktX-0001OR-35
	for submit <at> debbugs.gnu.org; Mon, 01 Mar 2021 10:55:39 -0500
Received: from eggs.gnu.org ([209.51.188.92]:49830)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1lGktV-0001OD-SP
 for 46560 <at> debbugs.gnu.org; Mon, 01 Mar 2021 10:55:38 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47526)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1lGktQ-0003xC-0z; Mon, 01 Mar 2021 10:55:32 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55386 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1lGktP-0002a8-AB; Mon, 01 Mar 2021 10:55:31 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Brice Waegeneire <brice@HIDDEN>
Subject: Re: bug#46560: [PATCH 0/2] Activate system when switching generations.
References: <87czx06ubt.fsf@HIDDEN>
 <20210216132235.15811-1-brice@HIDDEN>
Date: Mon, 01 Mar 2021 16:55:29 +0100
In-Reply-To: <20210216132235.15811-1-brice@HIDDEN> (Brice Waegeneire's
 message of "Tue, 16 Feb 2021 14:22:34 +0100")
Message-ID: <87mtvmrhqm.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 46560
Cc: 46560 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi,

Brice Waegeneire <brice@HIDDEN> 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@HIDDEN:
bug#46560; Package guix-patches. Full text available.

Message received at 46560 <at> debbugs.gnu.org:


Received: (at 46560) by debbugs.gnu.org; 16 Feb 2021 13:22:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 16 08:22:51 2021
Received: from localhost ([127.0.0.1]:39823 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lC0JX-00052U-8x
	for submit <at> debbugs.gnu.org; Tue, 16 Feb 2021 08:22:51 -0500
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:47919)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brice@HIDDEN>) id 1lC0JT-000522-M7
 for 46560 <at> debbugs.gnu.org; Tue, 16 Feb 2021 08:22:48 -0500
X-Originating-IP: 31.170.9.129
Received: from localhost (reverse4.evolix.net [31.170.9.129])
 (Authenticated sender: brice@HIDDEN)
 by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 24D6DC0009
 for <46560 <at> debbugs.gnu.org>; Tue, 16 Feb 2021 13:22:40 +0000 (UTC)
From: Brice Waegeneire <brice@HIDDEN>
To: 46560 <at> debbugs.gnu.org
Subject: [PATCH 2/2] scripts: system: Activate system when switching
 generations.
Date: Tue, 16 Feb 2021 14:22:35 +0100
Message-Id: <20210216132235.15811-2-brice@HIDDEN>
X-Mailer: git-send-email 2.30.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 46560
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

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@HIDDEN>
 ;;; Copyright © 2020 Julien Lepiller <julien@HIDDEN>
 ;;; Copyright © 2020 Efraim Flashner <efraim@HIDDEN>
+;;; Copyright © 2021 Brice Waegeneire <brice@HIDDEN>
 ;;;
 ;;; 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@HIDDEN:
bug#46560; Package guix-patches. Full text available.

Message received at 46560 <at> debbugs.gnu.org:


Received: (at 46560) by debbugs.gnu.org; 16 Feb 2021 13:22:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 16 08:22:49 2021
Received: from localhost ([127.0.0.1]:39821 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lC0JU-00052L-Vc
	for submit <at> debbugs.gnu.org; Tue, 16 Feb 2021 08:22:49 -0500
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50381)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brice@HIDDEN>) id 1lC0JS-00051z-Gy
 for 46560 <at> debbugs.gnu.org; Tue, 16 Feb 2021 08:22:47 -0500
X-Originating-IP: 31.170.9.129
Received: from localhost (reverse4.evolix.net [31.170.9.129])
 (Authenticated sender: brice@HIDDEN)
 by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id BCFDEFF80D
 for <46560 <at> debbugs.gnu.org>; Tue, 16 Feb 2021 13:22:39 +0000 (UTC)
From: Brice Waegeneire <brice@HIDDEN>
To: 46560 <at> debbugs.gnu.org
Subject: [PATCH 1/2] gnu: services: Add activate script to the profile system
 directory.
Date: Tue, 16 Feb 2021 14:22:34 +0100
Message-Id: <20210216132235.15811-1-brice@HIDDEN>
X-Mailer: git-send-email 2.30.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 46560
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* 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@HIDDEN:
bug#46560; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Feb 2021 13:00:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 16 08:00:55 2021
Received: from localhost ([127.0.0.1]:39759 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lBzyI-00013d-Q6
	for submit <at> debbugs.gnu.org; Tue, 16 Feb 2021 08:00:55 -0500
Received: from lists.gnu.org ([209.51.188.17]:42692)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brice@HIDDEN>) id 1lBzyG-00011T-Kc
 for submit <at> debbugs.gnu.org; Tue, 16 Feb 2021 08:00:53 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:35128)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <brice@HIDDEN>) id 1lBzyG-0002Rd-Ag
 for guix-patches@HIDDEN; Tue, 16 Feb 2021 08:00:52 -0500
Received: from relay10.mail.gandi.net ([217.70.178.230]:37045)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <brice@HIDDEN>) id 1lBzyD-0000HQ-Ia
 for guix-patches@HIDDEN; Tue, 16 Feb 2021 08:00:51 -0500
Received: from localhost (reverse4.evolix.net [31.170.9.129])
 (Authenticated sender: brice@HIDDEN)
 by relay10.mail.gandi.net (Postfix) with ESMTPSA id 55E5C240017
 for <guix-patches@HIDDEN>; Tue, 16 Feb 2021 13:00:42 +0000 (UTC)
From: Brice Waegeneire <brice@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 0/2] Activate system when switching generations.
Date: Tue, 16 Feb 2021 13:35:46 +0100
Message-ID: <87czx06ubt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=217.70.178.230; envelope-from=brice@HIDDEN;
 helo=relay10.mail.gandi.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

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





Acknowledgement sent to Brice Waegeneire <brice@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#46560; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 1 Mar 2021 16:00:02 UTC

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