Closed unki closed 6 years ago
That's interesting. It has been quite long since I got this kind of issues myself. My point of view is the following:
I tried to reproduce the issue, mounting the temporary directory using tmpfs with a low size limit. Errors occured, of course, but debootstick could still cleanup properly. If you have more details about the environment that caused issues, It would help if you could describe it. Thanks !
Hi, commit 8774a20f5782d07e0930feb38567d41d684bba83 should have fixed last corner cases, I am closing the issue.
Something I've observed when
debootstick
gets - whyever - interrupted during a build. In my case it was probably the/tmp
filesystem that was running full (once again... now I've set TMPDIR to somewhere else) and some tasks likeapt-get
were still performing in the background.debootstick
already does a great job trapping these interruptions and invokes itson_exit()
function, starting to undo all the changes that it has previously made.It my case, it wasn't successful here - perhaps failed to umount because the kernel was unable to write dirty pages back into the loopback-mounted image-file as there was not more free space in /tmp available for this action.
And in this situation some residues have been left - next to the tmp-directory that
debootstick
used for building also all the mount points like/proc
and/sys
that it has mounted in there.It was looking like this:
If now someone overlooks that there is still something mounted in $TMPDIR and just invokes
rm -rf
on this directory, he may end up with a painfully damaged host-system.rm -rf
traverses down all files and directories and when hitting/proc
,/sys
, etc. it will also start to delete files, directories, device-nodes, etc. of the building-hosts that these filesystems are referring to (like all stuff in/proc/*/fd/
).While you could argue that this is the users responsibility to carefully cleanup, perhaps it would be good too, to display a big, fat warning and show some commands that need to be manually invoked to cleanup, if debootstick was unable to do so. At least in my case the minimum set was:
To summarize: if an error occurs in
on_exit()
or any of its called sub functions, debootstick could display what and where residues are left - and shows what could be done to cleanup manually.IMHO you will never be able to cover all the possible fault situations that could occur - deboostick is already great in doing what it can to cleanup as much as possible. But if this fails, it could advice the user, how to follow up here.