From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: bug#25100: 'guix system reconfigure' fails when new generation already exists Date: Sat, 03 Dec 2016 02:24:50 -0800 Message-ID: <874m2lb98t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cD7WB-0006cJ-TZ for bug-guix@gnu.org; Sat, 03 Dec 2016 05:26:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD7W6-0001eT-5T for bug-guix@gnu.org; Sat, 03 Dec 2016 05:26:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:35487) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cD7W6-0001eG-28 for bug-guix@gnu.org; Sat, 03 Dec 2016 05:26:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cD7W5-0002wA-QW for bug-guix@gnu.org; Sat, 03 Dec 2016 05:26:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: 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) 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) List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 25100@debbugs.gnu.org --==-=-= 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----- --==-=-=--