Closed Googulator closed 9 months ago
Do we have the sync command working?
Yes, it is used in steps/jump/linux.sh
.
Would "mount -o remount,ro /" be sufficient maybe?
I think so. We only have that one disk based filesystem so it should be ok to do that. Technically we probably dont need it at all, but I'd prefer it to be safer...
Updated to use sync and mount instead of sysrq-trigger.
Testing the new implementation with explicit "mount" revealed that it unfortunately doesn't work. Apparently that's because the mount was made as "/newroot", before calling switch_root - and so "mount" won't recognize the root as a valid mount point.
This new version should work, although it's a bit ugly:
swapoff -a
does the right thing regardless of whether or not a swapfile exists, but then it looks for /etc/fstab, finds it missing, and throws a gratuitous error, which needs to be suppressed using /dev/null and || true.-f
is just "pretend it succeeded"). Work around this by first issuing a SysRq remount, and then only using mount
to wait for it to finish.That all makes sense. It is a bit messy as you said but I really can't think of anything better.
Do we have the sync command working?
As for mounts, the only thing that really needs remounting is the root file system, as the rest is just tmpfs & "technical" file systems like procfs. Would "mount -o remount,ro /" be sufficient maybe?