From unknown Sat Sep 06 09:43:53 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#75027 <75027@debbugs.gnu.org> To: bug#75027 <75027@debbugs.gnu.org> Subject: Status: [PATCH 0/3] 'guix system reconfigure' loads system for kexec reboot Reply-To: bug#75027 <75027@debbugs.gnu.org> Date: Sat, 06 Sep 2025 16:43:53 +0000 retitle 75027 [PATCH 0/3] 'guix system reconfigure' loads system for kexec = reboot reassign 75027 guix-patches submitter 75027 Ludovic Court=C3=A8s severity 75027 normal tag 75027 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 22 10:56:45 2024 Received: (at submit) by debbugs.gnu.org; 22 Dec 2024 15:56:45 +0000 Received: from localhost ([127.0.0.1]:51532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOJx-0003KI-15 for submit@debbugs.gnu.org; Sun, 22 Dec 2024 10:56:45 -0500 Received: from lists.gnu.org ([209.51.188.17]:49240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOJu-0003KA-MV for submit@debbugs.gnu.org; Sun, 22 Dec 2024 10:56:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOJu-0004fw-CN for guix-patches@gnu.org; Sun, 22 Dec 2024 10:56:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOJu-0007pX-0i; Sun, 22 Dec 2024 10:56:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=XC1MeoS4OOTsazAZ7x3EKc3rCjgc2+EB+pLoarh3YFA=; b=HgjAKtcYNHIwD7 +rkvx6q5nMhZmve5EX7qi7zI8S2MCCnTFMzFgcrL26Fa9JPzk8+9sOTdAMp379qxeqLoN+Tq1w99a m4Fu2k2TjJegzAdFAivcAc5Xs91M6QfU9OTlbdW1sfFfy3VLAT/lu/fu1P1MtDgpZcpVXpd9tsjR3 UDf8T6llLiMipVYTbvysYLhXPEDYbHUsoilKqYho5yTslgbxpVk9+90o0hGnccagOMNfBRTkkmmyw QWvXPtApBYd2A9cp+W+WQgsmqT65MimsLIJmWYF2fHfOHujvCVAWChy+F0CM6S6o/Q9y7npnZ9DOj wnzbrCW+zuP71Pkx/m1A==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/3] 'guix system reconfigure' loads system for kexec reboot Date: Sun, 22 Dec 2024 16:56:14 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: Jakob Kirsch , =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello Guix, Following work by Jakob Kirsch adding kexec support in the Shepherd (the new ‘reboot -k’ option), here’s the Guix side of it: with these patches, ‘guix system reconfigure’ loads the new system so that one can run ‘reboot -k’ to quickly reboot into it. Thoughts? Ludo’. PS: It took me a while to debug until I realized it was working very well: it’s just that I was booting a kernel with “quiet” on its command line, so I couldn’t see anything. 🤦 Ludovic Courtès (3): syscalls: Add ‘kexec-load-file’. system: Export ‘…-initrd-file’ and ‘…-root-file-system’. reconfigure: Call ‘kexec-load-file’. gnu/system.scm | 4 +- gnu/tests/reconfigure.scm | 77 +++++++++++++++++++++++++++++ guix/build/syscalls.scm | 54 ++++++++++++++++++++ guix/scripts/system/reconfigure.scm | 25 ++++++++++ tests/syscalls.scm | 13 +++++ 5 files changed, 172 insertions(+), 1 deletion(-) base-commit: 9f53e10235cced7a85697481c859829742b9912c -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 22 10:58:02 2024 Received: (at 75027) by debbugs.gnu.org; 22 Dec 2024 15:58:02 +0000 Received: from localhost ([127.0.0.1]:51542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOLB-0003Mg-H9 for submit@debbugs.gnu.org; Sun, 22 Dec 2024 10:58:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOL9-0003MS-BE for 75027@debbugs.gnu.org; Sun, 22 Dec 2024 10:57:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOL3-000810-8O; Sun, 22 Dec 2024 10:57:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=8dB9aneqq2u0HbdQgTXXCSFROg4vcrZsHF/IjkWDlVI=; b=qc8j6eM2KkQnxZoDDVwR td1i7NMf35t+3T/Sil0wbHC/6908t0gyq0FF/OrdW5GqRZAREwa1hymZ2uMehEdvZmpsemCMU2oGb 969Ujmciv3sDEjTZzDOTDtAFntJvYhJpIHy6akqUecQJQFsbAZ+2UEw42OD8GHUUmg5r4KbFpYYbA +z4MaSDvqPYiwsNI1Z+33YtaeCmM1YF3501AId3+APNiBRm+TsvtqPfkK2fRW1j218s4hiQwcTWM7 bSHBftiXqQWPqOPHspdMgpPDMhMBUTwy/yQJhp2wWI6T/0FF1w6HwRzXlQwWF475JzzsECKh84mQk c+CtmWsow1EctA==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH 1/3] =?UTF-8?q?syscalls:=20Add=20=E2=80=98kexec-load-file?= =?UTF-8?q?=E2=80=99.?= Date: Sun, 22 Dec 2024 16:57:41 +0100 Message-ID: <29936b7f16e53ab11b958ceea04376dfa5b32d69.1734882676.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/syscalls.scm (string->utf-8/nul-terminated) (kexec-load-file): New procedures. * tests/syscalls.scm ("kexec-load-file"): New test. Change-Id: I3724226a14ecc07f346e77519fb5b0591096c7f6 --- guix/build/syscalls.scm | 54 +++++++++++++++++++++++++++++++++++++++++ tests/syscalls.scm | 13 ++++++++++ 2 files changed, 67 insertions(+) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 2c20edf058..f8c9937f54 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -146,6 +146,12 @@ (define-module (guix build syscalls) clone setns + kexec-load-file + KEXEC_FILE_UNLOAD + KEXEC_FILE_ON_CRASH + KEXEC_FILE_NO_INITRAMFS + KEXEC_FILE_DEBUG + PF_PACKET AF_PACKET all-network-interface-names @@ -765,6 +771,54 @@ (define-as-needed load-linux-module (list (strerror err)) (list err))))))) +(define (string->utf-8/nul-terminated str) + "Serialize STR to UTF-8; return the resulting bytevector, including +terminating nul character." + (let* ((source (string->utf8 str)) + (bv (make-bytevector (+ (bytevector-length source) 1) 0))) + (bytevector-copy! source 0 bv 0 (bytevector-length source)) + bv)) + +;; Constants from . +(define KEXEC_FILE_UNLOAD #x00000001) +(define KEXEC_FILE_ON_CRASH #x00000002) +(define KEXEC_FILE_NO_INITRAMFS #x00000004) +(define KEXEC_FILE_DEBUG #x00000008) + +(define kexec-load-file + (let* ((proc (syscall->procedure int "syscall" + (list long ;sysno + int ;kernel fd + int ;initrd fd + unsigned-long ;cmdline length + '* ;cmdline + unsigned-long))) ;flags + ;; TODO: Don't do this. + (syscall-id (match (utsname:machine (uname)) + ("i686" 320) + ("x86_64" 320) + ("armv7l" 401) + ("aarch64" 401) + ;; XXX: There's apparently no support for ppc64le and + ;; riscv64. + (_ #f)))) + (lambda* (kernel-fd initrd-fd command-line #:optional (flags 0)) + "Load for eventual use of kexec(8) the Linux kernel from +@var{kernel-fd}, its initial RAM disk from @var{initrd-fd}, with the given +@var{command-line} (a string). Optionally, @var{flags} can be a bitwise or of +the KEXEC_FILE_* constants." + (let*-values (((command-line) + (string->utf-8/nul-terminated command-line)) + ((ret err) + (proc syscall-id kernel-fd initrd-fd + (bytevector-length command-line) + (bytevector->pointer command-line) + flags))) + (when (= ret -1) + (throw 'system-error "kexec-load-file" "~A" + (list (strerror err)) + (list err))))))) + (define (linux-process-flags pid) ;copied from the Shepherd "Return the process flags of @var{pid} (or'd @code{PF_} constants), assuming the Linux /proc file system is mounted; raise a @code{system-error} exception diff --git a/tests/syscalls.scm b/tests/syscalls.scm index 13f4f11721..eef864d097 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -679,6 +679,19 @@ (define perform-container-tests? (lambda args (system-error-errno args)))))) +(when (or (zero? (getuid)) + (not (string-contains %host-type "linux"))) + (test-skip 1)) +(test-equal "kexec-load-file" + EPERM + (catch 'system-error + (lambda () + (let ((fd1 (open-fdes "/dev/null" O_RDONLY)) + (fd2 (open-fdes "/dev/null" O_RDONLY))) + (kexec-load-file fd1 fd2 "gnu.repl=yes"))) + (lambda args + (system-error-errno args)))) + (test-end) (false-if-exception (delete-file temp-file)) -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 22 10:58:37 2024 Received: (at 75027) by debbugs.gnu.org; 22 Dec 2024 15:58:37 +0000 Received: from localhost ([127.0.0.1]:51549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOLl-0003O8-2p for submit@debbugs.gnu.org; Sun, 22 Dec 2024 10:58:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOLh-0003No-Mc for 75027@debbugs.gnu.org; Sun, 22 Dec 2024 10:58:34 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOLc-00083y-GX; Sun, 22 Dec 2024 10:58:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=cisu7ns1f7jpnrR7jTzZ01510rl8tFezZ0SwIPIt92I=; b=bQbFVqqaynwrjhCvcMMm t1jvC03a/qV8MkIOSx3DzbIvgoR411/YGvUIrxoJdTM25UZqD4RQ9FOJyn91R9ahoQAzqFcvVcv4c pJQHhjwWlVUqx90QXrroEGDAy0FDaiFPrCjeCAPDJ4KAWkenGK1dSY/apN4/mMCUsS2vPKy6wPTtW 4t3qVkWz+z80mEjBc86UK5+bUCMulJhVItWyQcWZkBcOnzPnrtPBaoNd9bgfquV7tDjj8l27PQ3C6 +N44wuZTPNEkH95g7OL5SD51v+Bf3AJjV3aSW5Y1cBYf2NJBdmkHeD+3bqulrolLUM1Ap6sxi0HMO TEEXHtx29RxmQw==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH 2/3] =?UTF-8?q?system:=20Export=20=E2=80=98=E2=80=A6-initr?= =?UTF-8?q?d-file=E2=80=99=20and=20=E2=80=98=E2=80=A6-root-file-system?= =?UTF-8?q?=E2=80=99.?= Date: Sun, 22 Dec 2024 16:57:42 +0100 Message-ID: <61da12886b789ae6600b5a52d3b8af7b953a5c39.1734882676.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/system.scm (operating-system-initrd-file): Fix docstring and export. (operating-system-root-file-system): Export. Change-Id: I5254d82ce547e8014027ed20675b8bfe5a5847c5 --- gnu/system.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/system.scm b/gnu/system.scm index dfcb8fb279..252a26cac3 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -110,6 +110,7 @@ (define-module (gnu system) operating-system-default-label operating-system-initrd-modules operating-system-initrd + operating-system-initrd-file operating-system-users operating-system-groups operating-system-issue @@ -119,6 +120,7 @@ (define-module (gnu system) operating-system-locale-libcs operating-system-mapped-devices operating-system-file-systems + operating-system-root-file-system operating-system-store-file-system operating-system-user-mapped-devices operating-system-boot-mapped-devices @@ -1355,7 +1357,7 @@ (define (operating-system-root-file-system os) (location (operating-system-location os))))))) (define (operating-system-initrd-file os) - "Return a gexp denoting the initrd file of OS." + "Return a file-like object for the initrd file of OS." (define boot-file-systems (filter file-system-needed-for-boot? (operating-system-file-systems os))) -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 22 10:58:41 2024 Received: (at 75027) by debbugs.gnu.org; 22 Dec 2024 15:58:41 +0000 Received: from localhost ([127.0.0.1]:51551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOLo-0003OJ-Oq for submit@debbugs.gnu.org; Sun, 22 Dec 2024 10:58:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPOLi-0003Nq-VG for 75027@debbugs.gnu.org; Sun, 22 Dec 2024 10:58:35 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPOLd-000845-P5; Sun, 22 Dec 2024 10:58:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=LKEHxvuQ4/obm7hdWg9CpLpWf4kF865pu5Qjm8+YguM=; b=Xl+y+3hO3xUOeafM8HIz a8+5GQ/bXdaNJPzCcwrurrXGLlKHdp8ZxW53YHbal8k8By/21nAiEp3/e+SfCsaX7yghrFEGtn2aI c1WJK4h8XPHBTcyz4kYHTVGu+1WQ9k7ymDzUyTJFhkj5KHpBGYS/3e9NvyTJevfAAUOHLtstXfha4 YsI3aO8CidoqpWmOe/Dl6LoTtF/VEmmczNaQsPU5o0IRK4wie3ayEVvCSCEppUbzfyu4HkHDQeAum lN5bSfWSKyhZ8f85Q9jvw+AmnJIf6qPhcvoHlU+arBFm4IFa3FsIQoMo8KrK8o6FFqkIRQTKVtwXr 8saW8oMBZCxPHw==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH 3/3] =?UTF-8?q?reconfigure:=20Call=20=E2=80=98kexec-load-f?= =?UTF-8?q?ile=E2=80=99.?= Date: Sun, 22 Dec 2024 16:57:43 +0100 Message-ID: <137b2d758c517c45aaa71e9555076df6ab7dd477.1734882676.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This allows rebooting straight into the new system with ‘reboot -k’. * guix/scripts/system/reconfigure.scm (kexec-loading-program): New procedure. (upgrade-shepherd-services): Use it. * gnu/tests/reconfigure.scm (run-kexec-test): New procedure. (%test-upgrade-kexec): New variable. Change-Id: I86d11f1c348e4359bc9e73c86e5aebff60fe875c --- gnu/tests/reconfigure.scm | 77 +++++++++++++++++++++++++++++ guix/scripts/system/reconfigure.scm | 25 ++++++++++ 2 files changed, 102 insertions(+) diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm index bcc7645fa3..8d33bdac9b 100644 --- a/gnu/tests/reconfigure.scm +++ b/gnu/tests/reconfigure.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,9 +19,12 @@ (define-module (gnu tests reconfigure) #:use-module (gnu bootloader) + #:use-module (gnu services) + #:use-module (gnu services base) #:use-module (gnu services shepherd) #:use-module (gnu system) #:use-module (gnu system accounts) + #:use-module (gnu system file-systems) #:use-module (gnu system shadow) #:use-module (gnu system vm) #:use-module (gnu tests) @@ -31,6 +35,7 @@ (define-module (gnu tests reconfigure) #:use-module (guix store) #:export (%test-switch-to-system %test-upgrade-services + %test-upgrade-kexec %test-install-bootloader)) ;;; Commentary: @@ -178,6 +183,72 @@ (define* (run-upgrade-services-test) (disable (upgrade-services-program '() '() '(dummy) '()))) (test enable disable)))) +(define* (run-kexec-test) + (define os + (marionette-operating-system + (operating-system + (inherit %simple-os) + (services (modify-services %base-services + (syslog-service-type + config => (syslog-configuration + (inherit config) + (config-file + (plain-file + "syslog.conf" + "*.* /dev/console\n"))))))) + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define new-os + (marionette-operating-system + (virtualized-operating-system ;run as with "guix system vm" + (operating-system + (inherit %simple-os) + (host-name "the-new-os") + (kernel-arguments '("console=ttyS0"))) ;be verbose + #:volatile? #t) ;mount root read-only + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define vm (virtual-machine os)) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + + (define marionette + (make-marionette (list #$vm))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "kexec") + + (test-equal "host name" + #$(operating-system-host-name os) + (marionette-eval '(gethostname) marionette)) + + (test-assert "kexec-loading-program" + (marionette-eval + '(primitive-load #$(kexec-loading-program new-os)) + marionette)) + + (test-assert "reboot/kexec" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (with-shepherd-action 'root ('kexec) result + (pk 'reboot-kexec result))) + marionette)) + + (test-equal "host name of new OS" + #$(operating-system-host-name new-os) + (marionette-eval '(gethostname) marionette)) + + (test-end)))) + + (gexp->derivation "kexec-test" test)) + (define* (run-install-bootloader-test) "Run a test of an OS running INSTALL-BOOTLOADER-PROGRAM, which installs a bootloader's configuration file." @@ -268,6 +339,12 @@ (define %test-upgrade-services loading new services.") (value (run-upgrade-services-test)))) +(define %test-upgrade-kexec + (system-test + (name "upgrade-kexec") + (description "FIXME") + (value (run-kexec-test)))) + (define %test-install-bootloader (system-test (name "install-bootloader") diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm index ddb561d28c..9e08179613 100644 --- a/guix/scripts/system/reconfigure.scm +++ b/guix/scripts/system/reconfigure.scm @@ -31,6 +31,7 @@ (define-module (guix scripts system reconfigure) #:use-module (gnu services herd) #:use-module (gnu services shepherd) #:use-module (gnu system) + #:autoload (gnu system file-systems) (file-system-device) #:use-module (guix gexp) #:use-module (guix modules) #:use-module (guix monads) @@ -51,6 +52,7 @@ (define-module (guix scripts system reconfigure) upgrade-services-program upgrade-shepherd-services + kexec-loading-program install-bootloader-program install-bootloader @@ -176,6 +178,27 @@ (define (upgrade-services-program service-files to-start to-unload to-restart) (for-each unload-service '#$to-unload) (for-each start-service '#$to-start))))) +(define (kexec-loading-program os) + "Return a program that calls 'kexec_file_load' to allow rebooting into OS +via 'kexec'." + (let ((root-device (file-system-device + (operating-system-root-file-system os)))) + (program-file + "kexec-load-system.scm" + (with-imported-modules '((guix build syscalls)) + #~(begin + (use-modules (guix build syscalls)) + + (let ((kernel (open-fdes #$(operating-system-kernel-file os) + O_RDONLY)) + (initrd (open-fdes #$(operating-system-initrd-file os) + O_RDONLY))) + (kexec-load-file kernel initrd + (string-join + (list #$@(operating-system-kernel-arguments + os root-device))) + KEXEC_FILE_DEBUG))))))) + (define* (upgrade-shepherd-services eval os) "Using EVAL, a monadic procedure taking a single G-Expression as an argument, upgrade the Shepherd (PID 1) by unloading obsolete services and loading new @@ -200,6 +223,8 @@ (define* (upgrade-shepherd-services eval os) running)) (service-files (map shepherd-service-file target-services))) (eval #~(parameterize ((current-warning-port (%make-void-port "w"))) + (when (string-contains %host-type "-linux") + (primitive-load #$(kexec-loading-program os))) (primitive-load #$(upgrade-services-program service-files to-start to-unload -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 22 16:48:10 2024 Received: (at 75027) by debbugs.gnu.org; 22 Dec 2024 21:48:10 +0000 Received: from localhost ([127.0.0.1]:52245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPTo2-0003Mx-2v for submit@debbugs.gnu.org; Sun, 22 Dec 2024 16:48:10 -0500 Received: from mout.web.de ([212.227.15.3]:34709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPTo0-0003Mi-FZ for 75027@debbugs.gnu.org; Sun, 22 Dec 2024 16:48:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1734904082; x=1735508882; i=jakob.kirsch@web.de; bh=8SjG0TfjNGlldAxanCcwC4rFwZOy57zR9L2P5Ql6xzo=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=aqBl2RppihZ2Tp4013xnYaZ/kKNCZAX2Qp7bO7J1ZHrDGZ9nGsfnRB9WZbSBwvM/ QvGupxwYOIF7ev2JUt0GZtnEKVadx6oFUNhfH00nkQXP0oCpNMMAiSLxNDjPLNp1A cEW3WMN3FwLbtmcHSARPRJUdkOXJASPekT1TtdJeykkuQb1ifL/iOsHxegHjVhDW8 hPnwZEECqhdR8T+60W6iqHhkbVXtDaK+L1sTAPytKqT3nmuXKCL7vy5+rPkqEjQp/ A1UydBo2xXpxrabbLJ/4JNXF/pQtmRYCMQyt6vg3Ksg6sc1/aEG7gvKWC+rVTYoVK jKkRC4Y48JwhTpYvkA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from kernelpanicroom ([134.19.20.169]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M3m59-1tQJ182e1r-007sex; Sun, 22 Dec 2024 22:48:02 +0100 Date: Sun, 22 Dec 2024 22:47:54 +0100 From: Jakob Kirsch To: Ludovic =?iso-8859-1?Q?Court=E8s?= Subject: Re: [PATCH 0/3] 'guix system reconfigure' loads system for kexec reboot Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:Vj+PBMnACK8i+22tu7eUhaXQrtEWRh4mFzItLZ3ys/IUCp0jllR i7+1gBQezdOe58zQqAyBJWdd7Pb4iKZoe4BdlqawDk4w/qs9L6Wgo+XDJ1+k/NCh/Ggmqgp uFGmlgZN8rDy41ufaFiP/enUMS0Fhge1cTPOQRC0vrIjvsV3MFHL6AVwD1FISx4JdQnD4yp 4WjRATp4p46XLJlESQekQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:KIwKMfbCFd0=;A3oQzMoDHDEtjJVJ7DoKq3Hn5gW pR0q4KpytUAY78BmVPbu7zUsotfPsTZt3UEYgVZk1ZKQi10WSRdRRue/yTl2CyWppZJ3ymckb Ql3FCWU2QaaY4rl74JBhN06azilsvF/rnXcUxZu4pP1pk6RYrqcGPYlTxCKFZTkkF87Ac0wXD L31MkfCBgO7ZCWPyKAFuDnRDdaELwt3GVXiLGAgJq2caIc2nG2F7YKJcOv7ELL+b5UYAle0K4 YR43zbfyCBYJYu3+r4BB3rOq9CiYnSCYdXT2qAS82tRJN9VG1QobM2BleNdxYlNIA4KUTaAYg Te7xapKGE/QUBKrraglHYM6BRVW/sYIus5qCqszPEwzU6uVmqv7c3CH0kI6/EdYd67e7bAnk5 Hg7B0rivQJ4GYk0sOzcUlH/1Ioexqr5t2gWrfzbg7+KiVQqtSry+tYMClXmM/AeDaUBGNASyt LLXg/48mnJZ+ZeZ/v8LP+i4GRanaqoeISOQEFxFVqotPX1xBlIhheEUB/AzOddJL5mjRr/qOB 8feL6NrAl/GubFhfoO6zRETIag9hSdVFp/rU6Ka3kpQHO5CQnmIWQshm7gcvCUTCPSN7Gpieu 8s1EhUivTpAS/mDJpNRNb2uCAREk8FSSZ5vDy8Kb5Yq0mdFxRes4acujowimoBdgqhWg5DagO cnS3u+kdyWsTOUOUyfAecSWfCokzlOt2Xu8mb+MwKDb3VF4pIyPERzfKcfa/QdcbHMW0xRHDH 0BQ20zqUhqLm6mOaOwceAhiyTME8nI9LSrtV/lFwT+6fkVqh46LZrb7dWmlLaeWO3Spkfmfj9 Gri8rI6pPjr8L1e2Zzqs17mLYTj5lBZcsAEp+4Bb1B7XiQ7I0DxMI5cMXSbMgC1yfu1RuPY0p Yo1gSnOJHUDaTk9F2oDJ8IJMAK604ZdWLSFAdFYLWiuJ0cWkGgtXiZeFfMccew4oJDB65jww+ u3bkHPDW6vBoIOKV+3jIo6kD5PzS2ToKdp6TojbXVAkSYSapmsfpZ0VodpMxMk/y3XpM04ape TWliSGNRb68jwXF+sHVy2whnqO8NgTrRMYRWMhi7LR6JmdCf4fQDG1hfNdt/4PHj8FPc99EJl HVZCN5Bz0= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Would it be possible to expose the output of kexec-loading-program as a file in the output directory of the operating system (e.g. as /run/current-system/kexec)? From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 23 06:24:45 2024 Received: (at 75027) by debbugs.gnu.org; 23 Dec 2024 11:24:45 +0000 Received: from localhost ([127.0.0.1]:53537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPgYH-0007zr-BH for submit@debbugs.gnu.org; Mon, 23 Dec 2024 06:24:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPgYE-0007zY-6N for 75027@debbugs.gnu.org; Mon, 23 Dec 2024 06:24:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPgW1-0007E5-GA; Mon, 23 Dec 2024 06:22:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=pZsf2az2IR/cprN5FAVA9rmAmN7hPqKoD+hoxfhgJuI=; b=WfLlXRSEdI97iSiaTov5 RsKFgomO9T1J6BsqTtZcaF7mujCvzlRxCT340uZVmUBsjEHPS7JzPiOnxpN2sDrbikwAorjjDQyqN UfU2FZZYT1tDflYqqsfui/9tAI2EGYKne51HykfrIKgahn/8ALBmRWr+i7egr7pjc0tPVJWoTfJix Y+0TSaJD4Woz/xm/ghdiVqooQeuyc0JRu+khJbJEDun2z5YaX05QKLsy58lIed+OTf7ecHN5+St32 hacW70LIkPjA6lcC9GGyklt8ydy0X44ryNZ8nu5u9hnmXz8Uix+lU3NfXyAC2pztmXYduVDW86sL6 Qfz98zF0jZ4WBg==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Jakob Kirsch Subject: Re: [bug#75027] [PATCH 0/3] 'guix system reconfigure' loads system for kexec reboot In-Reply-To: (Jakob Kirsch's message of "Sun, 22 Dec 2024 22:47:54 +0100") References: Date: Mon, 23 Dec 2024 12:22:20 +0100 Message-ID: <87y106ej9v.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Jakob Kirsch skribis: > Would it be possible to expose the output of kexec-loading-program as a f= ile in the output directory of the operating system (e.g. as /run/current-s= ystem/kexec)? Ah yes, that=E2=80=99s a good idea. In addition to or instead of running it by default? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 23 13:25:01 2024 Received: (at 75027) by debbugs.gnu.org; 23 Dec 2024 18:25:01 +0000 Received: from localhost ([127.0.0.1]:56148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPn6y-00036s-VJ for submit@debbugs.gnu.org; Mon, 23 Dec 2024 13:25:01 -0500 Received: from mout.web.de ([217.72.192.78]:38639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPn6w-00036S-1E for 75027@debbugs.gnu.org; Mon, 23 Dec 2024 13:24:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1734978292; x=1735583092; i=jakob.kirsch@web.de; bh=oZgnA+N9Z9XCV94Jd21zmNeY95c2BeanyyE3EXcDdfY=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To: cc:content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=eFUA3Oryuz4dWiiEH9g+qKOFpOYSBybadtqe4u3b0FYogOI98zD9sdpYhQhsHfgs x9wBdoFL1vZDN9WqKDHXdzErLDSlsu8LGrE8nPLRpHtjHiELE7WJaDUsW2ibmPkKn FtLAGcABsGJ7CR+VKlQQIuUfEl6x4IQGyedWeQBwrQGrdPXYRXF9moQwce1dznxqM /EW6n1Es3D9Q0ibsVadN9WrvDnJSCYUOveR2fn6h0o/XQBQMIOvzQmF9dO8jGS1yM 3xOwI7ScrxVho0gl8sMxuFnSVVPUnalnuxrA7AzpgOuRxmEPpg28wQ7sD8o7ToF0A I3wLpUmYRpC+AIKleQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from kernelpanicroom ([134.19.20.169]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MYcpt-1t47LU3WbL-00Vj7W; Mon, 23 Dec 2024 19:24:51 +0100 Date: Mon, 23 Dec 2024 19:24:54 +0100 From: Jakob Kirsch To: Ludovic =?iso-8859-1?Q?Court=E8s?= Subject: Re: [bug#75027] [PATCH 0/3] 'guix system reconfigure' loads system for kexec reboot Message-ID: References: <87y106ej9v.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <87y106ej9v.fsf@gnu.org> X-Provags-ID: V03:K1:DKM+d291yxRdjjyWn+r8tR8SyhMVrMntfaVQE1KNlQJpjrcm1IL ErRXQAxn6/BR1VAYbN4Os6AJc7poqxEOU7DlIDDp0QLntNh/4r4GgiKQOts8D3P/IWehKhy mJsxtCe4T0bOYYoExH5XmTwpErdpHwQrdgT5+ee+cwp+gUknGKoPdiFTBUeo4+CqtLF5u4k tWwZPpZjbH2gHMCfK/V+g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:piD4BrI6Mak=;OhOTOBSo/raSSo7WeeuC9eUB5JQ Xid+9Mh+hSHmAEP+FSTFRM8E56XXb9JZi+iz+LLdQsleWVRiprZwvXAqAXOoc9QXdp0eV3AI1 4a/CGgO5rShS/bFCLX0AvaFo9a5e4qXTKTAmjwxWNXY1lz3EAhTv3yiDjTV9yk5E/V+Z8DiRB OOBdSrgDhK4oNkUw6yEF3G6zEvfndywwBgwQsu0svbX97XiQvjzwBUztBBL3CVQ4t4ETIPdne HPLJH0X6twHvC5czblgae74L05uyRI1zj21hJxX453Ky+2U/qnXbxpeunfLpJ//tIjH3Jj86I vry7mWH7uOE8wYrI5FKwpOyOInU6wkjOtf8fYGkPkGQzChMp3Oa/8VsxCTBnNUz3O2ES/dVm7 zxn4xo5k46T/GB4QH4pPuH0W4FO9aWbtZYf4XLdRDIretwh2t+pS3I8mSsyUPJ5Y4a1lV79g5 0mWj2odOSXv1YEf5Al6XDXkq60jhUXMP2GsuWM/WgWazylfSBA8z2CZmDZJwDgPmP7WB4cKhA IaE2qBIimJEFhEB7HSq/66rn699qzC/b0FN/XUsUCAzxm9Q8fkUzXKC7UmoSnMTXUWfXsgBsZ 15dqTJkR0USMYsYMPRT0croc6salsUmpbMiQdNiL2O+izkH2y0+kqXudplg0VIUDQs7S+dk2F Zhd7By6348dIQOEwIiPXN6RUWGnsr0bDkjokavblNMybZghO8OLAw8GrZ0P5wSbOg4UhbMkSp cZgqO8l40IiGJcnrnBeBaVpWV0Jkq5bQLfCnDiEb9bQVRVyriAkwAsZ9fjgKUMZWXn7q3uUbh WzoNMmQ45A8vKwTIs+o0ZbeQc3Mr/yCWG9DIin6CCj3jAyIA1GYK9L0xY+HrCJJT1KhVw0Ibg 881+E7uAdeGhQd+kSjrA66PV45LQMQS/qLiHRQSH28ZpquA6Bqk3Gq2jjnSGJujZ5ic4BCcwc BVV6D/0DbanHP3SrI00h7upSSw4uRVXLKV9uGmggabG0Dyn1Xf7WBpMTBPS1QotVmIuCWdij3 Iy4THEo+BpFM0l+zDqn4X/UAbf/BKJQG0KI0kOw/KzaJPvNHr4Ri5siqizxa/fh2j2hBAW0kX pjQ4JEPwQ= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Mon, Dec 23, 2024 at 12:22:20PM +0100, Ludovic Court=E8s wrote: > In addition to or instead of running it by default? I would say in addition to but with a flag to not load it (like with "--no= -bootloader" for the bootloader). Btw I've also noticed that the framebuffer is only initialized after somet= hing graphical (gdm in my case) has been started. This usually isn't an is= sue for most users but my disks are encrypted so I can't see the password = prompt but I can still type in my password. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 26 12:21:54 2024 Received: (at 75027) by debbugs.gnu.org; 26 Dec 2024 17:21:54 +0000 Received: from localhost ([127.0.0.1]:42045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYX-0000Ng-L0 for submit@debbugs.gnu.org; Thu, 26 Dec 2024 12:21:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYU-0000NI-H2 for 75027@debbugs.gnu.org; Thu, 26 Dec 2024 12:21:52 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQrYM-0002s4-AL; Thu, 26 Dec 2024 12:21:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=iwyRrXuAmFQHgrOjx/Jhm+Pxlsab0ywvN0qjlCRiGx8=; b=FC+lDeqJ5FaP8/ bY61V+N7lQX3ScJ9kHo6S9Era3f3NZHZWcBl1SKNKwkNsgjcWl7iJ369brt7LB7dccGdw5PwXGTzr 3O+UntxmWM1cm+uYQ3zDjqIz7o1tgZNC24KBGMnmKY5vsV8V+4whLwlfvC8r6yLCsNoYbSO51IuTO Z5/2fZ1pUTbLhynC7scAj0UcnsBpXtkmP7EztqQLVOIWd3qUQF8qBvLVodlupHPKUVFhaXeaRhLlK VpwM3tip2oQko/wDZzkQgYq+UcbLzFuBZyzIqbcpPGBwdWBeJ1bOfadAg8FfCDXB3fyd5U9ZYpBwj T9Ml30mwWN/CXftG1mCA==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH v2 0/3] 'guix system reconfigure' loads system for kexec reboot Date: Thu, 26 Dec 2024 18:21:24 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: Jakob Kirsch , =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Changes compared to v1: • Move kexec code outside of ‘upgrade-shepherd-services’. Now both (guix scripts system) and (gnu machine ssh) have to explicitly call ‘load-system-for-kexec’. • Add ‘--no-kexec’ command-line option for ‘guix system reconfigure’, as Jakob suggested. • Document kexec support under “Invoking guix system”. The one thing I didn’t do is add a “kexec” symlink in the system; as it turns out that’s not easily doable because of the circular dependency: code returned by ‘kexec-loading-program’ needs to refer to the operating system in which it would appear. If we find a way to work around this, maybe we can add this later. Thoughts? Ludo’. Ludovic Courtès (3): syscalls: Add ‘kexec-load-file’. system: Export ‘…-initrd-file’ and ‘…-root-file-system’. reconfigure: Support loading the system for kexec reboot. doc/guix.texi | 11 +++- gnu/machine/ssh.scm | 9 +++- gnu/system.scm | 4 +- gnu/tests/reconfigure.scm | 78 +++++++++++++++++++++++++++++ guix/build/syscalls.scm | 54 ++++++++++++++++++++ guix/scripts/system.scm | 17 ++++++- guix/scripts/system/reconfigure.scm | 31 ++++++++++++ tests/syscalls.scm | 13 +++++ 8 files changed, 213 insertions(+), 4 deletions(-) base-commit: f96c14e3ca6b22e56621cc04a1bf06a8cac6ca23 -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 26 12:21:54 2024 Received: (at 75027) by debbugs.gnu.org; 26 Dec 2024 17:21:55 +0000 Received: from localhost ([127.0.0.1]:42049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYY-0000Nn-B4 for submit@debbugs.gnu.org; Thu, 26 Dec 2024 12:21:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYV-0000NN-MD for 75027@debbugs.gnu.org; Thu, 26 Dec 2024 12:21:52 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQrYQ-0002sZ-G0; Thu, 26 Dec 2024 12:21:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=cisu7ns1f7jpnrR7jTzZ01510rl8tFezZ0SwIPIt92I=; b=Y6aece7KB6y1FWajFllW FF0q4JaLzgwZYedYN0FDfs+wAShNfy9UKG6NArB6LTLBWsXUO2yg6JuktyAgu9J/wEpGLyrx3WLzz GMJPogPxYhRSmQxU75rACetmZJvoBiDWMrPIrAiANuWzkSq0fug+gFXc4drlj9Dnl7sRm1JNW+yfl FE4kxJ2XoOSRn6t9t+JCuzeKjn/RyK8lNOwPgyMxwbwyLMc7R1nbqCQZShcvwf78UEDVylPIJB4CI jp4obCEMUrxT8Xpd6C1xNZi8vZAPW+AQ9P4ky8CG3SlyXaPVmGvajC4Me8EOTec2CyvcwiIuYwWk/ 2/78S6fsDACwTQ==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH v2 2/3] =?UTF-8?q?system:=20Export=20=E2=80=98=E2=80=A6-in?= =?UTF-8?q?itrd-file=E2=80=99=20and=20=E2=80=98=E2=80=A6-root-file-system?= =?UTF-8?q?=E2=80=99.?= Date: Thu, 26 Dec 2024 18:21:26 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/system.scm (operating-system-initrd-file): Fix docstring and export. (operating-system-root-file-system): Export. Change-Id: I5254d82ce547e8014027ed20675b8bfe5a5847c5 --- gnu/system.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/system.scm b/gnu/system.scm index dfcb8fb279..252a26cac3 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -110,6 +110,7 @@ (define-module (gnu system) operating-system-default-label operating-system-initrd-modules operating-system-initrd + operating-system-initrd-file operating-system-users operating-system-groups operating-system-issue @@ -119,6 +120,7 @@ (define-module (gnu system) operating-system-locale-libcs operating-system-mapped-devices operating-system-file-systems + operating-system-root-file-system operating-system-store-file-system operating-system-user-mapped-devices operating-system-boot-mapped-devices @@ -1355,7 +1357,7 @@ (define (operating-system-root-file-system os) (location (operating-system-location os))))))) (define (operating-system-initrd-file os) - "Return a gexp denoting the initrd file of OS." + "Return a file-like object for the initrd file of OS." (define boot-file-systems (filter file-system-needed-for-boot? (operating-system-file-systems os))) -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 26 12:22:04 2024 Received: (at 75027) by debbugs.gnu.org; 26 Dec 2024 17:22:05 +0000 Received: from localhost ([127.0.0.1]:42051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYe-0000OG-VE for submit@debbugs.gnu.org; Thu, 26 Dec 2024 12:22:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYV-0000NJ-AD for 75027@debbugs.gnu.org; Thu, 26 Dec 2024 12:21:53 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQrYO-0002sD-Rl; Thu, 26 Dec 2024 12:21:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=8dB9aneqq2u0HbdQgTXXCSFROg4vcrZsHF/IjkWDlVI=; b=YW0UjndJVg9Ys3man3J/ Mj2yTCgU8ih7C5/7lkhzFpSqR+tCRtJQi1XR/Kq4Yu0jAT9BisiidXUUQn4ezo8VoANCBCVosFgLz /Au8Kg7ficN/bt4r/wiwTbfvZZ7El13Wytu3+CfEk9d29qQk5yAMpsCaupj+5dOdPGSG9g0lYJe9H h78K1HEvS8v9WDbZnjIFGwheE8tXEkYlpIZUFMimA/jQVO2m0qFkvHIBYckPltyQwZoMdBpvx3MY0 yqUv9S6wOkj344O6MS2EsHoQ561ne70dgdVEh+EJffbMVHUL3AjEJ6YqskOAl2qB55PXSOGdokz3C i+IrszAnZA774w==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH v2 1/3] =?UTF-8?q?syscalls:=20Add=20=E2=80=98kexec-load-fi?= =?UTF-8?q?le=E2=80=99.?= Date: Thu, 26 Dec 2024 18:21:25 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/build/syscalls.scm (string->utf-8/nul-terminated) (kexec-load-file): New procedures. * tests/syscalls.scm ("kexec-load-file"): New test. Change-Id: I3724226a14ecc07f346e77519fb5b0591096c7f6 --- guix/build/syscalls.scm | 54 +++++++++++++++++++++++++++++++++++++++++ tests/syscalls.scm | 13 ++++++++++ 2 files changed, 67 insertions(+) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 2c20edf058..f8c9937f54 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -146,6 +146,12 @@ (define-module (guix build syscalls) clone setns + kexec-load-file + KEXEC_FILE_UNLOAD + KEXEC_FILE_ON_CRASH + KEXEC_FILE_NO_INITRAMFS + KEXEC_FILE_DEBUG + PF_PACKET AF_PACKET all-network-interface-names @@ -765,6 +771,54 @@ (define-as-needed load-linux-module (list (strerror err)) (list err))))))) +(define (string->utf-8/nul-terminated str) + "Serialize STR to UTF-8; return the resulting bytevector, including +terminating nul character." + (let* ((source (string->utf8 str)) + (bv (make-bytevector (+ (bytevector-length source) 1) 0))) + (bytevector-copy! source 0 bv 0 (bytevector-length source)) + bv)) + +;; Constants from . +(define KEXEC_FILE_UNLOAD #x00000001) +(define KEXEC_FILE_ON_CRASH #x00000002) +(define KEXEC_FILE_NO_INITRAMFS #x00000004) +(define KEXEC_FILE_DEBUG #x00000008) + +(define kexec-load-file + (let* ((proc (syscall->procedure int "syscall" + (list long ;sysno + int ;kernel fd + int ;initrd fd + unsigned-long ;cmdline length + '* ;cmdline + unsigned-long))) ;flags + ;; TODO: Don't do this. + (syscall-id (match (utsname:machine (uname)) + ("i686" 320) + ("x86_64" 320) + ("armv7l" 401) + ("aarch64" 401) + ;; XXX: There's apparently no support for ppc64le and + ;; riscv64. + (_ #f)))) + (lambda* (kernel-fd initrd-fd command-line #:optional (flags 0)) + "Load for eventual use of kexec(8) the Linux kernel from +@var{kernel-fd}, its initial RAM disk from @var{initrd-fd}, with the given +@var{command-line} (a string). Optionally, @var{flags} can be a bitwise or of +the KEXEC_FILE_* constants." + (let*-values (((command-line) + (string->utf-8/nul-terminated command-line)) + ((ret err) + (proc syscall-id kernel-fd initrd-fd + (bytevector-length command-line) + (bytevector->pointer command-line) + flags))) + (when (= ret -1) + (throw 'system-error "kexec-load-file" "~A" + (list (strerror err)) + (list err))))))) + (define (linux-process-flags pid) ;copied from the Shepherd "Return the process flags of @var{pid} (or'd @code{PF_} constants), assuming the Linux /proc file system is mounted; raise a @code{system-error} exception diff --git a/tests/syscalls.scm b/tests/syscalls.scm index 13f4f11721..eef864d097 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -679,6 +679,19 @@ (define perform-container-tests? (lambda args (system-error-errno args)))))) +(when (or (zero? (getuid)) + (not (string-contains %host-type "linux"))) + (test-skip 1)) +(test-equal "kexec-load-file" + EPERM + (catch 'system-error + (lambda () + (let ((fd1 (open-fdes "/dev/null" O_RDONLY)) + (fd2 (open-fdes "/dev/null" O_RDONLY))) + (kexec-load-file fd1 fd2 "gnu.repl=yes"))) + (lambda args + (system-error-errno args)))) + (test-end) (false-if-exception (delete-file temp-file)) -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 26 12:22:05 2024 Received: (at 75027) by debbugs.gnu.org; 26 Dec 2024 17:22:05 +0000 Received: from localhost ([127.0.0.1]:42057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYi-0000Ou-VN for submit@debbugs.gnu.org; Thu, 26 Dec 2024 12:22:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrYX-0000NP-Rr for 75027@debbugs.gnu.org; Thu, 26 Dec 2024 12:21:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQrYS-0002sv-At; Thu, 26 Dec 2024 12:21:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=/tWSKi0lZ78pv0mBa49SUzvFnysFfR7QOqCUlW91oPI=; b=kZmPNaFvytAL2TxHjRAN xkG8TJ2gtHjYh7uuFT3iqHpSvouPZha8LqmD4T8N+kA1YKPv6LI6BkARpF2tP4g7EGjzPaaDd7Rml 7NTIdbLISAKKLQ1GrtGw7anuHG8yJ9Vhfh/y1FMt3cu6zIt2blOXz5jbfJm1LjkHRYGcF9KvhSlhc u2uEqOcw6UCleBqjj7Hh2b6PBM1d3LuEppyVyjWGLjH/UHh83Vh9VHRFk3BMLpjQRrNhX16Lrb3Ox L4EUgY2GQsKQ8C8I9XcoYbW25P1nqj2OC2s6foPBCMmfSBgjLCvtB+GXpPTwYAExrXd8De/HuZYXM txov5J6u6AUqgQ==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 75027@debbugs.gnu.org Subject: [PATCH v2 3/3] reconfigure: Support loading the system for kexec reboot. Date: Thu, 26 Dec 2024 18:21:27 +0100 Message-ID: <9a41b8595756a8eb9e792236097f175d6f952257.1735233263.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This allows rebooting straight into the new system with ‘reboot -k’. * guix/scripts/system/reconfigure.scm (kexec-loading-program) (load-system-for-kexec): New procedures. * gnu/tests/reconfigure.scm (run-kexec-test): New procedure. (%test-upgrade-kexec): New variable. * guix/scripts/system.scm (perform-action): Add #:load-for-kexec?. Call ‘load-system-for-kexec’. (show-help, %options): Add ‘--no-kexec’. (%default-options): Add ‘load-for-kexec?’. (process-action): Honor it and pass it to ‘perform-action’. * gnu/machine/ssh.scm (deploy-managed-host): Add call to ‘load-system-for-kexec’. * doc/guix.texi (Invoking guix system): Document it. Change-Id: I86d11f1c348e4359bc9e73c86e5aebff60fe875c --- doc/guix.texi | 11 +++- gnu/machine/ssh.scm | 9 +++- gnu/tests/reconfigure.scm | 78 +++++++++++++++++++++++++++++ guix/scripts/system.scm | 17 ++++++- guix/scripts/system/reconfigure.scm | 31 ++++++++++++ 5 files changed, 143 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index da4d2f5ebc..7bf14a49e9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -43599,11 +43599,20 @@ Invoking guix system overwritten. This behavior mirrors that of @command{guix package} (@pxref{Invoking guix package}). -It also adds a bootloader menu entry for the new OS configuration, +It adds a bootloader menu entry for the new OS configuration, ---unless @option{--no-bootloader} is passed. For GRUB, it moves entries for older configurations to a submenu, allowing you to choose an older system generation at boot time should you need it. +@cindex kexec, for fast reboots +@cindex rebooting @i{via} Linux kexec +On Linux, @command{guix system reconfigure} also loads the new system +for fast reboot @i{via} kexec: running @command{reboot --kexec} will +boot the new system by directly executing its kernel, thus bypassing the +BIOS initialization phase and bootloader (@pxref{Invoking reboot,,, +shepherd, The GNU Shepherd Manual}). You can avoid this behavior by +passing the @option{--no-kexec} option. + @cindex provenance tracking, of the operating system Upon completion, the new system is deployed under @file{/run/current-system}. This directory contains @dfn{provenance diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 3e10d984e7..f58fcdaf4a 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Jakob L. Kreuze -;;; Copyright © 2020-2023 Ludovic Courtès +;;; Copyright © 2020-2024 Ludovic Courtès ;;; Copyright © 2024 Ricardo ;;; ;;; This file is part of GNU Guix. @@ -552,6 +552,13 @@ (define (deploy-managed-host machine) (inferior-exception-arguments c))) os) + (load-system-for-kexec (eval/error-handling c + (warning (G_ "\ +failed to load system of '~a' for kexec reboot:~%~{~s ~}~%") + host + (inferior-exception-arguments + c))) + os) (install-bootloader (eval/error-handling c (raise (formatted-message (G_ "\ diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm index bcc7645fa3..a24a953e6e 100644 --- a/gnu/tests/reconfigure.scm +++ b/gnu/tests/reconfigure.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Jakob L. Kreuze +;;; Copyright © 2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,9 +19,12 @@ (define-module (gnu tests reconfigure) #:use-module (gnu bootloader) + #:use-module (gnu services) + #:use-module (gnu services base) #:use-module (gnu services shepherd) #:use-module (gnu system) #:use-module (gnu system accounts) + #:use-module (gnu system file-systems) #:use-module (gnu system shadow) #:use-module (gnu system vm) #:use-module (gnu tests) @@ -31,6 +35,7 @@ (define-module (gnu tests reconfigure) #:use-module (guix store) #:export (%test-switch-to-system %test-upgrade-services + %test-upgrade-kexec %test-install-bootloader)) ;;; Commentary: @@ -178,6 +183,73 @@ (define* (run-upgrade-services-test) (disable (upgrade-services-program '() '() '(dummy) '()))) (test enable disable)))) +(define (run-kexec-test) + "Run a test aiming to reboot via Linux kexec into a new system." + (define os + (marionette-operating-system + (operating-system + (inherit %simple-os) + (services (modify-services %base-services + (syslog-service-type + config => (syslog-configuration + (inherit config) + (config-file + (plain-file + "syslog.conf" + "*.* /dev/console\n"))))))) + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define new-os + (marionette-operating-system + (virtualized-operating-system ;run as with "guix system vm" + (operating-system + (inherit %simple-os) + (host-name "the-new-os") + (kernel-arguments '("console=ttyS0"))) ;be verbose + #:volatile? #t) ;mount root read-only + #:imported-modules '((gnu services herd) + (guix combinators)))) + + (define vm (virtual-machine os)) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + + (define marionette + (make-marionette (list #$vm))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "kexec") + + (test-equal "host name" + #$(operating-system-host-name os) + (marionette-eval '(gethostname) marionette)) + + (test-assert "kexec-loading-program" + (marionette-eval + '(primitive-load #$(kexec-loading-program new-os)) + marionette)) + + (test-assert "reboot/kexec" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (with-shepherd-action 'root ('kexec) result + (pk 'reboot-kexec result))) + marionette)) + + (test-equal "host name of new OS" + #$(operating-system-host-name new-os) + (marionette-eval '(gethostname) marionette)) + + (test-end)))) + + (gexp->derivation "kexec-test" test)) + (define* (run-install-bootloader-test) "Run a test of an OS running INSTALL-BOOTLOADER-PROGRAM, which installs a bootloader's configuration file." @@ -268,6 +340,12 @@ (define %test-upgrade-services loading new services.") (value (run-upgrade-services-test)))) +(define %test-upgrade-kexec + (system-test + (name "upgrade-kexec") + (description "Load a system and reboot into it via Linux kexec.") + (value (run-kexec-test)))) + (define %test-install-bootloader (system-test (name "install-bootloader") diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index dd34f6cd15..f174c8ada1 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -798,6 +798,7 @@ (define* (perform-action action image save-provenance? skip-safety-checks? install-bootloader? + load-for-kexec? dry-run? derivations-only? use-substitutes? target full-boot? @@ -900,7 +901,13 @@ (define* (perform-action action image To complete the upgrade, run 'herd restart SERVICE' to stop, upgrade, and restart each service that was not automatically restarted.\n"))) (return (format #t (G_ "\ -Run 'herd status' to view the list of services on your system.\n")))))) +Run 'herd status' to view the list of services on your system.\n")))) + (mwhen load-for-kexec? + (mlet %store-monad ((kexec? (load-system-for-kexec local-eval + os))) + (mwhen kexec? + (return (info (G_ "system loaded for fast reboot \ + with 'reboot --kexec'~%")))))))) ((init) (newline) (format #t (G_ "initializing operating system under '~a'...~%") @@ -1025,6 +1032,8 @@ (define (show-help) --image-size=SIZE for 'image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) + (display (G_ " + --no-kexec for 'reconfigure', do not load system for kexec reboot")) (display (G_ " --volatile for 'image', make the root file system volatile")) (display (G_ " @@ -1127,6 +1136,9 @@ (define %options (option '("no-bootloader" "no-grub") #f #f (lambda (opt name arg result) (alist-cons 'install-bootloader? #f result))) + (option '("no-kexec") #f #f + (lambda (opt name arg result) + (alist-cons 'load-for-kexec? #f result))) (option '("volatile") #f #f (lambda (opt name arg result) (alist-cons 'volatile-image-root? #t result))) @@ -1198,6 +1210,7 @@ (define %default-options (image-type . mbr-hybrid-raw) (image-size . guess) (install-bootloader? . #t) + (load-for-kexec? . #t) (label . #f) (volatile-image-root? . #f) (volatile-vm-root? . #t) @@ -1275,6 +1288,7 @@ (define (process-action action args opts) (leave (G_ "no configuration specified~%"))))))) (dry? (assoc-ref opts 'dry-run?)) (bootloader? (assoc-ref opts 'install-bootloader?)) + (kexec? (assoc-ref opts 'load-for-kexec?)) (label (assoc-ref opts 'label)) (image-type (lookup-image-type-by-name (assoc-ref opts 'image-type))) @@ -1360,6 +1374,7 @@ (define (process-action action args opts) (_ #f)) opts) #:install-bootloader? bootloader? + #:load-for-kexec? kexec? #:target target-file #:gc-root (assoc-ref opts 'gc-root))))) #:target target diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm index ddb561d28c..e9e16e3422 100644 --- a/guix/scripts/system/reconfigure.scm +++ b/guix/scripts/system/reconfigure.scm @@ -31,6 +31,7 @@ (define-module (guix scripts system reconfigure) #:use-module (gnu services herd) #:use-module (gnu services shepherd) #:use-module (gnu system) + #:autoload (gnu system file-systems) (file-system-device) #:use-module (guix gexp) #:use-module (guix modules) #:use-module (guix monads) @@ -52,6 +53,9 @@ (define-module (guix scripts system reconfigure) upgrade-services-program upgrade-shepherd-services + kexec-loading-program + load-system-for-kexec + install-bootloader-program install-bootloader @@ -176,6 +180,27 @@ (define (upgrade-services-program service-files to-start to-unload to-restart) (for-each unload-service '#$to-unload) (for-each start-service '#$to-start))))) +(define (kexec-loading-program os) + "Return a program that calls 'kexec_file_load' to allow rebooting into OS +via 'kexec'." + (let ((root-device (file-system-device + (operating-system-root-file-system os)))) + (program-file + "kexec-load-system.scm" + (with-imported-modules '((guix build syscalls)) + #~(begin + (use-modules (guix build syscalls)) + + (let ((kernel (open-fdes #$(operating-system-kernel-file os) + O_RDONLY)) + (initrd (open-fdes #$(operating-system-initrd-file os) + O_RDONLY))) + (kexec-load-file kernel initrd + (string-join + (list #$@(operating-system-kernel-arguments + os root-device))) + KEXEC_FILE_DEBUG))))))) + (define* (upgrade-shepherd-services eval os) "Using EVAL, a monadic procedure taking a single G-Expression as an argument, upgrade the Shepherd (PID 1) by unloading obsolete services and loading new @@ -205,6 +230,12 @@ (define* (upgrade-shepherd-services eval os) to-unload to-restart))))))) +(define (load-system-for-kexec eval os) + "Load OS so that it can be rebooted into via kexec, if supported. Return +true on success." + (eval #~(and (string-contains %host-type "-linux") + (primitive-load #$(kexec-loading-program os))))) + ;;; ;;; Bootloader configuration. -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 26 12:25:35 2024 Received: (at 75027) by debbugs.gnu.org; 26 Dec 2024 17:25:35 +0000 Received: from localhost ([127.0.0.1]:42073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrc7-0000ah-5X for submit@debbugs.gnu.org; Thu, 26 Dec 2024 12:25:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59144) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQrc5-0000aR-4W for 75027@debbugs.gnu.org; Thu, 26 Dec 2024 12:25:33 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQrby-0003DL-MZ; Thu, 26 Dec 2024 12:25:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=tGGuIYw5iRcKq8HAM1rv6i2fpEBJ8okH9xlEIbtUWEY=; b=p6ffQKZquIcf1NeLIw3g J4ZgiJJuv1wOuJZTXel+gjCU/ftTMVrLg14mW5eFrVSQvPNVyWkishbPwEiR68MXiQKBeRvQ8hxxi RfW9m77Cm5jR8yOkqm2xuJyLsFJgRAWgGW0Ail+XwgRjDEZwmIxWSy+VH8Z3pQJjYj81dlBT422lg 2BjABjst2H6MO4ge82BSJSFCTI17EVM2NZJLY9V7RtsGRDDyCGOufWzNgoxNUO9bya62JIXcw+4L0 Plow48/aurYX0haLAu+AIxdJ8x3qGNSjWw/Ok3MX8pUnI/AVAlp5Hl+Siyu6nfD2qb2MVS6VziB+h Yu1R+3NbG6Wh9A==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Jakob Kirsch Subject: Re: [bug#75027] [PATCH 0/3] 'guix system reconfigure' loads system for kexec reboot In-Reply-To: (Jakob Kirsch's message of "Mon, 23 Dec 2024 19:24:54 +0100") References: <87y106ej9v.fsf@gnu.org> Date: Thu, 26 Dec 2024 18:25:25 +0100 Message-ID: <87o70y2w6y.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Jakob Kirsch skribis: > On Mon, Dec 23, 2024 at 12:22:20PM +0100, Ludovic Court=C3=A8s wrote: >> In addition to or instead of running it by default? > > I would say in addition to but with a flag to not load it (like with "--n= o-bootloader" for the bootloader). I sent v2, which includes some of your suggestions, but unfortunately not the =E2=80=9Ckexec=E2=80=9D system entry. > Btw I've also noticed that the framebuffer is only initialized after some= thing graphical (gdm in my case) has been started. This usually isn't an is= sue for most users but my disks are encrypted so I can't see the password p= rompt but I can still type in my password. Weird; for me the Linux framebuffer is initialized early on. Perhaps report a bug with details about your hardware and OS config? Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 01:13:23 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 06:13:23 +0000 Received: from localhost ([127.0.0.1]:48460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRQ4h-0001OQ-1R for submit@debbugs.gnu.org; Sat, 28 Dec 2024 01:13:23 -0500 Received: from mail-pl1-f170.google.com ([209.85.214.170]:45209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRQ4d-0001O6-SX for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 01:13:21 -0500 Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2161eb94cceso67906265ad.2 for <75027@debbugs.gnu.org>; Fri, 27 Dec 2024 22:13:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735366333; x=1735971133; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=clnOWmrU1X/pUsj4qdIPSelB/8tIPDeHRWSK+mBnU5M=; b=lLkQMJ5rwVVK6bm2FeKnbv+9IEe9hPxgj2FBzCI03gbpbKBqEfPHcR2GBfqq6+jBuV iRZkqB5BXGmjd5QlGiV0pA64MAflSgWoCOsJIiQ9ZjWDhOBnAYoB4zLw51mjldk/3Eb/ ns+EmTruAVsFCQUSNt08deU/NF8RWThlUMCq89s7nj7GuJ+1/Sd2ZypLdi+b4NfhdXNq iMd8zFSyLLtHGT474aG/P4KqFR9QUWJlf83S1myK/PTZuBhwiUBdIE1+0UmBi/v4aggo Fwbtho27UyMeMwNd7CauFq+4kMKF0N7mP20oHbmqwD3jhG1P6/knS9Nh5TPCmoWtk1+9 g3Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735366333; x=1735971133; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=clnOWmrU1X/pUsj4qdIPSelB/8tIPDeHRWSK+mBnU5M=; b=aTbZvBzkYH36WtkDsCJPZ6p2/LrAdJupm0qUVokDaulmfTXNs/IczvqwG8UeaLuvTQ zArq70uiL15HZM3vhPS1/kPCCHXypJ0YxkmdFBbFAP5eLyByG6mDQGxrKKS84ghwLErs K51krPGLQ7xiS2f9YhOoNwqRsL1Bc/K97pkjQK8dzWKNk7B0A657zEeOg/k/STnD+gW3 Ido2L+SkXR6//r/qod2TdxTr3xSi4r9FTKN7N+qFRmqE1Ed5dWh2HtALOrLaWZHPLFaN SORmqzCdp6sYyaPLa2hYfbO/DgMHka14/9duofcXAQDP3OOcA7y9atmxP/b+JXDDDf6F 2dCA== X-Gm-Message-State: AOJu0YzrFIgw+vRV/OJp38XGP7MagH0sSgxZr1MrFkKEiA2d7f5s8zMb JhBbeGHOrf5ucA7RcwLLT2gioweJHSeoDrpBXgj1ommQqNF8AgSm8QTfLB36 X-Gm-Gg: ASbGncv3o/Jp65V6+JTEM9gvGfIOwNbwuVMDe32xtQBhoof41aLfu2jBlMOmeDSnF8f D6HooljM8Ad58KrWr/jkJNjdhAzOr+A7XgA91t/Rhg6ukiaj10eI9cflIBiThab6/VKd40UNH6j o+RpNZYVJfqZbOl098lq+yz7PD30KyThtjZy6kIkqRTM0iXmetES4hUHcjab6mENdIEBLwger3w tDfTI0cHjOF6YB5WwCj1b1HBP7lJHoMw87mvZA9XeKPsp33tseoRQ== X-Google-Smtp-Source: AGHT+IHG0r27u4ibeCo4F63US/BIFGLB5K45qprHID3OE5U8P32xPtY3IyilhNTlsVGq4wituT6gmw== X-Received: by 2002:a17:902:c951:b0:216:4a06:e87a with SMTP id d9443c01a7336-219e6f12d84mr489682615ad.40.1735366333518; Fri, 27 Dec 2024 22:12:13 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f4477ec330sm18482339a91.24.2024.12.27.22.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 22:12:11 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#75027] [PATCH v2 1/3] syscalls: Add =?utf-8?Q?=E2=80=98k?= =?utf-8?Q?exec-load-file=E2=80=99=2E?= In-Reply-To: ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Thu, 26 Dec 2024 18:21:25 +0100") References: Date: Sat, 28 Dec 2024 15:12:02 +0900 Message-ID: <87ikr4s5e5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludovic, Ludovic Court=C3=A8s writes: > * guix/build/syscalls.scm (string->utf-8/nul-terminated) > (kexec-load-file): New procedures. [...] > +;; Constants from . > +(define KEXEC_FILE_UNLOAD #x00000001) > +(define KEXEC_FILE_ON_CRASH #x00000002) > +(define KEXEC_FILE_NO_INITRAMFS #x00000004) > +(define KEXEC_FILE_DEBUG #x00000008) > + > +(define kexec-load-file > + (let* ((proc (syscall->procedure int "syscall" > + (list long ;sysno > + int ;kernel fd > + int ;initrd fd > + unsigned-long ;cmdline length > + '* ;cmdline > + unsigned-long))) ;flags > + ;; TODO: Don't do this. Why this TODO? "Don't do this" is not explicit enough; what would be preferable to do here, but can't be done now for some reason? Could we instead detect the error as returned by the syscall when it's not implemented, and throw/report the error accordingly? I see that's kind of done below (a misc-error is raised) -- I think we can remove this special handling already and let the error be throw if it's not implemented -- this removes the need to remember to come back here to edit the list of supported systems the day they gain support. > + (syscall-id (match (utsname:machine (uname)) > + ("i686" 320) > + ("x86_64" 320) > + ("armv7l" 401) > + ("aarch64" 401) > + ;; XXX: There's apparently no support for ppc64le= and > + ;; riscv64. > + (_ #f)))) > + (lambda* (kernel-fd initrd-fd command-line #:optional (flags 0)) > + "Load for eventual use of kexec(8) the Linux kernel from > +@var{kernel-fd}, its initial RAM disk from @var{initrd-fd}, with the giv= en > +@var{command-line} (a string). Optionally, @var{flags} can be a bitwise= or of > +the KEXEC_FILE_* constants." > + (let*-values (((command-line) > + (string->utf-8/nul-terminated command-line)) > + ((ret err) > + (proc syscall-id kernel-fd initrd-fd > + (bytevector-length command-line) > + (bytevector->pointer command-line) > + flags))) > + (when (=3D ret -1) I checked 'man 2 kexec_file_load*' to make sure: On success, these system calls returns 0. On error, -1 is returned = and errno is set to indicate the error. So, looks good. --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 01:13:45 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 06:13:46 +0000 Received: from localhost ([127.0.0.1]:48463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRQ53-0001PG-JB for submit@debbugs.gnu.org; Sat, 28 Dec 2024 01:13:45 -0500 Received: from mail-pl1-f174.google.com ([209.85.214.174]:53504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRQ51-0001P1-FI for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 01:13:44 -0500 Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-21619108a6bso89188105ad.3 for <75027@debbugs.gnu.org>; Fri, 27 Dec 2024 22:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735366357; x=1735971157; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ip2Fqu9DVbw2pzd07xInnh9GswL+CwEVovGeS0fl3jc=; b=X2jJwtKC6HFR5sbsfIYaxohmcOkQb0kSI+Ibzw8wkqiEG32w+51wuCiI75LuxenYVj yqeW0TP2xy+13VSLMnkibzzGMggsaY+7Pd4Xig5w4vpr6UeC2KfAQwZxzij5V5t5o3kH h8ciaA+mFTETbw4NC7SeYwqVc+1g00+C6PJoPQeTTuaL+v/T9Ei1s7w+2NeVDdRppkrg 6ysSFe+8qiMqm+S1qYK1lAYgEU6ye4Z8pSnfcGFhq1FPY5Epb4v5BMJutj60cznC/UXp S4cKjNz/0Mpt9QHq8x6t+45EQHyFKjcEAsvXvLIGkDLI+VDCtbZIdTkPWCWGUbnhqmmD Mhrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735366357; x=1735971157; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ip2Fqu9DVbw2pzd07xInnh9GswL+CwEVovGeS0fl3jc=; b=JFlAaYLf7+61PrFPk4RxYztGHx+ziZZWgRR2YPXastrpbNckmO/YK56gnPw8cZYyWd GHOKNOpR+RLg8mZHbLdK+8ZnnraiBS1J8/lQwwmLa2p9acgn3/QEwiV2uRf7squThn6s 84YUIFo3qQXBWYUhhTIzohV0+grsFnL9JP+YRikV7LrAsCRBM4VQdkE/9A5Fp4GcR2jl d30z4786/IMqBb0MXqzsAPRum55g99ubZFFUhCVnIMzL/pXahEsCrXmyKbFhfTEJyoCR riItsE4tY98+fFxdz+epkvqapv/eTImySE1lvCcqrj2Gy/eSwk7x15jqiO/zldyIjmg7 v9aQ== X-Gm-Message-State: AOJu0Yy0XBVkNl2YUn6cUjxHbb6uEEiRWUZh0nk1muOIfCaaBse32ayY Lvvkltjo7cDFjIE30xEvxp6jYWJMaeEq6YNM7p9kUH03MTLc75bs6ySa+1rF X-Gm-Gg: ASbGncvLcAM23ZIazn4N9BD8HxZWQuWfNvNOm56HKg/G7X7kfswP+bKAu0+Qs8rS1jh 5hgNACif9AW2eH6gbpDAS1eVJA6NK1xyMFAXJ5KtkjUZmRhoWsiMdNjXdSPTpbxMVBvekL7y0kQ HgZV5ueE2tD2opUUIWvWlLjVxDELOWT1mE1FlvYvGJWQidbqAMaXAtCXrsX3QJhNQ3Bs5wMKnY2 V2s2R+gKIBLyY4qCv+6xq9S09DTVbYSTkOFc+LidR1J7ucAokyQKg== X-Google-Smtp-Source: AGHT+IE+Rubpd2OyNQwYW8b/+6BRT0yFJSiyM1D/ZrlJ/Dp6qJBBYh5dYr9yJdGLisLwPB4yt9q3bg== X-Received: by 2002:a05:6a20:4499:b0:1e1:bf32:7d30 with SMTP id adf61e73a8af0-1e5e07ffbf8mr41679518637.33.1735366357380; Fri, 27 Dec 2024 22:12:37 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbad9sm16069732b3a.103.2024.12.27.22.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 22:12:36 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#75027] [PATCH v2 2/3] system: Export =?utf-8?B?4oCY4oCm?= =?utf-8?B?LWluaXRyZC1maWxl4oCZ?= and =?utf-8?Q?=E2=80=98=E2=80=A6-root-file-system=E2=80=99=2E?= In-Reply-To: ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Thu, 26 Dec 2024 18:21:26 +0100") References: Date: Sat, 28 Dec 2024 15:12:27 +0900 Message-ID: <87ed1ss5dg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ludovic Court=C3=A8s writes: > * gnu/system.scm (operating-system-initrd-file): Fix docstring and > export. > (operating-system-root-file-system): Export. > > Change-Id: I5254d82ce547e8014027ed20675b8bfe5a5847c5 Reviewed-by: Maxim Cournoyer --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 02:24:08 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 07:24:08 +0000 Received: from localhost ([127.0.0.1]:48577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRRB9-0004hs-KR for submit@debbugs.gnu.org; Sat, 28 Dec 2024 02:24:08 -0500 Received: from mail-pl1-f180.google.com ([209.85.214.180]:55421) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRRB6-0004hg-Dw for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 02:24:05 -0500 Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-21636268e43so33836575ad.2 for <75027@debbugs.gnu.org>; Fri, 27 Dec 2024 23:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735370583; x=1735975383; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HCAOaHK0ZKNC80nPBeT8/flrlFUQ3RFctEogx3ZAJ4E=; b=kqNh5whgxLT0QK2iJPB4ONi4Moly/1DhXGuVcBswk4ruUPbjfeZV5gGawavviN0IrF xHwsR5OSIJgDlRsYUsPp8HUEEL32CZxXdXyKjm5jza21fBZ7t5k/2g5/DKEIAUiwsg/I Odlz5dkKVa0kiFxdCX+cK2Nwaa2/gvbKFqzUsyguuqiuuPhu27qh6RmWUg7SnJ+8lFTm AsADjZSl/45LNBL2oOrtV6PNAevvGA+K9L6t9cuRnwBlwG5j2++qfifKg4XgycM5qm+B 2DxCED/xLZPl61MGjIyJnkMGWnyq+IyZzRjdBY6PI5gNcr1El9aBGrU8NjXI+kyJvrDg 6pFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735370583; x=1735975383; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HCAOaHK0ZKNC80nPBeT8/flrlFUQ3RFctEogx3ZAJ4E=; b=mpq8Glgife8RKEvuCgfXK+5nkfLEs8G2ffZRbONlen96xgQ+i/DQXJ20mpiMxiOLEy FVzKm3ORGOCtvGV7f/en9SRYdw4zESPxmgiX6P06zy2wfUPHvCTEYLCbK9TeGN30oPP2 VL3EtA11h1g7/meBfIMX1lcq5Ljf1UcTw8ost3vAEkOUx5djTOd9ct5wGlw3F2HggG0Q 623NhxLNYs9n7YyX9Btw3tU/kS74Q4JW6Ghhof2SPnuMAS7HZ4jaGGrNJRXkytJ7r1Hl 3Dnwffpu8/TZXm2bmSuDE42sMdJvHfpKtZ/g+aS6lYabJwiA80YblZiS1V8c8PkW8fRE YUhg== X-Gm-Message-State: AOJu0Yzby/WbbIEsMbJUiAeIKvvPrtF0nKK6PUrwz5A+myB94koESVz6 P5hXd2F1p2QRn/jlINNBtuhXUwkMH4DqR1UT+xpm9QprCiea0L9F X-Gm-Gg: ASbGncuCnBjhvSrJjR51dhfa5oiteUcId5eagGD6VtA8UPFSk9jSpRJ7YwKGsHFPYRr 1PUYjjynEdRgnNFDSL9eZNnpURABVevIfgw9QRQKX315JLqYYgQLsBlv1o38WKO6fsRWKXu8GrQ ojcJZ+vd/4Wx8a4WEHqpSUNeygPAf6ll5ePzby05k0VfM47aH4cWm+oIotgO+PSypJdt7EsXODr RQ/jq2LEvVHSi77PLJ8ohO9s1hc2Nl/QLzBFxJQL2GuseiZbgjfAg== X-Google-Smtp-Source: AGHT+IHyBEirH/5JPgEzSArH/UYPKviCAsZtlbHYqhl/iII6fU4On3H9r8aUBxSa+e3E0gZeBIJCvw== X-Received: by 2002:a05:6a20:c91b:b0:1e1:d22d:cf38 with SMTP id adf61e73a8af0-1e5e05b06bbmr43719493637.21.1735370583277; Fri, 27 Dec 2024 23:23:03 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad81617csm15620621b3a.39.2024.12.27.23.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 23:23:02 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#75027] [PATCH v2 3/3] reconfigure: Support loading the system for kexec reboot. In-Reply-To: <9a41b8595756a8eb9e792236097f175d6f952257.1735233263.git.ludo@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Thu, 26 Dec 2024 18:21:27 +0100") References: <9a41b8595756a8eb9e792236097f175d6f952257.1735233263.git.ludo@gnu.org> Date: Sat, 28 Dec 2024 16:22:52 +0900 Message-ID: <87a5cgs243.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75027 Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , 75027@debbugs.gnu.org, Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, Ludovic Court=C3=A8s writes: > This allows rebooting straight into the new system with =E2=80=98reboot -= k=E2=80=99. > > * guix/scripts/system/reconfigure.scm (kexec-loading-program) > (load-system-for-kexec): New procedures. > * gnu/tests/reconfigure.scm (run-kexec-test): New procedure. > (%test-upgrade-kexec): New variable. > * guix/scripts/system.scm (perform-action): Add #:load-for-kexec?. > Call =E2=80=98load-system-for-kexec=E2=80=99. > (show-help, %options): Add =E2=80=98--no-kexec=E2=80=99. > (%default-options): Add =E2=80=98load-for-kexec?=E2=80=99. > (process-action): Honor it and pass it to =E2=80=98perform-action=E2=80= =99. > * gnu/machine/ssh.scm (deploy-managed-host): Add call to > =E2=80=98load-system-for-kexec=E2=80=99. > * doc/guix.texi (Invoking guix system): Document it. Neat. [...] > +@cindex kexec, for fast reboots > +@cindex rebooting @i{via} Linux kexec Oh, special formatting in index entries; is that allowed/encouraged? [...] > --- a/gnu/machine/ssh.scm > +++ b/gnu/machine/ssh.scm > @@ -1,6 +1,6 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2019 Jakob L. Kreuze > -;;; Copyright =C2=A9 2020-2023 Ludovic Court=C3=A8s > +;;; Copyright =C2=A9 2020-2024 Ludovic Court=C3=A8s > ;;; Copyright =C2=A9 2024 Ricardo > ;;; > ;;; This file is part of GNU Guix. > @@ -552,6 +552,13 @@ (define (deploy-managed-host machine) > (inferior-exceptio= n-arguments > c))) > os) > + (load-system-for-kexec (eval/error-handling c > + (warning (G_ "\ > +failed to load system of '~a' for kexec reboot:~%~{~s ~}~%") Nitpick: I guess ideally you don't want a trailing space added in your formatted list, so you should escape the space something like '~%~{~s~^ ~}~%' in your (ice-9 format) format string. --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 02:25:40 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 07:25:40 +0000 Received: from localhost ([127.0.0.1]:48584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRRCe-0004pp-5R for submit@debbugs.gnu.org; Sat, 28 Dec 2024 02:25:40 -0500 Received: from mail-pj1-f52.google.com ([209.85.216.52]:59852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRRCb-0004pg-7c for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 02:25:38 -0500 Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ef72924e53so9803114a91.3 for <75027@debbugs.gnu.org>; Fri, 27 Dec 2024 23:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735370676; x=1735975476; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bZGO3hcsuvD5PPVwXxuGBhwJKtYyDYzA3rED/Nu4bdk=; b=KK+lnFy++ORWdsfYO+9ul9H8F1JlR2IvPuQERZOUiGMuTmpnk0UtCbjvqEWLxhYqHc ZwwO0wHrLxlmjoUGjI0eUf5dRTN1azYH7UHR98LN9koEwh2wiIlJh/7/Y3h/lJMFppHE gO5cfxkbN8s4dU82cLr6jlxkKt/PsE+X232A3Dc/fElbMHF7OEohVKNa5/RsOP4kVx3Z zSloM6jh8s5/44EOMDBydrRpTI2ktop+eiobgmRUFksJ1QkHU41Okckj7Xi9oScvlGax 0GyxkrynSpBJVXkBJVn+XXAtvGMuiouBuLkAp4n06KFg+Xgv+joIH9clPiFuzB/cx4dA b+HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735370676; x=1735975476; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bZGO3hcsuvD5PPVwXxuGBhwJKtYyDYzA3rED/Nu4bdk=; b=Zok8c2Vwc8ecOE/W0dNSrKD6lIUz8egQYBbnU/7H6h0bM0O9Sv441316icVt5if0dd JcUbXV1c5dEtxvLs3/0Nmu34oFntu2qHfaiJQd7Uxno7BMEo9vL0Bqnfk2XhCTx80R+p n0ZjytxIooDPaQXQeUPi+OkTZIDHf1jQR1cLx5URB3HmbgRHPnppHG0OxCEnF+YeD3V7 ZvbtFBP6VzU8JFMkSNooyEKKVS0Yf1/wXuDGNkO+RNZ2IOg+RzlEAl/O6nTipGPc9Nxz i1qlocUZ7t90uejeq8TJ1OSDpRhQB7/wkOszM69W2p9faiNX7JpktddOEuq58g/7U+U7 hyxw== X-Gm-Message-State: AOJu0YyLTq8J/iF4sM4TVoTKyrxaH3OxUo5/wEB8q0NNbq8GekSc+oqN rSxl9SOy+H0MgE4Lk+e75BlYm/Aq4737iSoZ88lezKrN0cZNT9eV X-Gm-Gg: ASbGncs7OkGqmPVJO0sj7Ve/wRJkSpuaRCTWMGNFxUxaERrqkk/Gk99wz/WgtW8sNW3 znupH1H/+how047QD6FLZIJhjRQNRV5jBYmDG3vO45I5+lkn4QJT1uizBWcickrzrv83XlCf/zA DwhmC9urRtetN3+KgbvNn6U+J2nFAwsx79fX1/JKaN4oaxHR2ohwM5raDRNDGkf/+o7MhQMxhNZ Qiixsff8TjQiyVg1mik7d09QINANMTwIOeVupW6kLbjlQFCfhmv7g== X-Google-Smtp-Source: AGHT+IEpw2rydehVHUEV6EAf/JEx6njHn+g89OiO3MxJZa3pJ8977eg5rngTtKI4Aam4b3pbU6C9Mg== X-Received: by 2002:a05:6a00:4644:b0:728:fab1:eda0 with SMTP id d2e1a72fcca58-72abdebaae0mr38170338b3a.25.1735370676522; Fri, 27 Dec 2024 23:24:36 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad90c173sm15634657b3a.192.2024.12.27.23.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2024 23:24:35 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#75027] [PATCH v2 0/3] 'guix system reconfigure' loads system for kexec reboot In-Reply-To: ("Ludovic =?utf-8?Q?Court?= =?utf-8?Q?=C3=A8s=22's?= message of "Thu, 26 Dec 2024 18:21:24 +0100") References: Date: Sat, 28 Dec 2024 16:24:25 +0900 Message-ID: <875xn4s21i.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75027 Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , 75027@debbugs.gnu.org, Jakob Kirsch , Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludovic, Ludovic Court=C3=A8s writes: > Hello, > > Changes compared to v1: > > =E2=80=A2 Move kexec code outside of =E2=80=98upgrade-shepherd-services= =E2=80=99. Now both > (guix scripts system) and (gnu machine ssh) have to explicitly > call =E2=80=98load-system-for-kexec=E2=80=99. > I've sent a couple comments; assuming you can address them, LGTM! Thanks for working on this interesting improvement. Reviewed-by: Maxim Cournoyer --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 16:32:34 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 21:32:34 +0000 Received: from localhost ([127.0.0.1]:52858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tReQE-0002M1-21 for submit@debbugs.gnu.org; Sat, 28 Dec 2024 16:32:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tReQB-0002Ll-PR for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 16:32:32 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tReQ6-0000Kv-HC; Sat, 28 Dec 2024 16:32:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=U+QW9xvfHGKRthWS304bFy/IP6NvqFLQVgbkpB/UuO4=; b=Qd7zBbftmB7MvAc7osvr XSOjSATEoBqGqBfKqRTESvnnx1JzN3nQZcmUW5FXGNjsl2Qq+nUbsu6B5LiEQN/KgXTi2nK8fF7OG nsJrkjIKx6n4xsyq14DV1uq0BLFN2iwLuLx0wRZ3u55Se6pG/Tm7SB3t4ROlmJGkK2A/z584zKX1p VrkULC1DgFSj0/LFxaUSZqz5tJR3x9DaTcpvONIYshjfTtp3fEuzaLbslXZL0OirG9ERzaVEB6kZz 5lmyLQgT3vH3Ts6RKJkNtIeucsXLSKp8YArDIfvfKh/9z7BsyMQyKoHyMz2gwbpSOBtMUABOfvVMo ezE2SPEK93isEg==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: [bug#75027] [PATCH v2 1/3] syscalls: Add =?utf-8?Q?=E2=80=98k?= =?utf-8?Q?exec-load-file=E2=80=99=2E?= In-Reply-To: <87ikr4s5e5.fsf@gmail.com> (Maxim Cournoyer's message of "Sat, 28 Dec 2024 15:12:02 +0900") References: <87ikr4s5e5.fsf@gmail.com> Date: Sat, 28 Dec 2024 22:32:23 +0100 Message-ID: <8734i7trx4.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: 75027@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Maxim, Maxim Cournoyer skribis: >> +(define kexec-load-file >> + (let* ((proc (syscall->procedure int "syscall" >> + (list long ;sysno >> + int ;kernel fd >> + int ;initrd fd >> + unsigned-long ;cmdline leng= th >> + '* ;cmdline >> + unsigned-long))) ;flags >> + ;; TODO: Don't do this. > > Why this TODO? "Don't do this" is not explicit enough; what would be > preferable to do here, but can't be done now for some reason? The TODO is actually copy/pasted for a few lines above, but I agree it=E2= =80=99s not very clear nor helpful. Presumably it=E2=80=99s here to mean that usin= g the =E2=80=98syscall=E2=80=99 function and having to record syscall numbers of = each architecture is not great. There=E2=80=99s no alternative though, at this = time. > Could we instead detect the error as returned by the syscall when it's > not implemented, and throw/report the error accordingly? I see that's > kind of done below (a misc-error is raised) -- I think we can remove > this special handling already and let the error be throw if it's not > implemented -- this removes the need to remember to come back here to > edit the list of supported systems the day they gain support. Yes. Plus I got the magic numbers wrong it seems (protip: it=E2=80=99s eas= ier to grep glibc than Linux to get them), so this gives us this change: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index f8c9937f54..960339e8bf 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -793,20 +793,24 @@ (define kexec-load-file unsigned-long ;cmdline length '* ;cmdline unsigned-long))) ;flags - ;; TODO: Don't do this. (syscall-id (match (utsname:machine (uname)) ("i686" 320) ("x86_64" 320) ("armv7l" 401) - ("aarch64" 401) - ;; XXX: There's apparently no support for ppc64le and - ;; riscv64. + ("aarch64" 294) + ("ppc64le" 382) + ("riscv64" 294) (_ #f)))) (lambda* (kernel-fd initrd-fd command-line #:optional (flags 0)) "Load for eventual use of kexec(8) the Linux kernel from @var{kernel-fd}, its initial RAM disk from @var{initrd-fd}, with the given @var{command-line} (a string). Optionally, @var{flags} can be a bitwise or of the KEXEC_FILE_* constants." + (unless syscall-id + (throw 'system-error "kexec-load-file" "~A" + (list (strerror ENOSYS)) + (list ENOSYS))) + (let*-values (((command-line) (string->utf-8/nul-terminated command-line)) ((ret err) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpUaGFua3MsDQpMdWRv4oCZLg0K --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 16:46:35 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 21:46:35 +0000 Received: from localhost ([127.0.0.1]:52874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRedm-0002yS-Ol for submit@debbugs.gnu.org; Sat, 28 Dec 2024 16:46:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRedk-0002xy-Mc for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 16:46:33 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRede-000307-8u; Sat, 28 Dec 2024 16:46:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=F9H7QoQvxgIX6YD3AvL0frgceI9Wr0oknc41qFilQ/w=; b=QmBinTnpg/LxrKtC0+Wy hzvJA7ohX0ORq7yPI2zPYdSVSOLiJ2uF4FdiefAlidOT2T+emXK4MpSrH+cTXvIZce5re9zd50ghl vxj45WDn0uOFj9Lmamg5MK4LWuW0BVylb2sw7SqsSFsyfaUJekaQvOKLhysDWoqzV0oCBG/A5LiTC lHhbyJNG9x/hZIM7IcnMuI0gdAq3nlLoLLYn1WLLtAnYgSU82Whh63nfN4ts9815oOLOMI2KojyWP so75X1wA/n+JrWwtdboonZW+MYRhoBTzuhXraHfiClYtfEP1i3IdJfCXkF9lt9eR0WDeWnzGOMzIo 0rnbB3VeZ6SS3w==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: [bug#75027] [PATCH v2 3/3] reconfigure: Support loading the system for kexec reboot. In-Reply-To: <87a5cgs243.fsf@gmail.com> (Maxim Cournoyer's message of "Sat, 28 Dec 2024 16:22:52 +0900") References: <9a41b8595756a8eb9e792236097f175d6f952257.1735233263.git.ludo@gnu.org> <87a5cgs243.fsf@gmail.com> Date: Sat, 28 Dec 2024 22:46:20 +0100 Message-ID: <87y0zzscpf.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , 75027@debbugs.gnu.org, Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Maxim Cournoyer skribis: >> +@cindex kexec, for fast reboots >> +@cindex rebooting @i{via} Linux kexec > > Oh, special formatting in index entries; is that allowed/encouraged? It=E2=80=99s definitely allowed. >> + (load-system-for-kexec (eval/error-handling c >> + (warning (G_ "\ >> +failed to load system of '~a' for kexec reboot:~%~{~s ~}~%") > > Nitpick: I guess ideally you don't want a trailing space added in your > formatted list, so you should escape the space something like '~%~{~s~^ > ~}~%' in your (ice-9 format) format string. Good idea. First time I use ~^. :-) Thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 17:18:52 2024 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 22:18:52 +0000 Received: from localhost ([127.0.0.1]:52963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRf91-0004Or-TC for submit@debbugs.gnu.org; Sat, 28 Dec 2024 17:18:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRf90-0004Oa-PD for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 17:18:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRf8u-0002Pd-ON; Sat, 28 Dec 2024 17:18:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=GqTr7afPCi658m6MqdpGCC/tMEsuV5aMQy5nAd2eZSk=; b=qiLl0zcqHHPvmE4AmJKB +NOrQuMcl8dz/DP9Q75KZCpz8xWRA9HZIt0tPS53RTAqUmtW8XaaXx0wr4KKKWHJ4D/JgS4WcnXYF LC04IVVaMgRJZQONM2R2scADuKnGEsyLM6MBmoNSX+trmuYuTXUc57zfpmvB8V51uqgA/JThWkYgV W+VMEf6hfaI1rTVdBv/iuyNcmav8IM9FBR+aZBUhVpeAkUyoKm5q3EKmcRiliogbgKOWTtiDRQilw FK6kng+AKH+UX/MeGIlGfX4ZkN1x9Nk6capNwoQP7NwWl9dUf274nPiNw3DiVe8UIahGm0HzxlH/V JynVTCv8JscnmQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: [bug#75027] [PATCH v2 0/3] 'guix system reconfigure' loads system for kexec reboot In-Reply-To: <875xn4s21i.fsf@gmail.com> (Maxim Cournoyer's message of "Sat, 28 Dec 2024 16:24:25 +0900") References: <875xn4s21i.fsf@gmail.com> Date: Sat, 28 Dec 2024 23:18:42 +0100 Message-ID: <877c7jsb7h.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75027 Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , 75027@debbugs.gnu.org, Jakob Kirsch , Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Maxim Cournoyer skribis: > I've sent a couple comments; assuming you can address them, LGTM! > Thanks for working on this interesting improvement. Now pushed, taking your suggestions into account, and together with a news entry (I should have posted it here from the start but I thought about it too late): 4f7b58b92a * news: Add entry about kexec. 1305f78d05 * reconfigure: Support loading the system for kexec reboot. ebe706a1e8 * system: Export =E2=80=98=E2=80=A6-initrd-file=E2=80=99 and = =E2=80=98=E2=80=A6-root-file-system=E2=80=99. 5c9029dc79 * syscalls: Add =E2=80=98kexec-load-file=E2=80=99. Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 17:19:00 2024 Received: (at control) by debbugs.gnu.org; 28 Dec 2024 22:19:00 +0000 Received: from localhost ([127.0.0.1]:52967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRf9A-0004PU-82 for submit@debbugs.gnu.org; Sat, 28 Dec 2024 17:19:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRf98-0004P0-Iv for control@debbugs.gnu.org; Sat, 28 Dec 2024 17:18:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRf93-0002Rf-Cx for control@debbugs.gnu.org; Sat, 28 Dec 2024 17:18:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=JxVNqDz/CYPFOA/lBCs2YNI1/uwOql3xwPrSOJdAlsg=; b=cl5cnKB/pnICH3 tKEM9LcSZvvZXt+vWMWgXEk1IFdKmFeGFmtE8klcqFm3XPKw7V9CQOL6ZBPPa6KX37AlmSEnbEl7c Mb15ZwKX8+erKwVUIxmkoKOZzTuL9Wz2FAC8+9uvbQ0aa2bw/O/Rme8PFWJAZHjHeuaJkL9dy0lgL ythy+NUVeBFPAh9iSp3Jdp09KxdEqndldJDRA2Qx6enhnu86rEs40Bl6O4pK4YBapyl3vrS8WSAiN JTynUevxuYyJwIUcBtYDNlaO44vnKCamAJ4wsvWyUyzTrvUQasxy+W1t67yFWpOAZF3FQZllsoENw s5ZdjURG93CErYLXB40w==; Date: Sat, 28 Dec 2024 23:18:51 +0100 Message-Id: <875xn3sb78.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #75027 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 75027 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 21:25:03 2024 Received: (at 75027) by debbugs.gnu.org; 29 Dec 2024 02:25:03 +0000 Received: from localhost ([127.0.0.1]:53210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRizG-0000c2-SY for submit@debbugs.gnu.org; Sat, 28 Dec 2024 21:25:03 -0500 Received: from mail-pl1-f172.google.com ([209.85.214.172]:49202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRizA-0000bB-2Q for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 21:25:00 -0500 Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-21634338cfdso149774005ad.2 for <75027@debbugs.gnu.org>; Sat, 28 Dec 2024 18:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735439030; x=1736043830; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hafZgdTdl8e/oZxIlCQJFUD2QsjlefnTbRUZR/t7Syg=; b=CvovrsB/Mxfqd9szNISkw29cK2k75l/U7Y7U9+kj/2leLvv0x8JputaFZm+G2H/9O2 hpZADCPAM5LMlGScnAW4nFHo/HIllP8Ez3RIpfZ7cpMTFhnvTeD6A1ye1cErEvGKIzwS whJA9sLfy8QQrytpvPk9a30q67GMl+svpYw/cLlneGy4Ya/B7FV+7Vozn2geu+8gLXwV Ecat+Rey7+iB9QbIjWGUL1ger0nXgnSdd/+vddrD3IMW6OmaQJ00UWLtKElXz4N85lq8 UCGmyR7VqLVVCKbBS2cWLSYa2hBykyYBzyDdb/84CoL3qRU82e0RqRN/4c+MqA4ngcYX K1vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735439030; x=1736043830; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hafZgdTdl8e/oZxIlCQJFUD2QsjlefnTbRUZR/t7Syg=; b=uY/XS5l1WCx7C96Ua3vzEelc4h2ly8XLHPxoy5qSRm3omm4bsYFu1MFumVsxmxVvgu Cs/91aUC8eGzt2JnWJ/7HW7eT563LTli6GGY1dHTUkaZhWYWbxyF8YIdWrfMmLHTDtVh rejxH3Y6S8KWn0rv+RwzNtPkHUpGeZnLR9yXOF3MbQIcag89IRXP2VPgCPB7PMhkE/zZ mzERAYCUIVW+8LH03ZkbA4wBPHJD1JsXu0wpDla6qogJbKOaW6ZAU+YtUAYTNrcdpS3i MbNuXEl6lcMjlCXIgldFxmhXXEERwfuhQ8m6S2NnRHrNa2k4uiPGWC8RaM5M1G0o2bGc Sh3g== X-Forwarded-Encrypted: i=1; AJvYcCXowur7F8YvOnZOIm+Uk6r3Mj2iBE4DcoA6j959PqZ7JIdF+tp0hjjUzZDyhM1kIZZtSjDP4g==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxAwwLWUuTElHz+zPDgKSEkYn+eLVbNXykErusX4U85hJ4rYm/A K/0MQpFxPPaMrYEXQcFeLeATEfdUDp7vhj47YziJtkOTm1oHIUx8 X-Gm-Gg: ASbGnctSRu/qSZIZralrtHWGVd6U4pbPLwtqCxaQpvT1SEsdcxUbsxD1m2ZN9wSoEUk pNxu5D2F1qM+elqyRS3/Q5SfEVoizheHg6lSR+UdB0pA6jzLqofu5Hhmx87TBw1t1obJ6QFXs7B vgh57TjQhK3ysU515Vizafmg5b5fSoKP8QqGymSBJFNi5oZpj6Nqt2VVSN3qhj6mkbhO2S0woJQ Zs85w9iDf/1H+XDfeKBiwtdINi2QUKVy6T5Lx/bUKQLvAsa+FbBHw== X-Google-Smtp-Source: AGHT+IHPEtyO73VCBm2UjbweeSJZXNERqR7L7/hRDwgdb75vSQLfR5Js3z1XDFNBuKQt5sQh6WFNpw== X-Received: by 2002:a17:903:186:b0:215:7719:24f6 with SMTP id d9443c01a7336-219e6ebb722mr392738015ad.23.1735439030059; Sat, 28 Dec 2024 18:23:50 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9d4635sm156268665ad.162.2024.12.28.18.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 18:23:49 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#75027] [PATCH v2 0/3] 'guix system reconfigure' loads system for kexec reboot In-Reply-To: <877c7jsb7h.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sat, 28 Dec 2024 23:18:42 +0100") References: <875xn4s21i.fsf@gmail.com> <877c7jsb7h.fsf@gnu.org> Date: Sun, 29 Dec 2024 11:23:38 +0900 Message-ID: <87bjwvi5w5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75027 Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , 75027@debbugs.gnu.org, Jakob Kirsch , Christopher Baines X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Ludovic Court=C3=A8s writes: > Maxim Cournoyer skribis: > >> I've sent a couple comments; assuming you can address them, LGTM! >> Thanks for working on this interesting improvement. > > Now pushed, taking your suggestions into account, and together with a > news entry (I should have posted it here from the start but I thought > about it too late): > > 4f7b58b92a * news: Add entry about kexec. > 1305f78d05 * reconfigure: Support loading the system for kexec reboot. > ebe706a1e8 * system: Export =E2=80=98=E2=80=A6-initrd-file=E2=80=99 and= =E2=80=98=E2=80=A6-root-file-system=E2=80=99. > 5c9029dc79 * syscalls: Add =E2=80=98kexec-load-file=E2=80=99. Great, Happy New Year! --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 11:18:07 2025 Received: (at 75027) by debbugs.gnu.org; 5 Jan 2025 16:18:07 +0000 Received: from localhost ([127.0.0.1]:34913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUTKI-0003e9-RV for submit@debbugs.gnu.org; Sun, 05 Jan 2025 11:18:07 -0500 Received: from mail.venatores.group ([2001:19f0:9002:2d20:5400:4ff:fe1f:ec4b]:32876) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUTIw-0003bL-2U for 75027@debbugs.gnu.org; Sun, 05 Jan 2025 11:16:43 -0500 From: boogs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=venatores.group; s=mail; t=1736093794; bh=p+PvpWn0ejl40Zlfv+RpoJIsImbOKe+6lgEXNdlV+4c=; h=From:To:Subject:Date:From; b=h3EpibO3Xk1E2prZAM9ITp0Lgr1kI1puk0OlftnHryM17lqGabPPbwWgT8Itt8MEf etx420n3ABWyYvn1t8vjFY6GB6krT13LA/iDUtVZAjcj2mfHNz3hAx+yOHXjtBoL9+ xsPFyIvxU3Ekp/Auk9+HDpTIpqXHocrfQ7KwC888hHjOLD2h9hbqjrj5KULkTfdZsV VuV4HpjMbEv8YLSwl5zyjxUHC7iztqU2fUX7kLSrNm9rQFGThWTTYf9X3nt1QP1Ex6 3eoYNKopt0MWasirbWJIFGS/11Cb8b7F2Mx4vYty7bCdWdzTipopNOQwNcPa73Yo0J ND2OcowoysPyw== To: 75027@debbugs.gnu.org Subject: guix system reconfigure fails with kexec-load-file: Invalid argument (KEXEC_FILE_DEBUG issue) Date: Sun, 05 Jan 2025 11:16:33 -0500 Message-ID: <87sepxkzha.fsf@venatores.group> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75027 X-Mailman-Approved-At: Sun, 05 Jan 2025 11:18:05 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, It looks like some people[1,2] including myself are running into an issue where the `guix system reconfigure` command fails, presumably because `KEXEC_FILE_DEBUG` is not supported in older kernel configurations. The output of reconfiguring my system is the same as Simen's[2] ending in: ``` To complete the upgrade, run 'herd restart SERVICE' to stop, upgrade, and restart each service that was not automatically restarted. Run 'herd status' to view the list of services on your system. WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete' guix system: error: kexec-load-file: Invalid argument ``` My system runs a custom kernel configuration that I created via `make menuconfig` in the kernel repo. I suspect the issue lies here: ``` (define (kexec-loading-program os) "Return a program that calls 'kexec_file_load' to allow rebooting into OS via 'kexec'." (let ((root-device (file-system-device (operating-system-root-file-system os)))) (program-file "kexec-load-system.scm" (with-imported-modules '((guix build syscalls)) #~(begin (use-modules (guix build syscalls)) (let ((kernel (open-fdes #$(operating-system-kernel-file os) O_RDONLY)) (initrd (open-fdes #$(operating-system-initrd-file os) O_RDONLY))) (kexec-load-file kernel initrd (string-join (list #$@(operating-system-kernel-arguments os root-device))) KEXEC_FILE_DEBUG))))))) ``` This is the relevant snippet from my kernel configuration: ``` # # Kexec and crash features # CONFIG_CRASH_CORE=y CONFIG_KEXEC_CORE=y CONFIG_KEXEC=y CONFIG_KEXEC_FILE=y CONFIG_KEXEC_JUMP=y CONFIG_CRASH_DUMP=y CONFIG_CRASH_HOTPLUG=y CONFIG_CRASH_MAX_MEMORY_RANGES=8192 # end of Kexec and crash features # end of General setup ``` [1] https://issues.guix.gnu.org/75320 [2] https://issues.guix.gnu.org/75211 -- Boogs From unknown Sat Sep 06 09:43:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 03 Feb 2025 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator