Skip to content

init_storage: refuse -f on an image in use - #88

Merged
daniel-rossier merged 1 commit into
mainfrom
fix/init-storage-busy
Dec 2, 2026
Merged

daniel-rossier merged 1 commit into
mainfrom
fix/init-storage-busy

Conversation

@daniel-rossier

Copy link
Copy Markdown
Contributor

init_storage.sh -f deleted the image while a QEMU guest had it open (the guest kept writing to the unlinked inode, lost on exit) or while it was mounted / on a loop device. -f now refuses, before the rm, when a process holds the image open (/proc/*/fd, which catches the guest whatever its cwd), when filesystem/work/p1 or p2 is a mountpoint, or when losetup --associated lists a device, and names the culprit. The platform is now read from local.conf then site.conf like st.sh. Checked on a real tree with a 64M image: a process named qemu-system-aarch64 holding it through filesystem/sdcard.img.virt64 (plus a second reader) was listed and refused, a losetup-attached device was refused, a FAT image mounted on work/p1 was refused; the image stayed every time, and an idle image passes the check. dash -n clean; shellcheck reports only the existing SC2164.

init_storage.sh -f deleted the storage image whatever held it. A guest
started by st.sh kept writing to the unlinked file, so everything it
wrote was lost when it exited, and the next st.sh booted the new, empty
image. A mount or a loop device left by mount.sh kept the old
partitions in the same way.

Before deleting, -f now refuses when a process has the image open, when
filesystem/work/p1 or p2 is mounted, or when a loop device is attached
to it, and says which. The platform is read from local.conf then
site.conf, as st.sh does, so both scripts name the same image.
@daniel-rossier
daniel-rossier merged commit cb1ec8a into main Dec 2, 2026
2 checks passed
@daniel-rossier
daniel-rossier deleted the fix/init-storage-busy branch December 2, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant