From 61b94b8c32e23d83f805ad349060c56b165ea401 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Jan 2018 15:06:36 +0100 Subject: vm: 'vm-image' images refer to the root file system by UUID. This avoids the hard-coded "/dev/sda1", which only made sense when the image is run with "qemu-system-x86_64 -hda", not when it's passed to Xen, etc. Reported by Andreas Enge . * gnu/system/vm.scm (system-qemu-image): Define 'root-uuid', use it as the 'device' field for "/", and pass it to 'qemu-image'. --- gnu/system/vm.scm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 53629daa90..496f2ac4e1 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2016 Christopher Allan Webber ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2017 Mathieu Othacehe @@ -503,6 +503,14 @@ (define file-systems-to-keep (string-prefix? "/dev/" source)))) (operating-system-file-systems os))) + (define root-uuid + ;; UUID of the root file system. + (operating-system-uuid os + (if (string=? file-system-type "iso9660") + 'iso9660 + 'dce))) + + (let ((os (operating-system (inherit os) ;; Use an initrd with the whole QEMU shebang. (initrd (lambda (file-systems . rest) @@ -511,10 +519,13 @@ (define file-systems-to-keep #:virtio? #t rest))) - ;; Force our own root file system. + ;; Force our own root file system. Refer to it by UUID so that + ;; it works regardless of how the image is used ("qemu -hda", + ;; Xen, etc.). (file-systems (cons (file-system (mount-point "/") - (device "/dev/sda1") + (device root-uuid) + (title 'uuid) (type file-system-type)) file-systems-to-keep))))) (mlet* %store-monad @@ -526,6 +537,7 @@ (define file-systems-to-keep (operating-system-bootloader os)) #:disk-image-size disk-image-size #:file-system-type file-system-type + #:file-system-uuid root-uuid #:inputs `(("system" ,os-drv) ("bootcfg" ,bootcfg)) #:copy-inputs? #t)))) -- cgit v1.2.3 From aeed74f3709446e94a87809ddd465517738921e0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 8 Jan 2018 23:10:21 +0100 Subject: linux-boot: Add #:on-error for initrd error handling. Suggested by Danny Milosavljevic in . * gnu/build/linux-boot.scm (boot-system): Add #:on-error parameter and pass it to 'call-with-error-handling'. * gnu/system/linux-initrd.scm (raw-initrd): Add #:on-error and pass it. (base-initrd): Likewise. --- gnu/build/linux-boot.scm | 13 +++++++++---- gnu/system/linux-initrd.scm | 20 ++++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) (limited to 'gnu/system') diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 4dd740174e..997107a67a 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 © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. @@ -430,7 +430,8 @@ (define* (boot-system #:key 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 @@ (define* (boot-system #:key MOUNTS must be a list of objects. When VOLATILE-ROOT? is true, the root file system is writable but any changes -to it are lost." +to it are lost. + +ON-ERROR is passed to 'call-with-error-handling'; it determines what happens +upon error." (define (root-mount-point? fs) (string=? (file-system-mount-point fs) "/")) @@ -517,6 +521,7 @@ (define (lookup-module name) (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)) ;;; linux-initrd.scm ends here diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index b592defa45..0f7f4721dd 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 © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2016 Mark H Weaver ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2017 Mathieu Othacehe @@ -155,7 +155,8 @@ (define* (raw-initrd file-systems (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 specified @@ -167,8 +168,12 @@ (define* (raw-initrd file-systems 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 changes -to it are lost." +to it are lost. + +ON-ERROR is passed to 'call-with-error-handling'; it determines what happens +upon error." (define device-mapping-commands ;; List of gexps to open the mapped devices. (map (lambda (md) @@ -216,7 +221,8 @@ (define kodir #: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")) (define* (file-system-packages file-systems #:key (volatile-root? #f)) @@ -243,7 +249,8 @@ (define* (base-initrd 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 specified @@ -318,6 +325,7 @@ (define helper-packages #:mapped-devices mapped-devices #:helper-packages helper-packages #:qemu-networking? qemu-networking? - #:volatile-root? volatile-root?)) + #:volatile-root? volatile-root? + #:on-error on-error)) ;;; linux-initrd.scm ends here -- cgit v1.2.3 From b0de7fdba678c1b0ec27b9c8e37c81fb5d49a124 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 9 Jan 2018 17:19:53 +0100 Subject: system: Extend .gdbinit to authorize extensions from /gnu/store/*/lib. * gnu/system/shadow.scm (default-skeletons)["gdbinit"]: Add 'auto-load safe-path' statement. --- gnu/system/shadow.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index b66239787e..2b8412cdd5 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2016 Alex Griffin ;;; ;;; This file is part of GNU Guix. @@ -187,7 +187,11 @@ (define copy-guile-wm XTerm*metaSendsEscape: true\n")) (gdbinit (plain-file "gdbinit" "\ # Tell GDB where to look for separate debugging files. -set debug-file-directory ~/.guix-profile/lib/debug\n"))) +set debug-file-directory ~/.guix-profile/lib/debug + +# Authorize extensions found in the store, such as the +# pretty-printers of libstdc++. +set auto-load safe-path /gnu/store/*/lib\n"))) `((".bash_profile" ,profile) (".bashrc" ,bashrc) (".zlogin" ,zlogin) -- cgit v1.2.3