all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 29932@debbugs.gnu.org
Subject: [bug#29932] [PATCH 0/2] Clean up operating-system-kernel-arguments.
Date: Tue, 9 Jan 2018 11:34:38 +0100	[thread overview]
Message-ID: <20180109113438.38341a07@scratchpost.org> (raw)
In-Reply-To: <87incbxvlq.fsf@gnu.org>

Hi Ludo,

>   #~(string-append "--system=" #$os)
> 
> where ‘os’ is an <operating-system>.  It automatically computes its
> derivation.  Thus, no need to explicitly call
> ‘operating-system-derivation’ and pass “system.drv” arguments around.

Ah!  Good to know.

> So we’d just need a slight adjustment to ‘bootable-kernel-arguments’ (so
> that it takes the root device from the given OS object) and then rename
> it to ‘operating-system-kernel-arguments’.

bootable-kernel-arguments is also used by the "parameters" file serializer.

Also, the user that is modifying a <operating-system> instance (for example marionette-operating-system adding "panic=1") would erronously use operating-system-kernel-arguments in order to get the previous instance's arguments, 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 <operating-system>'s "kernel-arguments" is for) and then GuixSD needs some extra arguments to be able to boot the actual system (which 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 Shepherd services listed
 in REQUIREMENTS."
   (operating-system
     (inherit os)
+    ;; Make sure the guest dies on error.
+    (kernel-arguments (cons "panic=1"
+                            (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)))
 
-(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 booted."
+  (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 os)
+                                 #$os
+                                 root-device)))
 
 ^L
 ;;;
@@ -940,7 +942,7 @@ kernel arguments for that derivation to <boot-parameters>."
              (kernel (operating-system-kernel-file os))
              (kernel-arguments
               (if system.drv
-                (operating-system-kernel-arguments os system.drv root-device)
+                (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=ttyS0"))
-              #+@(operating-system-kernel-arguments os os-drv "/dev/vda1")))
+              #+@(operating-system-bootable-kernel-arguments os)))
 
     (define qemu-exec
       #~(list (string-append #$qemu "/bin/" #$(qemu-command (%current-system)))

  reply	other threads:[~2018-01-09 10:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-01 13:22 [bug#29932] [PATCH 0/2] Clean up operating-system-kernel-arguments Danny Milosavljevic
2018-01-01 13:27 ` [bug#29932] [PATCH 1/2] system: Inline operating-system-kernel-arguments Danny Milosavljevic
2018-01-01 13:27   ` [bug#29932] [PATCH 2/2] system: Rename operating-system-user-kernel-arguments to operating-system-kernel-arguments Danny Milosavljevic
2018-01-08  9:26 ` [bug#29932] [PATCH 0/2] Clean up operating-system-kernel-arguments Ludovic Courtès
2018-01-09  8:21   ` Danny Milosavljevic
2018-01-09  8:52     ` Ludovic Courtès
2018-01-09 10:34       ` Danny Milosavljevic [this message]
2018-01-09 11:53         ` Ludovic Courtès
2018-01-09 10:39   ` Danny Milosavljevic
2018-01-09 18:59     ` Danny Milosavljevic
2018-01-11 16:43       ` Ludovic Courtès
2018-01-12 10:59 ` [bug#29932] [PATCH v2 1/2] system: Split up operating-system-kernel-arguments into operating-system-boot-kernel-arguments and operating-system-user-kernel-arguments Danny Milosavljevic
2018-01-12 11:01   ` [bug#29932] [PATCH v2 2/2] system: Rename operating-system-user-kernel-arguments to operating-system-kernel-arguments Danny Milosavljevic
2018-01-12 14:06     ` Ludovic Courtès
2018-01-12 14:43       ` Danny Milosavljevic
2020-10-08 17:50         ` Maxim Cournoyer
2021-07-13 11:56           ` bug#29932: [PATCH 0/2] Clean up operating-system-kernel-arguments Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109113438.38341a07@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=29932@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.