Danny Milosavljevic <dan...@friendly-machines.com> writes: > The more I think about it the more it seems we should re-enter our > initramfs on shutdown. Unfortunately, the Linux kernel frees it when > switching to the real root fs. Not sure how to get Linux to find it again > (or how to get Linux to not free it in the first place) and to pivot_root > to it again (with some arg that we can use to indicate to us that we > are shutting the system down). > > See also <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=778849>.
Hmm, I’m skeptical. > Regardless, my current non-initramfs attempt is: Nice! > ;;; Note: Alternatively, if we still had it, we could try > pivot_root into the initrd. > ;;; (where we'd have a magic file to tell it that we are > shutting down instead of booting). > ;;; Note: dracut can do it, see > <https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html#_dracut_on_shutdown>. > ;;; See also > <https://unix.stackexchange.com/questions/215169/get-back-to-initramfs-on-shutdown>. > (when (zero? n) > (with-mounted-filesystem "none" "/proc" "proc" 0 > (with-mounted-filesystem "none" "/dev" "devtmpfs" 0 > (catch 'system-error > (mknod "/dev/tty" 'char-special #o600 (+ (* 5 256) > 0)) > (const #f)) > ;; TODO: Or make fuser (in package psmisc) static > and don't put it in the store either. > ;; although we'd still need to resolve the symlink > /run/booted-system and so on. > ;; We could also traverse /proc ourselves, > reimplementing fuser. > (with-mounted-filesystem "/" #t "/gnu/store" (logior > MS_BIND MS_READONLY) > (call-with-io-file "/dev/tty" > (lambda () > (chvt 12) ; we don't have that (it would need > to use ioctl VT_ACTIVATE int on /dev/tty) > ;; The "w" option only finds writers. > ;; The "i" option asks the user interactively > what to kill. > (system* > "/run/booted-system/profile/bin/fuser" "-vikwm" "/"))))))) Did that provide insight as to what’s preventing remount from succeeding? Thanks, Ludo’.