summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2026-05-10 23:20:16 +0200
committerJanneke Nieuwenhuizen <janneke@gnu.org>2026-05-13 20:42:36 +0200
commitd6a9c314cec7d2287c7170f484dc25329d65c129 (patch)
tree85fb6010def3a00cc193cd00a70fb91213fa22bd /gnu
parentc2abb6d048a62a1ee8369f1fd2fbb03a4780760a (diff)
system: hurd: Fix fsck.
* gnu/build/hurd-boot.scm (make-hurd-device-nodes): Create "/dev/console". * gnu/system.scm (hurd-multiboot-modules): Run ext2fs.static with --readonly. * gnu/packages/hurd.scm (hurd)[arguments]: Use "fsysopts / --update --writable" and "fsck --preen --writable" and Debian's return value meme. Also substitute "/sbin/" in "sbin/fsck.c". Change-Id: I7bc3cf334939d6f1f00ee8615810338167904e8e Co-authored-by: Yelninei <yelninei@tutamail.com> Fixes: #4820
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/hurd-boot.scm21
-rw-r--r--gnu/packages/hurd.scm69
-rw-r--r--gnu/system.scm1
3 files changed, 78 insertions, 13 deletions
diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm
index afda609a184..b6f8e6154e6 100644
--- a/gnu/build/hurd-boot.scm
+++ b/gnu/build/hurd-boot.scm
@@ -80,10 +80,23 @@ Return the value associated with OPTION, or #f on failure."
80 (string-append root (if (string-suffix? "/" root) "" "/") dir)) 80 (string-append root (if (string-suffix? "/" root) "" "/") dir))
81 81
82 (mkdir-p (scope "dev")) 82 (mkdir-p (scope "dev"))
83 ;; Don't create /dev/null etc just yet; the store 83 ;; XXX: We must have `/dev/console` otherwise `console-run` tries to
84 ;; messes-up the permission bits. 84 ;; create it while the file-system is still read-only.
85 ;; Don't create /dev/console, /dev/vcs, etc.: they are created by 85 (for-each (lambda (file)
86 ;; console-run on first boot. 86 (call-with-output-file (scope file)
87 (lambda (port)
88 (display file port) ;avoid hard-linking
89 (chmod port #o666))))
90 '("dev/console"
91 ;; XXX What about vcs?
92 ;; Don't create /dev/null etc just yet; the store
93 ;; messes-up the permission bits.
94 ;; "dev/null"
95 ;; "dev/zero"
96 ;; "dev/full"
97 ;; "dev/random"
98 ;; "dev/urandom"
99 ))
87 100
88 (mkdir-p (scope "servers")) 101 (mkdir-p (scope "servers"))
89 (for-each (lambda (file) 102 (for-each (lambda (file)
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 5d1c6628090..84b35632d33 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -459,12 +459,55 @@ Hurd-minimal package which are needed for both glibc and GCC.")
459# Remove this script when Linux and the Hurd have xattr patches. 459# Remove this script when Linux and the Hurd have xattr patches.
460PATH=@PATH@ 460PATH=@PATH@
461 461
462fsck --yes --force / 462fsysopts / --update --readonly
463fsysopts / --writable
464 463
464if test -f /etc/fstab; then
465 fsck --all --preen --verbose
466else
467 echo \"No /etc/fstab found, ignoring...\"
468fi
469
470case $? in
471# Successful completion
4720)
473 fsysopts / --writable
474 ;;
475# Filesystem modified (but ok now)
4761)
477 fsysopts / --writable
478 ;;
479# Filesystem modified, filesystem should be restarted
480# Ideally we would only restart the filesystem
4812 | 3)
482 # Note: this /sbin gets substituted
483 /sbin/reboot
484 ;;
485# Fsck couldn't fix it.
4864 | 5 | 8 | 9)
487 echo \"Automatic boot failed... help!\"
488 exit 1
489 ;;
490# Signal that really interrupted something
49120 | 130 | 131)
492 echo \"Boot interrupted\"
493 exit 1
494 ;;
495# Special `let fsck finish' interruption (SIGQUIT)
49612)
497 echo \"Boot interrupted (filesystem checks complete)\"
498 exit 1
499 ;;
500# Oh dear.
501*)
502 echo \"Unknown error during fsck (exit status $?)\"
503 exit 1
504 ;;
505esac
506
507# Only after this we can run guile.
465mkdir -p /servers/socket 508mkdir -p /servers/socket
466rm -f /servers/socket/1 509rm -f /servers/socket/1
467# Note: this /hurd/ gets substituted 510# Note: this /hurd gets substituted
468settrans --create /servers/socket/1 /hurd/pflocal 511settrans --create /servers/socket/1 /hurd/pflocal
469 512
470# Upon second boot, (file-exists? /dev/null) in hurd-boot-system hangs unless: 513# Upon second boot, (file-exists? /dev/null) in hurd-boot-system hangs unless:
@@ -489,7 +532,8 @@ exec ${system}/rc \"$@\"
489 (coreutils (assoc-ref inputs "coreutils")) 532 (coreutils (assoc-ref inputs "coreutils"))
490 (sed (assoc-ref inputs "sed")) 533 (sed (assoc-ref inputs "sed"))
491 (grep (assoc-ref inputs "grep")) 534 (grep (assoc-ref inputs "grep"))
492 (util-linux (assoc-ref inputs "util-linux"))) 535 (util-linux (assoc-ref inputs "util-linux"))
536 (e2fsprogs (assoc-ref inputs "e2fsprogs")))
493 (substitute* '("daemons/runttys.c" "daemons/getty.c" "utils/login.c") 537 (substitute* '("daemons/runttys.c" "daemons/getty.c" "utils/login.c")
494 (("/bin/login") 538 (("/bin/login")
495 (string-append out "/bin/login")) 539 (string-append out "/bin/login"))
@@ -505,9 +549,13 @@ exec ${system}/rc \"$@\"
505 ;; name. 549 ;; name.
506 (substitute* '("boot/boot.c" 550 (substitute* '("boot/boot.c"
507 "daemons/console-run.c" 551 "daemons/console-run.c"
508 "startup/startup.c") 552 "startup/startup.c"
553 "sutils/swapon.c"
554 "tmpfs/tmpfs.c")
509 (("/hurd/") 555 (("/hurd/")
510 (string-append out "/hurd/"))) 556 (string-append out "/hurd/"))
557 (("/sbin/")
558 (string-append out "/sbin/")))
511 (substitute* '("libdiskfs/boot-start.c" 559 (substitute* '("libdiskfs/boot-start.c"
512 "libdiskfs/opts-std-startup.c") 560 "libdiskfs/opts-std-startup.c")
513 (("_HURD_STARTUP") 561 (("_HURD_STARTUP")
@@ -521,12 +569,15 @@ exec ${system}/rc \"$@\"
521 (string-append "PATH=" out "/bin" 569 (string-append "PATH=" out "/bin"
522 ":" out "/sbin" 570 ":" out "/sbin"
523 ":" coreutils "/bin" 571 ":" coreutils "/bin"
572 ":" e2fsprogs "/sbin"
524 ":" grep "/bin" 573 ":" grep "/bin"
525 ":" sed "/bin" 574 ":" sed "/bin"
526 ":" util-linux "/sbin\n")) 575 ":" util-linux "/sbin\n"))
527 (("/sbin/") (string-append out "/sbin/")) 576 (("/sbin/") (string-append out "/sbin/"))
528 (("/libexec/") (string-append out "/libexec/")) 577 (("/libexec/") (string-append out "/libexec/"))
529 (("/hurd/") (string-append out "/hurd/")))))) 578 (("/hurd/") (string-append out "/hurd/")))
579 (substitute* "sutils/fsck.c"
580 (("/sbin/") (in-vicinity e2fsprogs "sbin/"))))))
530 (add-after 'patch-shebangs 'patch-libexec-shebangs 581 (add-after 'patch-shebangs 'patch-libexec-shebangs
531 (lambda* (#:key inputs outputs #:allow-other-keys) 582 (lambda* (#:key inputs outputs #:allow-other-keys)
532 ;; XXX: Since the 'patch-shebangs' phase doesn't traverse 583 ;; XXX: Since the 'patch-shebangs' phase doesn't traverse
@@ -536,8 +587,7 @@ exec ${system}/rc \"$@\"
536 (path (list (string-append bash "/bin")))) 587 (path (list (string-append bash "/bin"))))
537 (for-each (lambda (file) 588 (for-each (lambda (file)
538 (patch-shebang file path)) 589 (patch-shebang file path))
539 (find-files (string-append out "/libexec"))) 590 (find-files (string-append out "/libexec"))))))
540 #t)))
541 (add-after 'build 'build-libdde-linux 591 (add-after 'build 'build-libdde-linux
542 (lambda* (#:key inputs native-inputs #:allow-other-keys) 592 (lambda* (#:key inputs native-inputs #:allow-other-keys)
543 (let ((arch ,(match (or (%current-target-system) 593 (let ((arch ,(match (or (%current-target-system)
@@ -655,6 +705,7 @@ exec ${system}/rc \"$@\"
655 ;; Tools for the /libexec/* scripts. 705 ;; Tools for the /libexec/* scripts.
656 ("bash-minimal" ,bash-minimal) 706 ("bash-minimal" ,bash-minimal)
657 ("coreutils" ,coreutils) 707 ("coreutils" ,coreutils)
708 ("e2fsprogs" ,e2fsprogs) ;for fsck.ext2
658 ("sed" ,sed) 709 ("sed" ,sed)
659 ("grep" ,grep) 710 ("grep" ,grep)
660 ("util-linux" ,util-linux "static") ;libuuid.a, for parted 711 ("util-linux" ,util-linux "static") ;libuuid.a, for parted
diff --git a/gnu/system.scm b/gnu/system.scm
index 058bd72920a..9d29cd40486 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1553,6 +1553,7 @@ a list of <menu-entry>, to populate the \"old entries\" menu."
1553 (root-file-system-command 1553 (root-file-system-command
1554 (list (file-append hurd "/hurd/ext2fs.static") 1554 (list (file-append hurd "/hurd/ext2fs.static")
1555 "ext2fs" 1555 "ext2fs"
1556 "--readonly"
1556 "--multiboot-command-line='${kernel-command-line}'" 1557 "--multiboot-command-line='${kernel-command-line}'"
1557 "--exec-server-task='${exec-task}'" 1558 "--exec-server-task='${exec-task}'"
1558 "--store-type=typed" 1559 "--store-type=typed"