Repository navigation
initramfs: add guarded NFS root for bring-up - #503
Conversation
52249b9 to
658d493
Compare
|
Thank you for splitting the NFS root out into its own PR, and for making it fail closed. If the root isn't there, it never falls back to 1. The test makes sure the init has exactly two 2. The lock comes too late. The description says that when NFS is requested, every partition is read-only, the allowlist included. In the code, that happens only after the mount has succeeded and systemd has been found. Until then, the packed allowlist is writable while SSH is up: through the USB wait and up to 15 mount attempts. If the mount fails, There's a simpler shape that fixes both points: decide the mode before the guard's first pass. Near 3. Nothing puts the file into an image. No tool in this PR or in #505 writes Smaller things:
|
|
Thank you, this is the shape I hoped for. The mode is now chosen in Two things before it can go in: 1. It now conflicts with #484. #484 changes how the guard treats whole disks: it removes every whole-disk node ( 2. The NFS test doesn't test the lock yet. Its case packs no allowlist, so every partition is read-only whatever NFS mode does. I checked: if cp "$t/etc-cheetah/omamobile-ufs-rw" "$B/etc/omamobile-ufs-rw"With that line the test passes on your branch and fails on the broken variant, which is the case that matters: a Pixel built with the variable set. And one run on the phone, attended, with this exact init: Smaller things:
The title is fine for the squash. |
|
Thank you for both changes. The comments now describe every phone, and with cheetah's allowlist packed the NFS case finally starts from a state where the lock matters. I checked it: a variant of One line still needs a fix. The second new assertion is ! grep -q '^allowlist: ' "$B/dev/kmsg"but the guard writes every line through ! grep -q 'ufs-ro: allowlist: ' "$B/dev/kmsg"it fails on that variant and passes on your branch. The rest is waiting on me or on boots:
The title is fine for the squash. |
|
Fixed the NFS allowlist log assertion: |
|
The remaining assertion fix is pushed at the current head. Local |
|
Attended NFS-root run update: I booted the RAM image with |
|
Clarification: the exported root used for that run was a generic Arch Linux ARM base with SSH, not a built Omarchy rootfs. The run verifies the initramfs NFS mount and systemd handover only; it does not verify the Omarchy desktop or release rootfs. |
|
Follow-up from the persistent journal in the temporary NFS root: it records NFS mode selection and read-only confirmations for 85 unique UFS partitions plus all 6 UFS whole disks. The guard’s |
|
Image details for the partial run: kernel release |
|
Correction on the preceding note: |
|
The NFS-root persistent journal also records |
|
Thank you for the fix, and for the run. With Three things are left, the first one caused by my side: 1. A rebase onto main, and you don't need to wait for #484 any more. I merged #530 on 2026-11-09 (19:27 UTC), which lets a descriptor name a second LUN with allowlisted partitions. It rewrote the two lines your PR edits, so this PR now conflicts with main itself and CI can't run. I've resolved it here and run the tests on the result. Keep main's if ufs_rw_disk "$name"; then
if [ -s /etc/omamobile-nfsroot ]; then
blockdev --setro "/dev/$name"
read -r ro < "$s/ro"
if [ "$ro" = 1 ]; then
: > "/run/ufs-ro/$name"
ufs_ro_log "/dev/$name set read-only for NFS root"
continue
fi
ufs_ro_log "FAILED to set /dev/$name read-only for NFS root"
echo "omamobile: WARNING: /dev/$name is NOT read-only" > /dev/tty0 2>/dev/null
continue
fi
rm -f "/dev/$name"and in ufs_rw_disk "$name" && [ ! -s /etc/omamobile-nfsroot ] && continueIn NFS mode 2. One repeat of the NFS boot on the rebased head, with the capture that got away this time: 3. My Pixel 7 Pro. One routine boot with the rebased init before I merge, to read the guard's lines there. The title is fine for the squash. |
Let any device test an Arch root over its USB network link before using userdata. When an NFS root is requested, make every UFS partition read-only, including the usual allowlist, and stay in the initramfs shell if the host or root is unavailable.
7febaa8 to
ad4ceb1
Compare
|
Rebased this branch onto current I repeated the attended Mi 8 NFS-root boot with the rebased #503 init and #505 Dipper builder. Image SHA-256: The requested routine boot on your Pixel 7 Pro remains for you to run; I do not have that device attached. This PR is now clean and mergeable. |
|
Thank you. All three points are in. The rebase matches the resolution I posted, line for line, and it merges cleanly onto today's main. The repeat run has what the first one missed: I ran echo 0 > "$B/sys/block/sda/ro"
[[ $(unguarded) == sda ]] || fail "NFS root's hand-over check reports a writable main disk (got: $(unguarded))"
awk '/^boot_nfs\(\) \{/ {on = 1} on && /ufs_unguarded/ {u = NR} on && /kill -9 -1/ {k = NR} on && /^}/ {exit} END {exit !(u && k && u < k)}' initramfs/init \
|| fail "boot_nfs checks ufs_unguarded before it stops the initramfs's processes"The first fails if One more suggestion, also not a condition: What's left is mine: one routine boot of this init on my Pixel 7 Pro, to read the guard's lines there. I'll merge after it, then #505, and redo #484 on top. The repeated log line when The title is fine for the squash; I'll put your 11-10 run into the message. |
|
The 7 Pro boot is done: this head merged with today's main,
So nothing changes for a phone that doesn't ask for it. Merging. The two test lines from my last comment (the |
…nd hand-over order are tested, and the notes say which boots removed /dev/sda (#675) Two assertions for the NFS-only lines #503 left untested: in NFS mode `ufs_unguarded` reports a writable `sda`, and `boot_nfs` calls it before `kill -9 -1`. Dipper's notes now tie the whole-disk-node removal to the `93484a91…` and `f2f5cb2e…` boots the table records, apart from the `e2cdb765…` image where the node was present. `initramfs/init` is unchanged.
A bring-up option for phones whose storage can't be written yet: with OMAMOBILE_NFSROOT set when the initramfs is built, the init mounts its root over NFS through the USB network instead of from userdata. In that mode the storage guard is stricter, not looser: the allowlist is empty, every partition is read-only and the whole-disk node stays read-only at disk level. Nothing changes for a phone that doesn't ask for it: every new branch is keyed on a file that only an initramfs built with the variable carries. The one shared change is that the guard's watcher now starts inside ufs_ro_start(), with the same loop and log line. Tested by the contributor on a Xiaomi Mi 8 over NFS (six disks, every partition read-only). Tested on a Pixel 7 Pro on 2026-11-10 with the variable unset (7.3.0-rc6-omamobile-push1-gc7fb37460f84): the guard's 61 lines identical to the boot before, no NFS line, the root on userdata, the modem ONLINE.
…nd hand-over order are tested, and the notes say which boots removed /dev/sda (derekross#675) Two assertions for the NFS-only lines derekross#503 left untested: in NFS mode `ufs_unguarded` reports a writable `sda`, and `boot_nfs` calls it before `kill -9 -1`. Dipper's notes now tie the whole-disk-node removal to the `93484a91…` and `f2f5cb2e…` boots the table records, apart from the `e2cdb765…` image where the node was present. `initramfs/init` is unchanged.
Summary
Add an opt-in NFS-root path to the shared initramfs for testing a root filesystem over the phone USB network before installing it on userdata. Set
OMAMOBILE_NFSROOT=<host>:/<export>when building the initramfs; this is a local build input, not a device descriptor value. The Dipper RAM-only builder supports the same input.NFS mode makes every UFS disk and partition read-only on the first guard pass, including the normal boot allowlist. If the host or export is unavailable, PID 1 stays in the initramfs shell and never falls through to writable userdata. The existing no-USB watcher remains active: if USB never configures, it panics after about 65 seconds. A Dipper RAM boot then returns to the installed boot image. A hard NFS mount can freeze the root session if the host drops; use it only for a RAM-only probe. Dipper systemd takes over the watchdog with
RuntimeWatchdogSec=60safterkill -9 -1stops the initramfs feeder.Checks
tests/storage-guardpassed with fake UFS sysfs/dev nodes, including the first-pass NFS read-only case and no-fallback checks.git diff --checkpassed.