[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46767: /run/booted-system can be removed by ‘guix system delete-gene
From: |
Ludovic Courtès |
Subject: |
bug#46767: /run/booted-system can be removed by ‘guix system delete-generations’ |
Date: |
Thu, 25 Feb 2021 11:44:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
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’.