aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/shepherd.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-02-25 10:58:20 +0100
committerLudovic Courtès <ludo@gnu.org>2021-02-25 11:29:35 +0100
commit412e4f081e9cdf38db9859e1548ef2362cde678e (patch)
tree5ee802f8aeaf611020697b67ee3229a19022a684 /gnu/services/shepherd.scm
parent120051e1b9358f75b228e97670843095d5fcdf49 (diff)
downloadguix-412e4f081e9cdf38db9859e1548ef2362cde678e.tar
guix-412e4f081e9cdf38db9859e1548ef2362cde678e.tar.gz
services: shepherd: Make /run/booted-system a symlink to the store item.
Fixes <https://bugs.gnu.org/46767>. Previously /run/booted-system would end up referring to /var/guix/profiles/system-NNN-link; consequently, the booted system would not be GC-protected. * gnu/services/shepherd.scm (shepherd-boot-gexp): Call 'canonicalize-path' instead of 'readlink'.
Diffstat (limited to 'gnu/services/shepherd.scm')
-rw-r--r--gnu/services/shepherd.scm6
1 files changed, 5 insertions, 1 deletions
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index e2ec59f5aa..19a052c89b 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -97,7 +97,11 @@
#~(begin
;; Keep track of the booted system.
(false-if-exception (delete-file "/run/booted-system"))
- (symlink (readlink "/run/current-system")
+
+ ;; Make /run/booted-system, an indirect GC root, point to the store item
+ ;; /run/current-system points to. Use 'canonicalize-path' rather than
+ ;; 'readlink' to make sure we get the store item.
+ (symlink (canonicalize-path "/run/current-system")
"/run/booted-system")
;; Close any remaining open file descriptors to be on the safe