From 1cb9effc3e875ec7bae31bb06069d16ac89f7e1d Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 22 Jun 2020 16:14:01 +0200 Subject: system: image: Remove "image-root" derivation when building ISO. The "image-root" derivation output is used as a temporary directory that is passed to GNU Xorriso later on. By merging the creation of this directory and the production of an ISO image, we can get rid of the derivation. * gnu/system/image.scm (system-iso9660-image): Merge "image-root" and "iso9660-image" derivations so that we spare an extra derivation. --- gnu/system/image.scm | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 26ffa028fed..9f210d9f0f6 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -388,33 +388,31 @@ used in the image. " (graph (match inputs (((names . _) ...) names))) - (root-builder - (with-imported-modules* - (sql-schema #$schema) - - ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be decoded. - (setenv "GUIX_LOCPATH" - #+(file-append glibc-utf8-locales "/lib/locale")) - (setlocale LC_ALL "en_US.utf8") - - (initialize-root-partition #$output - #:references-graphs '#$graph - #:deduplicate? #f - #:system-directory #$os))) - (image-root - (computed-file "image-root" root-builder - #:options `(#:references-graphs ,inputs))) (builder (with-imported-modules* (let* ((inputs '#$(list parted e2fsprogs dosfstools xorriso - sed grep coreutils findutils gawk))) + sed grep coreutils findutils gawk)) + (image-root "tmp-root")) + (sql-schema #$schema) + + ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be decoded. + (setenv "GUIX_LOCPATH" + #+(file-append glibc-utf8-locales "/lib/locale")) + + (setlocale LC_ALL "en_US.utf8") + (set-path-environment-variable "PATH" '("bin" "sbin") inputs) + + (initialize-root-partition image-root + #:references-graphs '#$graph + #:deduplicate? #f + #:system-directory #$os) (make-iso9660-image #$xorriso '#$grub-mkrescue-environment #$bootloader #$bootcfg #$os - #$image-root + image-root #$output #:references-graphs '#$graph #:register-closures? #$register-closures? -- cgit v1.3 From 7f75a7ec08975eb6d6e01db61bd6b91f447f655e Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 22 Jun 2020 17:40:10 +0200 Subject: system: image: Remove "image-root" when building raw disk-images. The "image-root" derivation output is used as a temporary directory that is passed to mke2fs and mkdosfs later on. By merging the creation of this directory and the production of partition images, we can get rid of the derivation. As mke2fs and mkdosfs are not able to override file permissions, call those commands with fakeroot. This way, all the image files will be owned by root, even if image generation is done in an unprivilegded context. * gnu/system/image.scm (system-disk-image): Merge "image-root" and "iso9660-image" derivations so that we spare an extra derivation. Also add "fakeroot" and its runtime dependencies to the inputs. * gnu/build/image.scm (make-ext-image, make-vfat-image): Make sure that mke2fs and mkdosfs are respectively called by fakeroot. --- gnu/build/image.scm | 5 +++-- gnu/system/image.scm | 27 +++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'gnu/system') diff --git a/gnu/build/image.scm b/gnu/build/image.scm index e8df5866a7c..e7b0418182b 100644 --- a/gnu/build/image.scm +++ b/gnu/build/image.scm @@ -77,7 +77,7 @@ take the partition metadata size into account, take a 25% margin." (uuid (partition-uuid partition)) (journal-options "lazy_itable_init=1,lazy_journal_init=1")) (apply invoke - `("mke2fs" "-t" ,fs "-d" ,root + `("fakeroot" "mke2fs" "-t" ,fs "-d" ,root "-L" ,label "-U" ,(uuid->string uuid) "-E" ,(format #f "root_owner=~a:~a,~a" owner-uid owner-gid journal-options) @@ -93,7 +93,8 @@ take the partition metadata size into account, take a 25% margin." "Handle the creation of VFAT partition images. See 'make-partition-image'." (let ((size (partition-size partition)) (label (partition-label partition))) - (invoke "mkdosfs" "-n" label "-C" target "-F" "16" "-S" "1024" + (invoke "fakeroot" "mkdosfs" "-n" label "-C" target + "-F" "16" "-S" "1024" (size-in-kib (if (eq? size 'guess) (estimate-partition-size root) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 9f210d9f0f6..43217ddf865 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -255,18 +255,24 @@ used in the image." (graph (match inputs (((names . _) ...) names))) - (root-builder + (type (partition-file-system partition)) + (image-builder (with-imported-modules* - (let* ((initializer #$(partition-initializer partition))) + (let ((initializer #$(partition-initializer partition)) + (inputs '#+(list e2fsprogs fakeroot dosfstools mtools + sed coreutils)) + (image-root "tmp-root")) (sql-schema #$schema) + (set-path-environment-variable "PATH" '("bin" "sbin") inputs) + ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be ;; decoded. (setenv "GUIX_LOCPATH" #+(file-append glibc-utf8-locales "/lib/locale")) (setlocale LC_ALL "en_US.utf8") - (initializer #$output + (initializer image-root #:references-graphs '#$graph #:deduplicate? #f #:system-directory #$os @@ -277,19 +283,12 @@ used in the image." #+(bootloader-installer bootloader) #:bootcfg #$bootcfg #:bootcfg-location - #$(bootloader-configuration-file bootloader))))) - (image-root - (computed-file "partition-image-root" root-builder - #:options `(#:references-graphs ,inputs))) - (type (partition-file-system partition)) - (image-builder - (with-imported-modules* - (let ((inputs '#+(list e2fsprogs dosfstools mtools))) - (set-path-environment-variable "PATH" '("bin" "sbin") inputs) + #$(bootloader-configuration-file bootloader)) (make-partition-image #$(partition->gexp partition) #$output - #$image-root))))) - (computed-file "partition.img" image-builder))) + image-root))))) + (computed-file "partition.img" image-builder + #:options `(#:references-graphs ,inputs)))) (define (partition->config partition) ;; Return the genimage partition configuration for PARTITION. -- cgit v1.3 From fd45ecb571be291e3f703dd4b0d99ce8a45d6ef8 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 23 Jun 2020 09:51:20 +0200 Subject: system: image: Remove fakeroot dependencies. Since c29bb909d241e7215e574e93d9799e701cbc6ddb, fakeroot "sed" and "coreutils" dependencies are now explicit. * gnu/system/image.scm (system-disk-image): Remove "sed" and "coreutils" from inputs. --- gnu/system/image.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 43217ddf865..3904c2a17d2 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -259,8 +259,7 @@ used in the image." (image-builder (with-imported-modules* (let ((initializer #$(partition-initializer partition)) - (inputs '#+(list e2fsprogs fakeroot dosfstools mtools - sed coreutils)) + (inputs '#+(list e2fsprogs fakeroot dosfstools mtools)) (image-root "tmp-root")) (sql-schema #$schema) -- cgit v1.3 From b904b59ce592c89dfb4675a8c06757afed6738a0 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 13 Jun 2020 17:33:10 +0200 Subject: image: Move hurd image definition to a dedicated file. This moves hurd-disk-image to a dedicated file. It also defines a default operating-system so that the image can be built standalone. * gnu/system/images/hurd.scm: New file, * gnu/local.mk (GNU_SYSTEM_MODULES): add it, * gnu/system/image.scm (root-offset, root-label): Export it, (hurd-disk-image): remove it as this is now defined in the new, Hurd dedicated file above, (find-image): adapt to avoid loop dependency. --- gnu/image.scm | 2 ++ gnu/local.mk | 2 ++ gnu/system/image.scm | 23 ++++---------- gnu/system/images/hurd.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 gnu/system/images/hurd.scm (limited to 'gnu/system') diff --git a/gnu/image.scm b/gnu/image.scm index 19b466527bc..dc66f2c5337 100644 --- a/gnu/image.scm +++ b/gnu/image.scm @@ -67,6 +67,8 @@ (define-record-type* image make-image image? + (name image-name ;symbol + (default #f)) (format image-format) ;symbol (target image-target (default #f)) diff --git a/gnu/local.mk b/gnu/local.mk index cf2be076afe..a3215757993 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -632,6 +632,8 @@ GNU_SYSTEM_MODULES = \ %D%/system/uuid.scm \ %D%/system/vm.scm \ \ + %D%/system/images/hurd.scm \ + \ %D%/machine.scm \ %D%/machine/digital-ocean.scm \ %D%/machine/ssh.scm \ diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 3904c2a17d2..90163e68dae 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -53,10 +53,12 @@ #:use-module (srfi srfi-35) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) - #:export (esp-partition + #:export (root-offset + root-label + + esp-partition root-partition - hurd-disk-image efi-disk-image iso9660-image @@ -101,20 +103,6 @@ (list #:make-device-nodes make-hurd-device-nodes))))) -(define hurd-disk-image - (image - (format 'disk-image) - (target "i586-pc-gnu") - (partitions - (list (partition - (size 'guess) - (offset root-offset) - (label root-label) - (file-system "ext2") - (file-system-options '("-o" "hurd" "-O" "ext_attr")) - (flags '(boot)) - (initializer hurd-initialize-root-partition)))))) - (define efi-disk-image (image (format 'disk-image) @@ -565,7 +553,8 @@ addition of the record." (_ (cond ((and target (hurd-triplet? target)) - hurd-disk-image) + (module-ref (resolve-interface '(gnu system images hurd)) + 'hurd-disk-image)) (else efi-disk-image))))) diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm new file mode 100644 index 00000000000..4417f03cc87 --- /dev/null +++ b/gnu/system/images/hurd.scm @@ -0,0 +1,76 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2020 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu system images hurd) + #:use-module (guix gexp) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu image) + #:use-module (gnu packages ssh) + #:use-module (gnu services) + #:use-module (gnu services ssh) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system hurd) + #:use-module (gnu system image) + #:export (hurd-barebones-os + hurd-disk-image + hurd-barebones-disk-image)) + +(define hurd-barebones-os + (operating-system + (inherit %hurd-default-operating-system) + (bootloader (bootloader-configuration + (bootloader grub-minimal-bootloader) + (target "/dev/sdX"))) + (file-systems (cons (file-system + (device (file-system-label "my-root")) + (mount-point "/") + (type "ext2")) + %base-file-systems)) + (host-name "guixygnu") + (timezone "Europe/Amsterdam") + (packages (cons openssh-sans-x %base-packages/hurd)) + (services (cons (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (use-pam? #f) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t))) + %base-services/hurd)))) + +(define hurd-disk-image + (image + (format 'disk-image) + (target "i586-pc-gnu") + (partitions + (list (partition + (size 'guess) + (offset root-offset) + (label root-label) + (file-system "ext2") + (flags '(boot)) + (initializer (gexp initialize-root-partition))))))) + +(define hurd-barebones-disk-image + (image + (inherit hurd-disk-image) + (name 'hurd-barebones-disk-image) + (operating-system hurd-barebones-os))) -- cgit v1.3 From f56144e18a1acc953a4e9a9bd7f43a413bf577c9 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Wed, 24 Jun 2020 20:50:42 +0200 Subject: system: image: Enable compression on ISO9660 images. ISO9660 image compression was temporarily disabled to speed-up tests of the new image API. Enable it again. * gnu/system/image.scm (iso9660-image)[compression]: Enable it. --- gnu/system/image.scm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 90163e68dae..bb73aea65a2 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -115,9 +115,7 @@ (list (partition (size 'guess) (label "GUIX_IMAGE") - (flags '(boot))))) - ;; XXX: Temporarily disable compression to speed-up the tests. - (compression? #f))) + (flags '(boot))))))) ;; -- cgit v1.3 From db170ee9210431cdbb3716a6b9a26ca5b6d931ee Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 24 Jun 2020 10:47:23 +0200 Subject: services: Add missing (ice-9 format) import. These issues were reported by -Wformat, though they were harmless in practice because importing (ice-9 format) changes the global 'format' binding currently. * gnu/services/nix.scm: Import (ice-9 format). * gnu/services/web.scm: Likewise. * gnu/system/mapped-devices.scm: Likewise. --- gnu/services/nix.scm | 1 + gnu/services/web.scm | 3 ++- gnu/system/mapped-devices.scm | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/services/nix.scm b/gnu/services/nix.scm index dfe33991d03..3c0065207dc 100644 --- a/gnu/services/nix.scm +++ b/gnu/services/nix.scm @@ -31,6 +31,7 @@ #:use-module (guix store) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (ice-9 format) #:export (nix-service-type)) ;;; Commentary: diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 9fcfe8a0dc8..63d2324b918 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson -;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2016 Nikita ;;; Copyright © 2016, 2017, 2018 Julien Lepiller ;;; Copyright © 2017 Christopher Baines @@ -57,6 +57,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:export ( httpd-configuration httpd-configuration? diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 7c58f876a37..c3f98302ad7 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2016 Andreas Enge ;;; Copyright © 2017, 2018 Mark H Weaver ;;; @@ -40,6 +40,7 @@ #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (ice-9 match) + #:use-module (ice-9 format) #:export (mapped-device mapped-device? mapped-device-source -- cgit v1.3 From fd932862ac4b464bd2642be114f73ee39c1ad64f Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 25 Jun 2020 18:54:42 +0200 Subject: image: hurd: Create hurd-compatible ext2 file-system. This is a follow-up to commit b904b59ce592c89dfb4675a8c06757afed6738a0. * gnu/system/images/hurd.scm (hurd-disk-image): Add file-system-options to create an ext2 file-system that is compatible with the Hurd. --- gnu/system/images/hurd.scm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm index 4417f03cc87..e5e120d49c0 100644 --- a/gnu/system/images/hurd.scm +++ b/gnu/system/images/hurd.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020 Mathieu Othacehe +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -66,6 +67,7 @@ (offset root-offset) (label root-label) (file-system "ext2") + (file-system-options '("-o" "hurd" "-O" "ext_attr")) (flags '(boot)) (initializer (gexp initialize-root-partition))))))) -- cgit v1.3 From 2463a78d17673581978debff6c6c9fce7966980a Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 25 Jun 2020 21:47:51 +0200 Subject: image: hurd: Initialize root partition for the Hurd. This is a follow-up to commit b904b59ce592c89dfb4675a8c06757afed6738a0. * gnu/system/image.scm (hurd-initialize-root-partition): Move to ... * gnu/system/images/hurd.scm (hurd-initialize-root-partition): ... here. (hurd-disk-image): Use it. --- gnu/system/image.scm | 7 ------- gnu/system/images/hurd.scm | 9 ++++++++- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index bb73aea65a2..a4cc2d1ef95 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -96,13 +96,6 @@ (flags '(boot)) (initializer (gexp initialize-root-partition)))) -(define hurd-initialize-root-partition - #~(lambda* (#:rest args) - (apply initialize-root-partition - (append args - (list #:make-device-nodes - make-hurd-device-nodes))))) - (define efi-disk-image (image (format 'disk-image) diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm index e5e120d49c0..31942e7386c 100644 --- a/gnu/system/images/hurd.scm +++ b/gnu/system/images/hurd.scm @@ -57,6 +57,13 @@ (password-authentication? #t))) %base-services/hurd)))) +(define hurd-initialize-root-partition + #~(lambda* (#:rest args) + (apply initialize-root-partition + (append args + (list #:make-device-nodes + make-hurd-device-nodes))))) + (define hurd-disk-image (image (format 'disk-image) @@ -69,7 +76,7 @@ (file-system "ext2") (file-system-options '("-o" "hurd" "-O" "ext_attr")) (flags '(boot)) - (initializer (gexp initialize-root-partition))))))) + (initializer hurd-initialize-root-partition)))))) (define hurd-barebones-disk-image (image -- cgit v1.3 From 5980ec8ada5ede54bde6558c7ab8bf492bc70f85 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 26 Jun 2020 09:04:43 +0200 Subject: system: image: Use the image name as the disk-image derivation name. * gnu/system/image.scm (system-disk-image): Use the image name as disk-image derivation name, if defined. Otherwise use the generic "disk-image" name. --- gnu/system/image.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index a4cc2d1ef95..7efbc9fac0e 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -301,7 +301,8 @@ image ~a { }~%" #$genimage-name #$image-type (list #$@partitions-config)))))))) (computed-file "genimage.cfg" builder))) - (let* ((substitutable? (image-substitutable? image)) + (let* ((name (or (image-name image) name)) + (substitutable? (image-substitutable? image)) (builder (with-imported-modules* (let ((inputs '#+(list genimage coreutils findutils)) -- cgit v1.3 From f27bec107e3fd212feccabbfbb3c37887cf0ad7b Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 26 Jun 2020 10:05:58 +0200 Subject: system: image: Fix disk-image name. This is a follow-up of 5980ec8ada5ede54bde6558c7ab8bf492bc70f85. * gnu/system/image.scm (system-disk-image): When using the image name, convert it to string first. --- gnu/system/image.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 7efbc9fac0e..36f56e237d5 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -301,7 +301,10 @@ image ~a { }~%" #$genimage-name #$image-type (list #$@partitions-config)))))))) (computed-file "genimage.cfg" builder))) - (let* ((name (or (image-name image) name)) + (let* ((image-name (image-name image)) + (name (if image-name + (symbol->string image-name) + name)) (substitutable? (image-substitutable? image)) (builder (with-imported-modules* -- cgit v1.3 From 5164d7fd2673cf3b46b2cba9a9a70abc6d57dde6 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Tue, 30 Jun 2020 18:16:10 +0200 Subject: system: hurd: Oops, have 'initrd' default to #f. * gnu/system/hurd.scm (%hurd-default-operating-system)[initrd]: Oops, set to #f. --- gnu/system/hurd.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm index 43d98cc8c24..80fffe8e45a 100644 --- a/gnu/system/hurd.scm +++ b/gnu/system/hurd.scm @@ -94,7 +94,7 @@ (bootloader (bootloader-configuration (bootloader grub-minimal-bootloader) (target "/dev/vda"))) - (initrd (lambda _ '())) + (initrd #f) (initrd-modules (lambda _ '())) (firmware '()) (host-name "guixygnu") -- cgit v1.3 From 4b9eecd322e566783369795ebea63a479b51f486 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Fri, 3 Jul 2020 23:45:20 +0200 Subject: image: Do not set journal_model=WAL for the Hurd. This fixes . * gnu/system/images/hurd.scm (hurd-initialize-root-partition): Use #:wal-mode #f in call to ... * gnu/build/image.scm (initialize-root-partition): ... this, add #:wal-mode? parameter, pass it to ... (register-closure): ... this, add #:wal-mode? parameter, pass it to ... * guix/store/database.scm (with-database): ... this, add #:wal-mode? parameter, pass it to ... (call-with-database): ... this, add #:wal-mode? parameter; when set to #f, do not set journal_model=WAL. --- gnu/build/image.scm | 26 ++++++++++++++++---------- gnu/system/images/hurd.scm | 8 ++++++-- guix/store/database.scm | 29 ++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 21 deletions(-) (limited to 'gnu/system') diff --git a/gnu/build/image.scm b/gnu/build/image.scm index e7b0418182b..d8efa73f16b 100644 --- a/gnu/build/image.scm +++ b/gnu/build/image.scm @@ -131,20 +131,23 @@ given CONFIG file." (define* (register-closure prefix closure #:key (deduplicate? #t) (reset-timestamps? #t) - (schema (sql-schema))) + (schema (sql-schema)) + (wal-mode? #t)) "Register CLOSURE in PREFIX, where PREFIX is the directory name of the target store and CLOSURE is the name of a file containing a reference graph as produced by #:references-graphs.. As a side effect, if RESET-TIMESTAMPS? is true, reset timestamps on store files and, if DEDUPLICATE? is true, -deduplicates files common to CLOSURE and the rest of PREFIX." +deduplicates files common to CLOSURE and the rest of PREFIX. Pass WAL-MODE? +to call-with-database." (let ((items (call-with-input-file closure read-reference-graph))) (parameterize ((sql-schema schema)) (with-database (store-database-file #:prefix prefix) db - (register-items db items - #:prefix prefix - #:deduplicate? deduplicate? - #:reset-timestamps? reset-timestamps? - #:registration-time %epoch))))) + #:wal-mode? wal-mode? + (register-items db items + #:prefix prefix + #:deduplicate? deduplicate? + #:reset-timestamps? reset-timestamps? + #:registration-time %epoch))))) (define* (initialize-efi-partition root #:key @@ -164,14 +167,16 @@ deduplicates files common to CLOSURE and the rest of PREFIX." (register-closures? #t) system-directory make-device-nodes + (wal-mode? #t) #:allow-other-keys) "Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to install the bootloader configuration. If REGISTER-CLOSURES? is true, register REFERENCES-GRAPHS in the store. If DEDUPLICATE? is true, then also deduplicate files common to CLOSURES and the -rest of the store when registering the closures. SYSTEM-DIRECTORY is the name -of the directory of the 'system' derivation." +rest of the store when registering the closures. SYSTEM-DIRECTORY is the name +of the directory of the 'system' derivation. Pass WAL-MODE? to +register-closure." (populate-root-file-system system-directory root) (populate-store references-graphs root) @@ -184,7 +189,8 @@ of the directory of the 'system' derivation." (register-closure root closure #:reset-timestamps? #t - #:deduplicate? deduplicate?)) + #:deduplicate? deduplicate? + #:wal-mode? wal-mode?)) references-graphs)) (when bootloader-installer diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm index 31942e7386c..d87640e8e35 100644 --- a/gnu/system/images/hurd.scm +++ b/gnu/system/images/hurd.scm @@ -61,8 +61,12 @@ #~(lambda* (#:rest args) (apply initialize-root-partition (append args - (list #:make-device-nodes - make-hurd-device-nodes))))) + (list #:make-device-nodes make-hurd-device-nodes + ;; XXX Creating a db.sqlite with journal_mode=WAL + ;; yields "unable to open database file" on GNU/Hurd + ;; for an sqlite with the hurd-locking-mode.patch; + ;; see . + #:wal-mode? #f))))) (define hurd-disk-image (image diff --git a/guix/store/database.scm b/guix/store/database.scm index a38e4d7e525..50b66ce282b 100644 --- a/guix/store/database.scm +++ b/guix/store/database.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2019 Caleb Ristvedt ;;; Copyright © 2018, 2020 Ludovic Courtès +;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +21,7 @@ (define-module (guix store database) #:use-module (sqlite3) #:use-module (guix config) + #:use-module (guix gexp) #:use-module (guix serialization) #:use-module (guix store deduplication) #:use-module (guix base16) @@ -27,6 +29,7 @@ #:use-module (guix build syscalls) #:use-module ((guix build utils) #:select (mkdir-p executable-file?)) + #:use-module (guix utils) #:use-module (guix build store-copy) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -97,17 +100,20 @@ as specified by SQL-SCHEMA." (sqlite-exec db (call-with-input-file schema get-string-all))) -(define (call-with-database file proc) +(define* (call-with-database file proc #:key (wal-mode? #t)) "Pass PROC a database record corresponding to FILE. If FILE doesn't exist, -create it and initialize it as a new database." +create it and initialize it as a new database. Unless WAL-MODE? is set to #f, +set journal_mode=WAL." (let ((new? (and (not (file-exists? file)) (begin (mkdir-p (dirname file)) #t))) (db (sqlite-open file))) - ;; Turn DB in "write-ahead log" mode, which should avoid SQLITE_LOCKED - ;; errors when we have several readers: . - (sqlite-exec db "PRAGMA journal_mode=WAL;") + ;; Using WAL breaks for the Hurd . + (when wal-mode? + ;; Turn DB in "write-ahead log" mode, which should avoid SQLITE_LOCKED + ;; errors when we have several readers: . + (sqlite-exec db "PRAGMA journal_mode=WAL;")) ;; Install a busy handler such that, when the database is locked, sqlite ;; retries until 30 seconds have passed, at which point it gives up and @@ -200,10 +206,15 @@ prior to returning." ;; Default location of the store database. (string-append %store-database-directory "/db.sqlite")) -(define-syntax-rule (with-database file db exp ...) - "Open DB from FILE and close it when the dynamic extent of EXP... is left. -If FILE doesn't exist, create it and initialize it as a new database." - (call-with-database file (lambda (db) exp ...))) +(define-syntax with-database + (syntax-rules () + "Open DB from FILE and close it when the dynamic extent of EXP... is left. +If FILE doesn't exist, create it and initialize it as a new database. Pass +#:wal-mode? to call-with-database." + ((_ file db #:wal-mode? wal-mode? exp ...) + (call-with-database file (lambda (db) exp ...) #:wal-mode? wal-mode?)) + ((_ file db exp ...) + (call-with-database file (lambda (db) exp ...))))) (define (sqlite-finalize stmt) ;; As of guile-sqlite3 0.1.0, cached statements aren't reset when -- cgit v1.3 From 1abf205d11c8b941d7d89855cb55a9cfde078838 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 11 Jul 2020 23:27:56 +0200 Subject: Revert "vm: Use virtio network driver." This allows users to specify network interface settings with 'guix system vm' without having to create a new NIC. Fixes . Reported by Christopher Lemmer Webber . This reverts commit 5379392731b52eef22b4936637eb592b93e04318. --- gnu/system/vm.scm | 1 - 1 file changed, 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index f2b6b71b4d8..861f2a427aa 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -819,7 +819,6 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." '()) "-no-reboot" - "-nic" "user,model=virtio-net-pci" "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" "-device" "virtio-rng-pci,rng=guixsd-vm-rng" -- cgit v1.3