Solved Unable to delete jail

How should I delete a jail?

I'm trying to delete a jail subdirectory, but some of the files can't be deleted. I am aware of using chflags -R 0 * but it doesn't seem to work, ie some directories remain. This may well be because I didn't stop the jail before attempting to delete it and now I'm unable to stop it.

Any suggestions?
 
If the jail is still running, or hanging but still active, then you won't be able to delete the files. Also be on the lookout for nullfs(5) mounts (thin jail?) and things like devfs(8) still being mounted.

Which directories are remaining?
 
Does the jail still show up with jls? You could then use ps(1) to see which processes are running in that jail; for example ps -ax -J 2 to see the processes from JID 2.
 
I had managed to delete numerous files in the jail, but the jail was still running, although I couldn't find any way to gain access to it, presumably because /bin/sh had been deleted...

Eventually, I had the harebrained idea of extracting base.txz into the jails directory, and then was able to jexec into it...

Subsequently running service jail stop jailname stopped the jail and I was able to delete it after running chflags -R 0 *.

At least I learned how to delete a jail....
 
Back
Top