From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Implementing guix system rollback / switch-generation Date: Thu, 09 Jun 2016 00:19:13 -0700 Message-ID: <877fdyesni.fsf@gmail.com> References: <87wpm3qngd.fsf@gmail.com> <87a8iy68lm.fsf@gnu.org> 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]:47179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAuFR-0006OH-El for guix-devel@gnu.org; Thu, 09 Jun 2016 03:19:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAuFL-0007Yt-L8 for guix-devel@gnu.org; Thu, 09 Jun 2016 03:19:24 -0400 In-Reply-To: <87a8iy68lm.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 06 Jun 2016 10:10:29 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) writes: > The problem with system rollback, as you=E2=80=99ve seen, is that we lack > information about the old system, such as what its activation script is > and what its Shepherd services are. > > We could add the activation script=E2=80=99s file name to the =E2=80=98pa= rameters=E2=80=99 file > that you see in the result of =E2=80=98guix system build foo.scm=E2=80=99= . But it would > be hard to add a forward-compatible yet complete description of the > Shepherd services there. That makes sense. I can't think of a better way to get the information without access to the original operating system configuration file. > ISTR that GRUB has a mechanism to record the last selected menu entry > and to use that as the next default entry. > > Now, it=E2=80=99s not always what one would want to do. > > However, =E2=80=98guix system roll-back/switch-generation=E2=80=99 could = generate a > grub.cfg where the default menu entry points to whatever old generation > has been selected. Thank you for letting me know about that GRUB feature. I didn't know about it; I'll look into it more. In any case, I do expect that a roll-back/switch-generation command would modify the default GRUB menu entry, since "guix system reconfigure" does the same. > It=E2=80=99s not possible to obtain past grub.cfg files, but that=E2=80= =99s not a > problem: we can always regenerate a new grub.cfg. I'm curious: is there a reason why /boot is not itself just another symlink? It might be nice if instead of overwriting the grub.cfg file, we could just flip a symlink when rolling back. > What seems more difficult to me is Shepherd services. Maybe we could > store in the system output (result of =E2=80=98guix system build=E2=80=99= ) an sexp > representation of (part of) our records: > > (shepherd-service > (provisions (x y z)) > (requirements (a b c)) > (start-script "/gnu/store/=E2=80=A6-start-foo.scm") > (stop-script "/gnu/store/=E2=80=A6-stop-foo.scm") > =E2=80=A6) > > Then =E2=80=98upgrade-shepherd-services=E2=80=99 could start from this si= mplified > representation instead of using the full-blown > objects, and thus could work both when instantiating a new generation > and when rolling back. Yes, without access to the original operating system configuration file, something like this seems like the best (or only?) way. >> More generally, are people satisfied with the way system rollback is >> currently implemented in GuixSD? > > Personally I=E2=80=99m not fully satisfied, but it=E2=80=99s true that it= covers my main > use case, which is to recover from a broken update. > > I had never thought about live =E2=80=9Cdowngrade=E2=80=9D of services wh= en rolling > back, because the only times where I=E2=80=99ve wanted to roll back is ri= ght > after booting (or trying to boot ;-)) into a new system generation. I think the current rollback mechanism is very usable if you just need to roll back a small number of machines, and you have a way to manually select the GRUB menu entries. However, I'm not sure it would be easy to roll back many machines remotely, so it would be nice if it were easier. >> Do you think that the mechanism I'm proposing is a bad idea? I'd hate >> to try to implement something that nobody else thinks is needed. > > I think having basic delete-generations, switch-generations, and > roll-back sub-commands would be definitely welcome. > > As a first step, switch-generations/roll-back commands could simply > update the symlinks and regenerate grub.cfg. > > Milestone #2 would be running the previous system=E2=80=99s activation sc= ript, > which installs /run/current-system and adjust the set of users and > groups. > > Milestone #3 would be live service downgrade, as you describe. > > Thoughts? I think breaking it down like that makes a lot of sense. I'll give milestone #1 a shot: make switch-generations/roll-back commands that just update the symlinks and regenerate grub.cfg. Thank you for the input! =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXWRhzAAoJEN1AmhXYIkadEYIP/2K0TBoIUlDnq8bI2HlKq3QV 9MzgQ6n3bw5OcAmdQx2aMc24/P+OdVLo68QoJGOXZhyZvnSLoxrUOEVjOBuUo6wW h1Hpoo9DX96km2W2ICOFMIa48TziMLAZ7tEVQA7LrD/UT1BrockUBrt7uMEk0cLv rtEI3Xe+yAv94g/f/GuQdR87y5EHKf2mjmepN/WYQ9pptbdfVnqfMMG0LSfENuYp 150jqLIgXKtB8TJxxpxbxMSEezBie5NQrhil802jsxtuUPxDqvT38E5qcNJlauZP apULcX6f6jUviAsUCrZ2IYVkaVfYvfZHaWitW+Mwn493kTlpmk1w7Sa1LhHQKqM5 qV2hu59H11fdAZecGH6wVaYiTBLZ8bOh+hTm/WC3bL3eLkjMaprjPVz2e6o9dO8h GBWGHdpqz0LiTMm342IuhDd1UoTFsyB8wEHCOtoowORwUeP7gj6mycjnrGdQ/4/i OUW9Y3zgFvCOBhzE205SNYu6DE7L5dxjhWjq+SH9ZCz4rtuAov6YXOs3nIXoRIQL 9UwxgCv98fxsDfIx0kvdF4MAq17sjFxz7Tek7vrYaeEszsK9UnN0gQxpGFfJ8S4N pfnLyH6yaO12qZ8t1GBPxTnC32oI0MOn1jmyug8y+Qe+3bOnXpmHis+Lhm7mXBEz l4tXPT+pxeLyHGyR93w9 =nG4t -----END PGP SIGNATURE----- --=-=-=--