Solved Can't delete folder of jail

Hello. I was setting up a jail and I give up installing it and now I can't delete /jails/demojail folder. Those are errors that I am getting when I try to delete it.

Code:
# rm -rf /jails/demojail/
rm: /jails/demojail/usr/bin/su: Operation not permitted
rm: /jails/demojail/usr/bin/crontab: Operation not permitted
rm: /jails/demojail/usr/bin/passwd: Operation not permitted
rm: /jails/demojail/usr/bin/opiepasswd: Operation not permitted
rm: /jails/demojail/usr/bin/opieinfo: Operation not permitted
rm: /jails/demojail/usr/bin/login: Operation not permitted
rm: /jails/demojail/usr/bin/chpass: Operation not permitted
rm: /jails/demojail/usr/bin: Directory not empty
rm: /jails/demojail/usr/lib/librt.so.1: Operation not permitted
rm: /jails/demojail/usr/lib: Directory not empty
rm: /jails/demojail/usr/lib32/libcrypt.so.5: Operation not permitted
rm: /jails/demojail/usr/lib32/librt.so.1: Operation not permitted
rm: /jails/demojail/usr/lib32/libthr.so.3: Operation not permitted
rm: /jails/demojail/usr/lib32/libc.so.7: Operation not permitted
rm: /jails/demojail/usr/lib32: Directory not empty
rm: /jails/demojail/usr: Directory not empty
rm: /jails/demojail/lib/libthr.so.3: Operation not permitted
rm: /jails/demojail/lib/libc.so.7: Operation not permitted
rm: /jails/demojail/lib/libcrypt.so.5: Operation not permitted
rm: /jails/demojail/lib: Directory not empty
rm: /jails/demojail/libexec/ld-elf.so.1: Operation not permitted
rm: /jails/demojail/libexec/ld-elf32.so.1: Operation not permitted
rm: /jails/demojail/libexec: Directory not empty
rm: /jails/demojail/var/empty: Operation not permitted
rm: /jails/demojail/var: Directory not empty
rm: /jails/demojail/sbin/init: Operation not permitted
rm: /jails/demojail/sbin: Directory not empty
rm: /jails/demojail/: Directory not empty
zfs list as additional information. Also, jail service is not running.
Code:
NAME                                           USED  AVAIL     REFER  MOUNTPOINT
data                                          48.9G   850G       96K  /data
data/wdc                                      48.9G   850G     48.9G  /mnt/wdc
zroot                                         56.8G   143G       96K  /zroot
zroot/ROOT                                    6.54G   143G       96K  none
zroot/ROOT/13.2-RELEASE-p4_2023-11-08_144804     8K   143G     5.82G  /
zroot/ROOT/13.2-RELEASE_2023-11-01_162651        8K   143G     1.35G  /
zroot/ROOT/default                            6.54G   143G     6.27G  /
zroot/tmp                                      152K   143G      152K  /tmp
zroot/usr                                     49.9G   143G       96K  /usr
zroot/usr/home                                47.7G   143G     47.7G  /usr/home
zroot/usr/ports                               1.41G   143G     1.41G  /usr/ports
zroot/usr/src                                  774M   143G      774M  /usr/src
zroot/var                                      386M   143G       96K  /var
zroot/var/audit                                 96K   143G       96K  /var/audit
zroot/var/crash                                384M   143G      384M  /var/crash
zroot/var/log                                  912K   143G      912K  /var/log
zroot/var/mail                                 160K   143G      160K  /var/mail
zroot/var/tmp                                  112K   143G      112K  /var/tmp
 
Several files in the root/base filesystem have the schg flag set. See chflags(1). That prevents them from getting overwritten or, in this case, deleted. chflags -R noschg /jails/demojail/

Code:
           schg, schange, simmutable
                   set the system immutable flag (super-user only)
 
Several files in the root/base filesystem have the schg flag set. See chflags(1). That prevents them from getting overwritten or, in this case, deleted. chflags -R noschg /jails/demojail/

Code:
           schg, schange, simmutable
                   set the system immutable flag (super-user only)
SirDice,

Great Knowledge! Ran into this today and this thread worked on latest FreeBSD-14.0-RELEASE-amd64.

Thanks OP, nxjoseph!
 
Back
Top