From 412e4f081e9cdf38db9859e1548ef2362cde678e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 25 Feb 2021 10:58:20 +0100 Subject: services: shepherd: Make /run/booted-system a symlink to the store item. Fixes . 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'. --- gnu/services/shepherd.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gnu/services') 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 @@ (define (shepherd-boot-gexp config) #~(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 -- cgit v1.2.3