summaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorRutherther <rutherther@ditigal.xyz>2026-02-04 19:19:19 +0100
committerMaxim Cournoyer <maxim@guixotic.coop>2026-02-23 11:46:09 +0900
commite3d8fc1147d03b6e6a47f8f1976068ad0faec9ab (patch)
tree8bcde4a5676f5a83d3dee9dc2d3da68ef0c5e0f1 /gnu/tests
parentd45da4a5e932aba8d59e08e29ff3db2a3c2179c3 (diff)
file-systems: mount-file-system: Guard against missing devices.
When a device with a UUID is missing, canonicalize-device-spec will throw an error. This error is not handled for mount-may-fail? devices. That means that if you use UUID device and it isn't available, the boot will hang on the user-file-systems not being started. All user services depend on that service. Also added a test for this behavior. * gnu/build/file-systems.scm (mount-file-system): Guard canonicalize-device-spec call. (canonicalize-device-spec): Throw &partition-lookup-error on missing partition. (&partition-lookup-error): New variable. * gnu/tests/base.scm (%test-missing-file-system): New variable. Change-Id: I3b8d652251cef421cff6d2fdafb8d9d7d1fc74b5 Reported-By: renbus, on IRC Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/base.scm54
1 files changed, 53 insertions, 1 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 86fa6374efc..403aa20cfff 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -24,7 +24,8 @@
#:use-module (gnu tests)
#:use-module (gnu image)
#:use-module (gnu system)
- #:autoload (gnu system image) (system-image)
+ #:use-module (gnu system file-systems)
+ #:autoload (gnu system image) (system-image qcow2-image-type)
#:use-module (gnu system privilege)
#:use-module (gnu system shadow)
#:use-module (gnu system vm)
@@ -61,6 +62,8 @@
%test-cleanup
%test-activation
+ %test-missing-file-system
+
%hello-dependencies-manifest
guix-daemon-test-cases
%test-guix-daemon
@@ -1357,3 +1360,52 @@ runs unprivileged.")
#:imported-modules '((gnu services herd)
(guix combinators)))))
(run-guix-daemon-test os "guix-daemon-unprivileged-test")))))
+
+(define %test-missing-file-system
+ (system-test
+ (name "missing-file-system")
+ (description
+ "Test that boot does not fail when a file system that might fail
+is specified and isn't provided by any device.")
+ (value
+ (let* ((os (marionette-operating-system
+ (operating-system
+ (inherit %simple-os)
+ (kernel-arguments (list "console=ttyS0,115200"))
+ (file-systems
+ (cons* (file-system
+ (device (uuid "abcdef12-3456-7890-abcd-ef1234567890"))
+ (mount-point "/somewhere/1")
+ (mount? #t)
+ (mount-may-fail? #t)
+ (type "ext4"))
+ (file-system
+ (device (file-system-label "missing-fs"))
+ (mount-point "/somewhere/2")
+ (mount? #t)
+ (mount-may-fail? #t)
+ (type "ext4"))
+ (file-system
+ (device "/dev/missing")
+ (mount-point "/somewhere/3")
+ (mount? #t)
+ (mount-may-fail? #t)
+ (type "ext4"))
+ (file-system
+ (device (file-system-label "my-root"))
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems)))
+ #:imported-modules '((gnu services herd)
+ (guix combinators))))
+ (image (system-image (os->image os #:type qcow2-image-type)))
+ (command
+ #~`(,(string-append #$qemu-minimal "/bin/" (qemu-command))
+ ,@(if (file-exists? "/dev/kvm")
+ '("-enable-kvm")
+ '())
+ "-m" "1024" ;memory size, in MiB
+ "-serial" "stdio"
+ "-snapshot" ;for volatile root, writable overlay
+ "-drive" ,(format #f "file=~a,if=virtio" #$image))))
+ (run-basic-test os command name)))))