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 @@
24 #:use-module (gnu tests) 24 #:use-module (gnu tests)
25 #:use-module (gnu image) 25 #:use-module (gnu image)
26 #:use-module (gnu system) 26 #:use-module (gnu system)
27 #:autoload (gnu system image) (system-image) 27 #:use-module (gnu system file-systems)
28 #:autoload (gnu system image) (system-image qcow2-image-type)
28 #:use-module (gnu system privilege) 29 #:use-module (gnu system privilege)
29 #:use-module (gnu system shadow) 30 #:use-module (gnu system shadow)
30 #:use-module (gnu system vm) 31 #:use-module (gnu system vm)
@@ -61,6 +62,8 @@
61 %test-cleanup 62 %test-cleanup
62 %test-activation 63 %test-activation
63 64
65 %test-missing-file-system
66
64 %hello-dependencies-manifest 67 %hello-dependencies-manifest
65 guix-daemon-test-cases 68 guix-daemon-test-cases
66 %test-guix-daemon 69 %test-guix-daemon
@@ -1357,3 +1360,52 @@ runs unprivileged.")
1357 #:imported-modules '((gnu services herd) 1360 #:imported-modules '((gnu services herd)
1358 (guix combinators))))) 1361 (guix combinators)))))
1359 (run-guix-daemon-test os "guix-daemon-unprivileged-test"))))) 1362 (run-guix-daemon-test os "guix-daemon-unprivileged-test")))))
1363
1364(define %test-missing-file-system
1365 (system-test
1366 (name "missing-file-system")
1367 (description
1368 "Test that boot does not fail when a file system that might fail
1369is specified and isn't provided by any device.")
1370 (value
1371 (let* ((os (marionette-operating-system
1372 (operating-system
1373 (inherit %simple-os)
1374 (kernel-arguments (list "console=ttyS0,115200"))
1375 (file-systems
1376 (cons* (file-system
1377 (device (uuid "abcdef12-3456-7890-abcd-ef1234567890"))
1378 (mount-point "/somewhere/1")
1379 (mount? #t)
1380 (mount-may-fail? #t)
1381 (type "ext4"))
1382 (file-system
1383 (device (file-system-label "missing-fs"))
1384 (mount-point "/somewhere/2")
1385 (mount? #t)
1386 (mount-may-fail? #t)
1387 (type "ext4"))
1388 (file-system
1389 (device "/dev/missing")
1390 (mount-point "/somewhere/3")
1391 (mount? #t)
1392 (mount-may-fail? #t)
1393 (type "ext4"))
1394 (file-system
1395 (device (file-system-label "my-root"))
1396 (mount-point "/")
1397 (type "ext4"))
1398 %base-file-systems)))
1399 #:imported-modules '((gnu services herd)
1400 (guix combinators))))
1401 (image (system-image (os->image os #:type qcow2-image-type)))
1402 (command
1403 #~`(,(string-append #$qemu-minimal "/bin/" (qemu-command))
1404 ,@(if (file-exists? "/dev/kvm")
1405 '("-enable-kvm")
1406 '())
1407 "-m" "1024" ;memory size, in MiB
1408 "-serial" "stdio"
1409 "-snapshot" ;for volatile root, writable overlay
1410 "-drive" ,(format #f "file=~a,if=virtio" #$image))))
1411 (run-basic-test os command name)))))