From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EM8dNb5/N2DIOgAA0tVLHw (envelope-from ) for ; Thu, 25 Feb 2021 10:45:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id AJn5ML5/N2ANNwAAbx9fmQ (envelope-from ) for ; Thu, 25 Feb 2021 10:45:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 57E692344C for ; Thu, 25 Feb 2021 11:45:18 +0100 (CET) Received: from localhost ([::1]:42330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFE8z-0000qB-If for larch@yhetil.org; Thu, 25 Feb 2021 05:45:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFE8k-0000pY-52 for bug-guix@gnu.org; Thu, 25 Feb 2021 05:45:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:53457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lFE8j-0000qW-Ln for bug-guix@gnu.org; Thu, 25 Feb 2021 05:45:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lFE8j-0007hg-K7 for bug-guix@gnu.org; Thu, 25 Feb 2021 05:45:01 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#46767: /run/booted-system can be removed by =?UTF-8?Q?=E2=80=98guix?= system =?UTF-8?Q?delete-generations=E2=80=99?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 25 Feb 2021 10:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46767 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 46767@debbugs.gnu.org Received: via spool by 46767-submit@debbugs.gnu.org id=B46767.161424986729534 (code B ref 46767); Thu, 25 Feb 2021 10:45:01 +0000 Received: (at 46767) by debbugs.gnu.org; 25 Feb 2021 10:44:27 +0000 Received: from localhost ([127.0.0.1]:36767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFE8A-0007gH-LQ for submit@debbugs.gnu.org; Thu, 25 Feb 2021 05:44:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lFE89-0007g6-40 for 46767@debbugs.gnu.org; Thu, 25 Feb 2021 05:44:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52940) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFE83-0000Vn-U6 for 46767@debbugs.gnu.org; Thu, 25 Feb 2021 05:44:19 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=43132 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lFE83-0005Qg-Cj for 46767@debbugs.gnu.org; Thu, 25 Feb 2021 05:44:19 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <878s7c1pzh.fsf@inria.fr> Date: Thu, 25 Feb 2021 11:44:18 +0100 In-Reply-To: <878s7c1pzh.fsf@inria.fr> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 25 Feb 2021 10:00:34 +0100") Message-ID: <87r1l4zat9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.87 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 57E692344C X-Spam-Score: -2.87 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3szsbnsZNfE7 Before rebooting, I had: --8<---------------cut here---------------start------------->8--- $ ls -l /run/{current,booted}-system=20 lrwxrwxrwx 1 root root 33 Nov 2 16:06 /run/booted-system -> /var/guix/prof= iles/system-68-link lrwxrwxrwx 1 root root 50 Feb 21 01:34 /run/current-system -> /gnu/store/qq= 4rz2fprvnsgqhj24v735hhmp189jl8-system --8<---------------cut here---------------end--------------->8--- After rebooting: --8<---------------cut here---------------start------------->8--- $ ls -l /run/{current,booted}-system=20 lrwxrwxrwx 1 root root 33 Feb 25 10:28 /run/booted-system -> /var/guix/prof= iles/system-86-link lrwxrwxrwx 1 root root 33 Feb 25 10:28 /run/current-system -> /var/guix/pro= files/system-86-link --8<---------------cut here---------------end--------------->8--- /run/booted-system is symlinked from /run/current-system in =E2=80=98shepherd-boot-gexp=E2=80=99: --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") =E2=80=A6))) --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 =E2=80=98--system= =E2=80=99 kernel command-line argument, which is /var/guix/=E2=80=A6. To address tha= t, we need to throw a =E2=80=98canonicalize-path=E2=80=99 call. Done in 412e4f081e9cdf38db9859e1548ef2362cde678e. Ludo=E2=80=99.