unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 46767@debbugs.gnu.org
Subject: bug#46767: /run/booted-system can be removed by ‘guix system delete-generations’
Date: Thu, 25 Feb 2021 11:44:18 +0100	[thread overview]
Message-ID: <87r1l4zat9.fsf@gnu.org> (raw)
In-Reply-To: <878s7c1pzh.fsf@inria.fr> ("Ludovic Courtès"'s message of "Thu, 25 Feb 2021 10:00:34 +0100")

Before rebooting, I had:

--8<---------------cut here---------------start------------->8---
$ ls -l /run/{current,booted}-system 
lrwxrwxrwx 1 root root 33 Nov  2 16:06 /run/booted-system -> /var/guix/profiles/system-68-link
lrwxrwxrwx 1 root root 50 Feb 21 01:34 /run/current-system -> /gnu/store/qq4rz2fprvnsgqhj24v735hhmp189jl8-system
--8<---------------cut here---------------end--------------->8---

After rebooting:

--8<---------------cut here---------------start------------->8---
$ ls -l /run/{current,booted}-system 
lrwxrwxrwx 1 root root 33 Feb 25 10:28 /run/booted-system -> /var/guix/profiles/system-86-link
lrwxrwxrwx 1 root root 33 Feb 25 10:28 /run/current-system -> /var/guix/profiles/system-86-link
--8<---------------cut here---------------end--------------->8---

/run/booted-system is symlinked from /run/current-system in
‘shepherd-boot-gexp’:

--8<---------------cut here---------------start------------->8---
(define (shepherd-boot-gexp config)
  "Return a gexp starting the shepherd service."
  (let ((shepherd (shepherd-configuration-shepherd config))
        (services (shepherd-configuration-services config)))
  #~(begin
      ;; Keep track of the booted system.
      (false-if-exception (delete-file "/run/booted-system"))
      (symlink (readlink "/run/current-system")
               "/run/booted-system")
      …)))
--8<---------------cut here---------------end--------------->8---

So the solution is to make sure /run/current-system always points to the
store item rather than to the /var/guix symlink in the first place.

/run/current-system is created from (gnu build activation).  When
reconfiguring or deploying, the symlink points to $GUIX_NEW_SYSTEM,
which is set to the store item in (guix scripts system reconfigure).

But when booting, /run/current-system is symlinked to the ‘--system’
kernel command-line argument, which is /var/guix/….  To address that, we
need to throw a ‘canonicalize-path’ call.

Done in 412e4f081e9cdf38db9859e1548ef2362cde678e.

Ludo’.




      reply	other threads:[~2021-02-25 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  9:00 bug#46767: /run/booted-system can be removed by ‘guix system delete-generations’ Ludovic Courtès
2021-02-25 10:44 ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1l4zat9.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=46767@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).