From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYrFL-0000yA-Mf for guix-patches@gnu.org; Tue, 09 Jan 2018 05:35:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYrFG-0000AB-Nh for guix-patches@gnu.org; Tue, 09 Jan 2018 05:35:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYrFG-0000A5-K2 for guix-patches@gnu.org; Tue, 09 Jan 2018 05:35:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eYrFG-0002Qq-DS for guix-patches@gnu.org; Tue, 09 Jan 2018 05:35:02 -0500 Subject: [bug#29932] [PATCH 0/2] Clean up operating-system-kernel-arguments. Resent-Message-ID: Date: Tue, 9 Jan 2018 11:34:38 +0100 From: Danny Milosavljevic Message-ID: <20180109113438.38341a07@scratchpost.org> In-Reply-To: <87incbxvlq.fsf@gnu.org> References: <20180101132200.26157-1-dannym@scratchpost.org> <878td8k8f5.fsf@gnu.org> <20180109092133.3f740ba3@scratchpost.org> <87incbxvlq.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 29932@debbugs.gnu.org Hi Ludo, > #~(string-append "--system=3D" #$os) >=20 > where =E2=80=98os=E2=80=99 is an . It automatically co= mputes its > derivation. Thus, no need to explicitly call > =E2=80=98operating-system-derivation=E2=80=99 and pass =E2=80=9Csystem.dr= v=E2=80=9D arguments around. Ah! Good to know. > So we=E2=80=99d just need a slight adjustment to =E2=80=98bootable-kernel= -arguments=E2=80=99 (so > that it takes the root device from the given OS object) and then rename > it to =E2=80=98operating-system-kernel-arguments=E2=80=99. bootable-kernel-arguments is also used by the "parameters" file serializer. Also, the user that is modifying a instance (for example= marionette-operating-system adding "panic=3D1") would erronously use opera= ting-system-kernel-arguments in order to get the previous instance's argume= nts, resulting in the "--root", "--load" etc being prepended twice, no? The user might want to pass some kernel arguments which have nothing to do = with Guix (which 's "kernel-arguments" is for) and then G= uixSD needs some extra arguments to be able to boot the actual system (whic= h can be found entirely automatically - nice!). Example: diff --git a/gnu/tests.scm b/gnu/tests.scm index 0caa922fd..3e4c3d4e3 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -172,6 +172,14 @@ marionette service in the guest is started after the S= hepherd services listed in REQUIREMENTS." (operating-system (inherit os) + ;; Make sure the guest dies on error. + (kernel-arguments (cons "panic=3D1" + (operating-system-user-kernel-arguments os))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ;; Make sure the guest doesn't hang in the REPL on error. + (initrd (lambda (fs . rest) + (apply (operating-system-initrd os) fs + #:on-error 'backtrace + rest))) (services (cons (service marionette-service-type (marionette-configuration (requirements requirements) I'd suggest this: diff --git a/gnu/system.scm b/gnu/system.scm index df89ca06d..6466c7c48 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -73,7 +73,8 @@ operating-system-hosts-file operating-system-kernel operating-system-kernel-file - operating-system-kernel-arguments + operating-system-bootable-kernel-arguments + operating-system-user-kernel-arguments operating-system-initrd operating-system-users operating-system-groups @@ -200,12 +201,13 @@ booted from ROOT-DEVICE" (sudoers-file operating-system-sudoers-file ; file-like (default %sudoers-specification))) =20 -(define (operating-system-kernel-arguments os system.drv root-device) - "Return all the kernel arguments, including the ones not specified -directly by the user." - (bootable-kernel-arguments (operating-system-user-kernel-arguments os) - system.drv - root-device)) +(define* (operating-system-bootable-kernel-arguments os) + "Prepend extra arguments to OS's kernel-arguments that allow OS to be bo= oted." + (let* ((root-file-system (operating-system-root-file-system os)) + (root-device (file-system-device root-file-system))) + #~(bootable-kernel-arguments (operating-system-user-kernel-arguments o= s) + #$os + root-device))) =20 ^L ;;; @@ -940,7 +942,7 @@ kernel arguments for that derivation to ." (kernel (operating-system-kernel-file os)) (kernel-arguments (if system.drv - (operating-system-kernel-arguments os system.drv root-devi= ce) + (operating-system-bootable-kernel-arguments os) (operating-system-user-kernel-arguments os))) (initrd initrd) (bootloader-name bootloader-name) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 496f2ac4e..117e333a7 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -716,7 +716,7 @@ it is mostly useful when FULL-BOOT? is true." #:disk-image-size disk-image-size))) (define kernel-arguments #~(list #$@(if graphic? #~() #~("console=3DttyS0")) - #+@(operating-system-kernel-arguments os os-drv "/dev/vda1")= )) + #+@(operating-system-bootable-kernel-arguments os))) =20 (define qemu-exec #~(list (string-append #$qemu "/bin/" #$(qemu-command (%current-syst= em)))