Immutable files on UFS?

Gary Palmer gpalmer at freebsd.org
Thu Apr 10 22:04:22 UTC 2014


On Thu, Apr 10, 2014 at 02:53:33PM -0700, Garrett Cooper wrote:
> Hi all,
>     This seems like a bit more than a basic question, but I apologize
> if I overlooked anything trivial. Basically I have some paths that
> don't seem to be removable. I'm not sure what needs to be done to make
> the paths mutable.
>     I'm open to any and all suggestions in trying to clear out the
> filesystem :).
> Thanks!
> -Garrett
> 
> # uname -a
> FreeBSD fbsd-vm.zonarsystems.net 11.0-CURRENT FreeBSD 11.0-CURRENT #2
> 5dc0f18(atf): Tue Apr  8 18:39:49 PDT 2014
> root at fbsd-vm.zonarsystems.net:/usr/obj/usr/src/sys/GENERIC  i386
> # whoami
> root
> # mount | grep /dev/ada0p2
> /dev/ada0p2 on / (ufs, local, journaled soft-updates)
> # chflags -R 0 /usr/obj~/
> # rm -Rf /usr/obj~/
> rm: /usr/obj~/usr/src/tmp/usr/lib/engines: Directory not empty
> rm: /usr/obj~/usr/src/tmp/usr/lib: Directory not empty
> rm: /usr/obj~/usr/src/tmp/usr: Directory not empty
> rm: /usr/obj~/usr/src/tmp: Directory not empty
> rm: /usr/obj~/usr/src: Directory not empty
> rm: /usr/obj~/usr: Directory not empty
> rm: /usr/obj~/obj/usr/src/tmp/usr/tests/bin/pkill: Directory not empty
> rm: /usr/obj~/obj/usr/src/tmp/usr/tests/bin: Directory not empty
> rm: /usr/obj~/obj/usr/src/tmp/usr/tests: Directory not empty
> rm: /usr/obj~/obj/usr/src/tmp/usr: Directory not empty
> rm: /usr/obj~/obj/usr/src/tmp: Directory not empty
> rm: /usr/obj~/obj/usr/src: Directory not empty
> rm: /usr/obj~/obj/usr: Directory not empty
> rm: /usr/obj~/obj: Directory not empty
> rm: /usr/obj~/: Directory not empty
> # truss -o log rm -Rf
> pjdfstest_0144459825150ee4088883866736d6ed/pjdfstest_5927dfc58a61fcfd500945dc28976d89
> rm: pjdfstest_0144459825150ee4088883866736d6ed/pjdfstest_5927dfc58a61fcfd500945dc28976d89:
> Operation not permitted
> # egrep 'rmdir|unlink' log
> unlink("pjdfstest_0144459825150ee4088883866736d6ed/pjdfstest_5927dfc58a61fcfd500945dc28976d89")
> ERR#1 'Operation not permitted'
> 
> # truss -o log rm -Rf /usr/obj~/usr/src/tmp/usr/lib/engines/
> rm: /usr/obj~/usr/src/tmp/usr/lib/engines/: Directory not empty
> # find /usr/obj~/usr/src/tmp/usr/lib/engines/ -mindepth 1 | wc -l
>        0
> # egrep 'rmdir|unlink' log
> rmdir(0x2880b100,0x10,0x0,0xbfbfec10,0x0,0x2)    ERR#66 'Directory not empty'


Try looking at files in that directory with the '-o' flag to ls.  e.g.

ls -lago /usr/obj~/usr/src/tmp/usr/lib/engines/

If you see files with 'schg' on them, then run

chflags noschg <filename>

You could also do

chflags -PR noschg /usr/obj~/

although be careful, as some files on the filesystem (such as /lib/libc.so.*)
are meant to be immutable.

If you are running with a securelevel above 0 the above won't be possible.

Regards,

Gary


More information about the freebsd-fs mailing list