Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supermin: don't cd $workdir in supermin-init-prelude
I've been investigating why a seemingly innocuous change (changing compression on OSBuild generated qemu qcow2) would cause disk images to not boot [1]. I think I have found the issue. I was first trying to make sure 100% that the files got written out over the virtiofs mount before the VM got shutdown so I decided to add a `umount $workdir` to the process. But this ended up with a `umount: /srv/: target is busy.` error. When the supermin VM gets run we `cd "${workdir}"` at the end of supermin-init-prelude.sh. This has the effect of causing all spawned processes (including PID1/init) to have a cwd of /srv/. ``` bash-5.2# lsof /srv COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME init 1 root cwd DIR 0,26 4096 10485829 /srv kthreadd 2 root cwd DIR 0,26 4096 10485829 /srv pool_work 3 root cwd DIR 0,26 4096 10485829 /srv kworker/R 4 root cwd DIR 0,26 4096 10485829 /srv ... ... ``` Which means it's unlikely that the virtiofs mount ever gets cleanly unmounted. Let's rework things here so that actual work gets spawned in a subshell to prevent `init` from having a cwd on the virtiofs mount. We also add in an `umount` of the cache qcow2 (if exists) and the virtiofs mount to strengthen our chances of a clean unmount. [1] #3728
- Loading branch information