From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 30760@debbugs.gnu.org
Subject: bug#30760: guix system init broken on non GuixSD
Date: Mon, 12 Mar 2018 13:57:08 +0100 [thread overview]
Message-ID: <877eqhqwnv.fsf@gnu.org> (raw)
In-Reply-To: <20180312132437.2a4b2ca7@scratchpost.org> (Danny Milosavljevic's message of "Mon, 12 Mar 2018 13:24:37 +0100")
[-- Attachment #1: Type: text/plain, Size: 1941 bytes --]
Hello,
Danny Milosavljevic <dannym@scratchpost.org> skribis:
>> I'm afraid this is still not correct.
>>
>> # guix system init config.scm /mnt/mnt/
>> ...
>> config.scm:64:9: error: you may need these modules in the initrd for /dev/nvme0n1p2: shpchp
>> hint: Try adding them to the `initrd-modules' field of your `operating-system' declaration, along these lines:
>>
>> (operating-system
>> ;; ...
>> (initrd-modules (append (list "shpchp")
>> %base-initrd-modules)))
>>
>> I don't have `shpchp` as a module as I have it compiled into kernel
>> directly. Can I somehow disable the check?
Exactly what I feared. ;-)
> I think it's a good idea to add a command-line switch that disables the check.
>
> But then people will just disable the check always and it won't improve until
> it's correct. It's still a good idea to give people the choice.
>
> @Ludo: It would also be great to have a command-line switch to check the slow,
> correct, way. We'd also have to check modules.builtin of the new system's initrd
> - but we'd do it only when the option is passed :)
>
> I suggest to change it to:
>
>> # guix system init config.scm /mnt/mnt/
>> ...
>> config.scm:64:9: WARNING: you may need these modules in the initrd for /dev/nvme0n1p2: shpchp
> ^^^ not error
I thought about making it a warning rather than an error back then, but
thought that it wouldn’t work well: the warning would immediately go
off-screen as build logs start scrolling by.
Thus I took the optimistic view that false positives like the one Tomáš
experienced should be rare because usually init/reconfigure are used on
GuixSD, with a kernel config very close to the target config.
Nevertheless, the risk of false-positives obviously exists, hence the
need for an escape hatch.
What about the attached patch?
Thanks,
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4059 bytes --]
diff --git a/doc/guix.texi b/doc/guix.texi
index d3a7908f9..bcea89e07 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20458,6 +20458,16 @@ of the image size as a function of the size of the system declared in
Make @var{file} a symlink to the result, and register it as a garbage
collector root.
+@item --skip-checks
+Skip pre-installation safety checks.
+
+By default, @command{guix system init} and @command{guix system
+reconfigure} perform safety checks: they make sure the file systems that
+appear in the @code{operating-system} declaration actually exist
+(@pxref{File Systems}), and that any Linux kernel modules that may be
+needed at boot time are listed in @code{initrd-modules} (@pxref{Initial
+RAM Disk}). Passing this option skips these tests altogether.
+
@item --on-error=@var{strategy}
Apply @var{strategy} when an error occurs when reading @var{file}.
@var{strategy} may be one of the following:
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index acfccce96..f0c4a2ba1 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -733,7 +733,8 @@ and TARGET arguments."
(#$installer #$bootloader #$device #$target))))))
(define* (perform-action action os
- #:key install-bootloader?
+ #:key skip-safety-checks?
+ install-bootloader?
dry-run? derivations-only?
use-substitutes? bootloader-target target
image-size file-system-type full-boot?
@@ -750,7 +751,10 @@ When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
building anything.
When GC-ROOT is a path, also make that path an indirect root of the build
-output when building a system derivation, such as a disk image."
+output when building a system derivation, such as a disk image.
+
+When SKIP-SAFETY-CHECKS? is true, skip the file system and initrd module
+static checks."
(define println
(cut format #t "~a~%" <>))
@@ -760,7 +764,8 @@ output when building a system derivation, such as a disk image."
;; Check whether the declared file systems exist. This is better than
;; instantiating a broken configuration. Assume that we can only check if
;; running as root.
- (when (memq action '(init reconfigure))
+ (when (and (not skip-safety-checks?)
+ (memq action '(init reconfigure)))
(check-mapped-devices os)
(when (zero? (getuid))
(check-file-system-availability (operating-system-file-systems os))
@@ -933,6 +938,8 @@ Some ACTIONS support additional ARGS.\n"))
--expose=SPEC for 'vm', expose host file system according to SPEC"))
(display (G_ "
--full-boot for 'vm', make a full boot sequence"))
+ (display (G_ "
+ --skip-checks skip file system and initrd module safety checks"))
(newline)
(display (G_ "
-h, --help display this help and exit"))
@@ -974,6 +981,9 @@ Some ACTIONS support additional ARGS.\n"))
(option '("full-boot") #f #f
(lambda (opt name arg result)
(alist-cons 'full-boot? #t result)))
+ (option '("skip-checks") #f #f
+ (lambda (opt name arg result)
+ (alist-cons 'skip-safety-checks? #t result)))
(option '("share") #t #f
(lambda (opt name arg result)
@@ -1067,6 +1077,8 @@ resulting from command-line parsing."
#:derivations-only? (assoc-ref opts
'derivations-only?)
#:use-substitutes? (assoc-ref opts 'substitutes?)
+ #:skip-safety-checks?
+ (assoc-ref opts 'skip-safety-checks?)
#:file-system-type (assoc-ref opts 'file-system-type)
#:image-size (assoc-ref opts 'image-size)
#:full-boot? (assoc-ref opts 'full-boot?)
next prev parent reply other threads:[~2018-03-12 12:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 17:35 bug#30760: guix system init broken on non GuixSD Tomáš Čech
2018-03-09 22:15 ` Danny Milosavljevic
2018-03-09 22:42 ` Ludovic Courtès
2018-03-09 22:52 ` Danny Milosavljevic
2018-03-09 23:19 ` Ludovic Courtès
2018-03-10 21:42 ` Tomáš Čech
2018-03-11 16:31 ` Danny Milosavljevic
[not found] ` <20180310063219.bxgl7bgspxu2o5ez@doom>
[not found] ` <874llmuwc5.fsf@gnu.org>
2018-03-12 9:19 ` Tomáš Čech
2018-03-12 12:24 ` Danny Milosavljevic
2018-03-12 12:38 ` Danny Milosavljevic
2018-03-12 12:57 ` Ludovic Courtès [this message]
2018-03-15 10:43 ` Ludovic Courtès
2018-03-12 15:27 ` Tomáš Čech
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877eqhqwnv.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=30760@debbugs.gnu.org \
--cc=dannym@scratchpost.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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).