From unknown Fri Jun 20 07:26:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25100: 'guix system reconfigure' fails when new generation already exists Resent-From: Chris Marusich Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 03 Dec 2016 10:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25100 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 25100@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.148076070911227 (code B ref -1); Sat, 03 Dec 2016 10:26:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Dec 2016 10:25:09 +0000 Received: from localhost ([127.0.0.1]:50886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cD7VE-0002v0-Ph for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cD7VC-0002ud-Na for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD7V6-0001CA-Lg for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:01 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39557) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cD7V6-0001C6-Hl for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cD7V5-0006UI-Cr for bug-guix@gnu.org; Sat, 03 Dec 2016 05:25:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD7V4-0001BU-7r for bug-guix@gnu.org; Sat, 03 Dec 2016 05:24:59 -0500 Received: from mail-pg0-x22c.google.com ([2607:f8b0:400e:c05::22c]:36712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cD7V3-000186-UM for bug-guix@gnu.org; Sat, 03 Dec 2016 05:24:58 -0500 Received: by mail-pg0-x22c.google.com with SMTP id f188so116696981pgc.3 for ; Sat, 03 Dec 2016 02:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version; bh=+eZJ4qtKRluGbT4NjK03lLfUuM6P1T34Bcq9vjFyUSc=; b=FC1hxgHpJzE56CYVLLahNqKdnviTJdXiM5RKqLuW9EvPfBDHUvsybM1H/biwfJu6dr mv3F6ZzAucd6fDC9bzpEWPR1Go/HKOh5vdCi7J3i8YeMRX7x8ZezjOxrest6QwiGPzns 4bTa9eiVkat2TAIKR9+ugNOe4Ap1kU68rU3u0e4nq/bAfUx7aNnTPrE3ft4RmwViWH84 k11liy4rdHYTmILnrLxgiqgDT3P9DbMJ3wCfolhGCD41ek2297h93NQQ57TWFheUINN4 6SA9xfp2UnSnVg4jIOZVKgGPCwjcAId9BFGgoLnwgEhryqj0OpxqK+8XsIG7pdVV3GiM TRtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=+eZJ4qtKRluGbT4NjK03lLfUuM6P1T34Bcq9vjFyUSc=; b=T7EYsR58PiVxvkKKDKYgBMq1zK1l4PYgknb8V/RPMzVz5S7z8mujeX6VkwBA3AyPXI PNi3Of0OIFNikJueMTKgfSwR9aqGC17LSHQcv/eQR5t2E234/hG2pCm6zEdx+Yo3omiR 7F+mgCdNKHWfg8OxJHMBx99U6rM8alYzgn/wHU1s+F08PISSzPMWFJWTCldrdFfoT+B/ c37CvgKOwYXqOwu8w7bzCZfEF4rA+bSdCMS7xIFIYiZbCa6g7zrDEEVJkGs24gHIm5fk v6FkCgVQLDh2vVBOwRi94MFM7mKLMk67UlH3elyxxDY66TMwSS6hiYEHfiyTtd8IrcjZ ZrCw== X-Gm-Message-State: AKaTC03KZRp1iondMAzDQHDqjTThKbyKlCZexAS0ofTE+AfLiaC75zSSL47qyvnT76xSYg== X-Received: by 10.84.143.162 with SMTP id 31mr40966986plz.2.1480760695503; Sat, 03 Dec 2016 02:24:55 -0800 (PST) Received: from garuda ([2601:602:9d80:13d4:4e0f:6eff:fef6:70b9]) by smtp.gmail.com with ESMTPSA id p26sm13930527pgn.11.2016.12.03.02.24.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Dec 2016 02:24:54 -0800 (PST) From: Chris Marusich Date: Sat, 03 Dec 2016 02:24:50 -0800 Message-ID: <874m2lb98t.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, I've noticed that, in GuixSD, if one rolls back the system with 'guix system roll-back' or switches to a previous generation with 'guix system switch-generation', and then one tries to run 'guix system reconfigure', the operation fails because the symlink for the new generation already exists. I expected the operation to succeed and overwrite the existing generation, since that mirrors the behavior of 'guix package'. Specifically, if the current generation is N and generation N+1 exists, then running 'guix system reconfigure' should overwrite generation N+1 with the new system. Currently, it fails to create the symlink. I've attached a patch which modifies the behavior to be what I expected. =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-system-If-the-new-system-generation-already-exists-o.patch Content-Transfer-Encoding: quoted-printable From=20526f78a38dabeb12196a21cebe174f073c217c12 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Fri, 2 Dec 2016 01:52:04 -0800 Subject: [PATCH] system: If the new system generation already exists, overwrite it. * guix/scripts/system.scm (switch-to-system): Create the symlink to the new system generation using the procedure "switch-symlink" instead of "symlin= k". That way, if the link already exists, we update it instead of failing. * doc/guix.texi (Using the Configuration System, Invoking guix system): Document the behavior. =2D-- doc/guix.texi | 16 +++++++++++++++- guix/scripts/system.scm | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3b4ba48..45d8dfe 100644 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -7155,7 +7155,15 @@ modifying or deleting previous generations. Old sys= tem generations get an entry in the GRUB boot menu, allowing you to boot them in case something went wrong with the latest generation. Reassuring, no? The @command{guix system list-generations} command lists the system =2Dgenerations available on disk. +generations available on disk. It is also possible to roll back the +system via the commands @command{guix system roll-back} and +@command{guix system switch-generation}. + +Although the command @command{guix system reconfigure} will not modify +previous generations, must take care when the current generation is not +the latest (e.g., after invoking @command{guix system roll-back}), since +the operation might overwrite a later generation @pxref{Invoking guix +system}. =20 @unnumberedsubsubsec The Programming Interface =20 @@ -12487,6 +12495,12 @@ currently running; if a service is currently runni= ng, it does not attempt to upgrade it since this would not be possible without stopping it first. =20 +This command creates a new generation whose number is one greater than +the current generation (as reported by @command{guix system +list-generations}). If that generation already exists, it will be +overwritten. This behavior mirrors that of @command{guix package} +@pxref{Invoking guix package}. + It also adds a GRUB menu entry for the new OS configuration, and moves entries for older configurations to a submenu---unless @option{--no-grub} is passed. diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index bb373a6..144a7fd 100644 =2D-- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -326,7 +326,7 @@ it atomically, and then run OS's activation script." (let* ((system (derivation->output-path drv)) (number (+ 1 (generation-number profile))) (generation (generation-file-name profile number))) =2D (symlink system generation) + (switch-symlinks generation system) (switch-symlinks profile generation) =20 (format #t (_ "activating system...~%")) =2D-=20 2.10.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYQp1yAAoJEN1AmhXYIkad2x0P/il2O4QmKkBNu1jWtr1/rzQA CDi6kY6yvXxNX53hgOLsrqzmJilTVlPDnarTHDyFRnIKLCwleuaSjinD+GJQF6Dn A7q8RTrskOJzc6cIi5ZrrXVbbHOC5qlTCJ8p3nLE4WBwahuSLVVxfFGpv6AQITri Slm7ZE0CViqM0cPKJGcROscP3Zd7RyqSI0OJ2bD80YBiK3imZeB7Sy8blIFf8QzH kxjEreSyiGz7qoZnAcLd8PC0yQCXCJ+MxdwTJJe5QtAr5djLv9bikvaEsEA4NpTm pEklX6kFT5kXRhnNVtp3arzen+Ah8vGd0wpVqt4k4Gifj/rgI+Q2QZP7p+tzsKig 2D1BkXGRgxzIazPCyScoGC7bWqOx7IPwthfRF62jtWRGAw4iOpFqsg56IZ/vtE5b pqih3W0nK9VOSx2r349ZdtYHJf1ocR1vGdcyXIExL00w7zdYf8LsvKg6J3nXXw2R aRmKb9MwL/U13coglFhB7fwjgW/XlBReJwpkYbqGrATkxLLEfl2Q4OqTNAxhOZHi wM5TAriITPLaCVD82e4XfXW8m9VUJReedBnyJXi3b0X+PB7mmgpxUC5qmvSVoDAo mwENjKVxMghGwS9sdRTTecxhs8xq9dUg4xsD3OOh46IiC29OGguTWWNu+D0LGbhp HCZaPsHCJoI3MJeJBfWf =E8Hk -----END PGP SIGNATURE----- --==-=-=-- From unknown Fri Jun 20 07:26:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Chris Marusich Subject: bug#25100: closed (Re: bug#25100: 'guix system reconfigure' fails when new generation already exists) Message-ID: References: <87a8ca15cz.fsf@gnu.org> <874m2lb98t.fsf@gmail.com> X-Gnu-PR-Message: they-closed 25100 X-Gnu-PR-Package: guix Reply-To: 25100@debbugs.gnu.org Date: Mon, 05 Dec 2016 20:36:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1480970162-8805-1" This is a multi-part message in MIME format... ------------=_1480970162-8805-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #25100: 'guix system reconfigure' fails when new generation already exists which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 25100@debbugs.gnu.org. --=20 25100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D25100 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1480970162-8805-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 25100-done) by debbugs.gnu.org; 5 Dec 2016 20:35:53 +0000 Received: from localhost ([127.0.0.1]:57316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDzzM-0002Hi-Sg for submit@debbugs.gnu.org; Mon, 05 Dec 2016 15:35:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56408) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDzzL-0002HV-4S for 25100-done@debbugs.gnu.org; Mon, 05 Dec 2016 15:35:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDzzC-00064o-PA for 25100-done@debbugs.gnu.org; Mon, 05 Dec 2016 15:35:45 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDzzC-00064k-E5; Mon, 05 Dec 2016 15:35:42 -0500 Received: from reverse-83.fdn.fr ([80.67.176.83]:36392 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cDzzB-0003LA-RR; Mon, 05 Dec 2016 15:35:42 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Chris Marusich Subject: Re: bug#25100: 'guix system reconfigure' fails when new generation already exists References: <874m2lb98t.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 Frimaire an 225 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu Date: Mon, 05 Dec 2016 21:35:40 +0100 In-Reply-To: <874m2lb98t.fsf@gmail.com> (Chris Marusich's message of "Sat, 03 Dec 2016 02:24:50 -0800") Message-ID: <87a8ca15cz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -7.9 (-------) X-Debbugs-Envelope-To: 25100-done Cc: 25100-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.9 (-------) Hi! Chris Marusich skribis: > I've noticed that, in GuixSD, if one rolls back the system with 'guix > system roll-back' or switches to a previous generation with 'guix system > switch-generation', and then one tries to run 'guix system reconfigure', > the operation fails because the symlink for the new generation already > exists. I expected the operation to succeed and overwrite the existing > generation, since that mirrors the behavior of 'guix package'. > > Specifically, if the current generation is N and generation N+1 exists, > then running 'guix system reconfigure' should overwrite generation N+1 > with the new system. Currently, it fails to create the symlink. I've > attached a patch which modifies the behavior to be what I expected. Indeed. > From 526f78a38dabeb12196a21cebe174f073c217c12 Mon Sep 17 00:00:00 2001 > From: Chris Marusich > Date: Fri, 2 Dec 2016 01:52:04 -0800 > Subject: [PATCH] system: If the new system generation already exists, > overwrite it. > > * guix/scripts/system.scm (switch-to-system): Create the symlink to the n= ew > system generation using the procedure "switch-symlink" instead of "syml= ink". > That way, if the link already exists, we update it instead of failing. > > * doc/guix.texi (Using the Configuration System, Invoking guix system): > Document the behavior. [...] > +overwritten. This behavior mirrors that of @command{guix package} > +@pxref{Invoking guix package}. Note: @pxref is for parenthetical expressions (info "(texinfo) pxref"). I adjusted this and the commit log and committed. Thank you! Ludo=E2=80=99. ------------=_1480970162-8805-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 3 Dec 2016 10:25:09 +0000 Received: from localhost ([127.0.0.1]:50886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cD7VE-0002v0-Ph for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cD7VC-0002ud-Na for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD7V6-0001CA-Lg for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:01 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39557) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cD7V6-0001C6-Hl for submit@debbugs.gnu.org; Sat, 03 Dec 2016 05:25:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cD7V5-0006UI-Cr for bug-guix@gnu.org; Sat, 03 Dec 2016 05:25:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD7V4-0001BU-7r for bug-guix@gnu.org; Sat, 03 Dec 2016 05:24:59 -0500 Received: from mail-pg0-x22c.google.com ([2607:f8b0:400e:c05::22c]:36712) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cD7V3-000186-UM for bug-guix@gnu.org; Sat, 03 Dec 2016 05:24:58 -0500 Received: by mail-pg0-x22c.google.com with SMTP id f188so116696981pgc.3 for ; Sat, 03 Dec 2016 02:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version; bh=+eZJ4qtKRluGbT4NjK03lLfUuM6P1T34Bcq9vjFyUSc=; b=FC1hxgHpJzE56CYVLLahNqKdnviTJdXiM5RKqLuW9EvPfBDHUvsybM1H/biwfJu6dr mv3F6ZzAucd6fDC9bzpEWPR1Go/HKOh5vdCi7J3i8YeMRX7x8ZezjOxrest6QwiGPzns 4bTa9eiVkat2TAIKR9+ugNOe4Ap1kU68rU3u0e4nq/bAfUx7aNnTPrE3ft4RmwViWH84 k11liy4rdHYTmILnrLxgiqgDT3P9DbMJ3wCfolhGCD41ek2297h93NQQ57TWFheUINN4 6SA9xfp2UnSnVg4jIOZVKgGPCwjcAId9BFGgoLnwgEhryqj0OpxqK+8XsIG7pdVV3GiM TRtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=+eZJ4qtKRluGbT4NjK03lLfUuM6P1T34Bcq9vjFyUSc=; b=T7EYsR58PiVxvkKKDKYgBMq1zK1l4PYgknb8V/RPMzVz5S7z8mujeX6VkwBA3AyPXI PNi3Of0OIFNikJueMTKgfSwR9aqGC17LSHQcv/eQR5t2E234/hG2pCm6zEdx+Yo3omiR 7F+mgCdNKHWfg8OxJHMBx99U6rM8alYzgn/wHU1s+F08PISSzPMWFJWTCldrdFfoT+B/ c37CvgKOwYXqOwu8w7bzCZfEF4rA+bSdCMS7xIFIYiZbCa6g7zrDEEVJkGs24gHIm5fk v6FkCgVQLDh2vVBOwRi94MFM7mKLMk67UlH3elyxxDY66TMwSS6hiYEHfiyTtd8IrcjZ ZrCw== X-Gm-Message-State: AKaTC03KZRp1iondMAzDQHDqjTThKbyKlCZexAS0ofTE+AfLiaC75zSSL47qyvnT76xSYg== X-Received: by 10.84.143.162 with SMTP id 31mr40966986plz.2.1480760695503; Sat, 03 Dec 2016 02:24:55 -0800 (PST) Received: from garuda ([2601:602:9d80:13d4:4e0f:6eff:fef6:70b9]) by smtp.gmail.com with ESMTPSA id p26sm13930527pgn.11.2016.12.03.02.24.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Dec 2016 02:24:54 -0800 (PST) From: Chris Marusich To: bug-guix@gnu.org Subject: 'guix system reconfigure' fails when new generation already exists Date: Sat, 03 Dec 2016 02:24:50 -0800 Message-ID: <874m2lb98t.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, I've noticed that, in GuixSD, if one rolls back the system with 'guix system roll-back' or switches to a previous generation with 'guix system switch-generation', and then one tries to run 'guix system reconfigure', the operation fails because the symlink for the new generation already exists. I expected the operation to succeed and overwrite the existing generation, since that mirrors the behavior of 'guix package'. Specifically, if the current generation is N and generation N+1 exists, then running 'guix system reconfigure' should overwrite generation N+1 with the new system. Currently, it fails to create the symlink. I've attached a patch which modifies the behavior to be what I expected. =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-system-If-the-new-system-generation-already-exists-o.patch Content-Transfer-Encoding: quoted-printable From=20526f78a38dabeb12196a21cebe174f073c217c12 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Fri, 2 Dec 2016 01:52:04 -0800 Subject: [PATCH] system: If the new system generation already exists, overwrite it. * guix/scripts/system.scm (switch-to-system): Create the symlink to the new system generation using the procedure "switch-symlink" instead of "symlin= k". That way, if the link already exists, we update it instead of failing. * doc/guix.texi (Using the Configuration System, Invoking guix system): Document the behavior. =2D-- doc/guix.texi | 16 +++++++++++++++- guix/scripts/system.scm | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3b4ba48..45d8dfe 100644 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -7155,7 +7155,15 @@ modifying or deleting previous generations. Old sys= tem generations get an entry in the GRUB boot menu, allowing you to boot them in case something went wrong with the latest generation. Reassuring, no? The @command{guix system list-generations} command lists the system =2Dgenerations available on disk. +generations available on disk. It is also possible to roll back the +system via the commands @command{guix system roll-back} and +@command{guix system switch-generation}. + +Although the command @command{guix system reconfigure} will not modify +previous generations, must take care when the current generation is not +the latest (e.g., after invoking @command{guix system roll-back}), since +the operation might overwrite a later generation @pxref{Invoking guix +system}. =20 @unnumberedsubsubsec The Programming Interface =20 @@ -12487,6 +12495,12 @@ currently running; if a service is currently runni= ng, it does not attempt to upgrade it since this would not be possible without stopping it first. =20 +This command creates a new generation whose number is one greater than +the current generation (as reported by @command{guix system +list-generations}). If that generation already exists, it will be +overwritten. This behavior mirrors that of @command{guix package} +@pxref{Invoking guix package}. + It also adds a GRUB menu entry for the new OS configuration, and moves entries for older configurations to a submenu---unless @option{--no-grub} is passed. diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index bb373a6..144a7fd 100644 =2D-- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -326,7 +326,7 @@ it atomically, and then run OS's activation script." (let* ((system (derivation->output-path drv)) (number (+ 1 (generation-number profile))) (generation (generation-file-name profile number))) =2D (symlink system generation) + (switch-symlinks generation system) (switch-symlinks profile generation) =20 (format #t (_ "activating system...~%")) =2D-=20 2.10.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYQp1yAAoJEN1AmhXYIkad2x0P/il2O4QmKkBNu1jWtr1/rzQA CDi6kY6yvXxNX53hgOLsrqzmJilTVlPDnarTHDyFRnIKLCwleuaSjinD+GJQF6Dn A7q8RTrskOJzc6cIi5ZrrXVbbHOC5qlTCJ8p3nLE4WBwahuSLVVxfFGpv6AQITri Slm7ZE0CViqM0cPKJGcROscP3Zd7RyqSI0OJ2bD80YBiK3imZeB7Sy8blIFf8QzH kxjEreSyiGz7qoZnAcLd8PC0yQCXCJ+MxdwTJJe5QtAr5djLv9bikvaEsEA4NpTm pEklX6kFT5kXRhnNVtp3arzen+Ah8vGd0wpVqt4k4Gifj/rgI+Q2QZP7p+tzsKig 2D1BkXGRgxzIazPCyScoGC7bWqOx7IPwthfRF62jtWRGAw4iOpFqsg56IZ/vtE5b pqih3W0nK9VOSx2r349ZdtYHJf1ocR1vGdcyXIExL00w7zdYf8LsvKg6J3nXXw2R aRmKb9MwL/U13coglFhB7fwjgW/XlBReJwpkYbqGrATkxLLEfl2Q4OqTNAxhOZHi wM5TAriITPLaCVD82e4XfXW8m9VUJReedBnyJXi3b0X+PB7mmgpxUC5qmvSVoDAo mwENjKVxMghGwS9sdRTTecxhs8xq9dUg4xsD3OOh46IiC29OGguTWWNu+D0LGbhp HCZaPsHCJoI3MJeJBfWf =E8Hk -----END PGP SIGNATURE----- --==-=-=-- ------------=_1480970162-8805-1--