bastille icon indicating copy to clipboard operation
bastille copied to clipboard

[BUG] Stopping/deleting jails is broken

Open zilti opened this issue 3 years ago • 4 comments

[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.

zilti avatar Apr 14 '21 15:04 zilti

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.

adriel-tech avatar Apr 17 '21 19:04 adriel-tech

lesson learned, check "issues" and count how many are tagged with "bugs" before adopting. what an embarrassing bug.

laktech avatar Aug 06 '22 05:08 laktech

@zilti What would be a valid fix to you for this issue? Possible ones off the top of my head

  1. have destroy wait until jail stops then continue
  2. have destroy through a message that jail has not stopped yet please try again later
  3. ????

Suggest a workable solution to make this go away.

bmac2 avatar Oct 20 '23 17:10 bmac2

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.

adriel-tech avatar Oct 20 '23 23:10 adriel-tech