bastille
bastille copied to clipboard
[BUG] Stopping/deleting jails is broken
[MANDATORY] Describe the bug [MANDATORY] When trying to stop and then delete a jail, it will fail. I have to wait about a minute after stopping a jail before it is possible to delete it.
[MANDATORY] Bastille and FreeBSD version (paste bastille -v && freebsd-version -kru
output)
0.8.20210115
12.2-RELEASE
12.2-RELEASE
12.2-RELEASE
[MANDATORY] How did you install bastille? (port/pkg/git) pkg
[optional] Steps to reproduce?
sudo bastille stop testbox || true
[testbox]:
testbox: removed
sudo bastille destroy testbox || true
Deleting Jail: testbox.
cannot unmount '/usr/local/bastille/jails/testbox/root': Device busy
rm: /usr/local/bastille/jails/testbox/root: Device busy
rm: /usr/local/bastille/jails/testbox: Device busy
Note: jail console logs archived.
/var/log/bastille/testbox_console.log-2021-04-12
sudo bastille create testbox 12.2-RELEASE 10.0.0.5
Valid: (10.0.0.5).
Jail: testbox already created.
I have also had this issue many times, each time I had to manually umount jailname/root folder. One time when it happen It deleted files in a zfs mount point when failing to destroying the jail, though this could be unrelated.
I was using: Bastille 0.8.20210115 host: 12.2-RELEASE jails: 12.2-RELEASE
I have this happen usually when creating a 'test' jail, destroying it and remaking it a few times in a row using the same name+ip.
lesson learned, check "issues" and count how many are tagged with "bugs" before adopting. what an embarrassing bug.
@zilti What would be a valid fix to you for this issue? Possible ones off the top of my head
- have destroy wait until jail stops then continue
- have destroy through a message that jail has not stopped yet please try again later
- ????
Suggest a workable solution to make this go away.
From my experience option 1. Will do the trick. I started to delay my destroy command for a minute after the jail seems to shutdown and I don't get this issue anymore.
But if you want to test it, just add a bunch of mounts to a jail, start it, shutdown and destroy it quickly and you are sure to stumble Into this issue.