From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYY3z-0000kS-69 for guix-patches@gnu.org; Mon, 08 Jan 2018 09:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYY3u-0000JY-Td for guix-patches@gnu.org; Mon, 08 Jan 2018 09:06:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:59904) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYY3u-0000J9-Ov for guix-patches@gnu.org; Mon, 08 Jan 2018 09:06:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eYY3u-00071e-Cs for guix-patches@gnu.org; Mon, 08 Jan 2018 09:06:02 -0500 Subject: [bug#29922] [PATCH v2] linux-boot: Improve error reporting. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180101004231.20195-1-dannym@scratchpost.org> <20180101085647.22716-1-dannym@scratchpost.org> <87r2r0k9fd.fsf@gnu.org> <20180108121833.2a25c1d6@scratchpost.org> Date: Mon, 08 Jan 2018 15:05:36 +0100 In-Reply-To: <20180108121833.2a25c1d6@scratchpost.org> (Danny Milosavljevic's message of "Mon, 8 Jan 2018 12:18:33 +0100") Message-ID: <87po6kfntb.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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: Danny Milosavljevic Cc: 29922@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Danny Milosavljevic skribis: > I think it's better if, instead, we give the initrd (at least) a new > parameter enter-repl-on-errors?, defaulting to #t, =E2=80=98call-with-error-handling=E2=80=99 already has #:on-debug, so I fig= ured we could simply expose that: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 4dd740174..997107a67 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Court=C3= =A8s ;;; Copyright =C2=A9 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. @@ -430,7 +430,8 @@ bailing out.~%root contents: ~s~%" (scandir "/")) qemu-guest-networking? volatile-root? pre-mount - (mounts '())) + (mounts '()) + (on-error 'debug)) "This procedure is meant to be called from an initrd. Boot a system by first loading LINUX-MODULES (a list of module names) from LINUX-MODULE-DIRECTORY, then setting up QEMU guest networking if @@ -444,7 +445,10 @@ if any. MOUNTS must be a list of objects. =20 When VOLATILE-ROOT? is true, the root file system is writable but any chan= ges -to it are lost." +to it are lost. + +ON-ERROR is passed to 'call-with-error-handling'; it determines what happe= ns +upon error." (define (root-mount-point? fs) (string=3D? (file-system-mount-point fs) "/")) =20 @@ -517,6 +521,7 @@ to it are lost." (begin (display "no boot file passed via '--load'\n") (display "entering a warm and cozy REPL\n") - (start-repl))))))) + (start-repl))))) + #:on-error on-error)) =20 ;;; linux-initrd.scm ends here diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index b592defa4..0f7f4721d 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Court=C3= =A8s ;;; Copyright =C2=A9 2016 Mark H Weaver ;;; Copyright =C2=A9 2016 Jan Nieuwenhuizen ;;; Copyright =C2=A9 2017 Mathieu Othacehe @@ -155,7 +155,8 @@ MODULES and taken from LINUX." (mapped-devices '()) (helper-packages '()) qemu-networking? - volatile-root?) + volatile-root? + (on-error 'debug)) "Return a monadic derivation that builds a raw initrd, with kernel modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd, possibly in addition to the root file system specif= ied @@ -167,8 +168,12 @@ e2fsck/static or other packages needed by the initrd t= o check root partition. =20 When QEMU-NETWORKING? is true, set up networking with the standard QEMU parameters. + When VOLATILE-ROOT? is true, the root file system is writable but any chan= ges -to it are lost." +to it are lost. + +ON-ERROR is passed to 'call-with-error-handling'; it determines what happe= ns +upon error." (define device-mapping-commands ;; List of gexps to open the mapped devices. (map (lambda (md) @@ -216,7 +221,8 @@ to it are lost." #:linux-modules '#$linux-modules #:linux-module-directory '#$kodir #:qemu-guest-networking? #$qemu-networking? - #:volatile-root? '#$volatile-root?))) + #:volatile-root? '#$volatile-root? + #:on-error '#$on-error))) #:name "raw-initrd")) =20 (define* (file-system-packages file-systems #:key (volatile-root? #f)) @@ -243,7 +249,8 @@ FILE-SYSTEMS." qemu-networking? volatile-root? (virtio? #t) - (extra-modules '())) + (extra-modules '()) + (on-error 'debug)) "Return a monadic derivation that builds a generic initrd, with kernel modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd, possibly in addition to the root file system specif= ied @@ -318,6 +325,7 @@ loaded at boot time in the order in which they appear." #:mapped-devices mapped-devices #:helper-packages helper-packages #:qemu-networking? qemu-networking? - #:volatile-root? volatile-root?)) + #:volatile-root? volatile-root? + #:on-error on-error)) =20 ;;; linux-initrd.scm ends here --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I=E2=80=99ll push it if it works for you. Ludo=E2=80=99. --=-=-=--