rebuilding world - is "chflags -R noschg *" necessary?

Balázs Mátéffy repcsike at gmail.com
Thu Sep 23 15:44:15 UTC 2010


Hello!

Anton is right, really the handbook says that it MAY contain, so it's not
necessary that after every build there will be some files with the immutable
flag.

OFF: Long long time ago one night when I was playing with jails (to be exact
I was building and making work my first jail by hand) I got to know this
little thing known as immutable, after building a jail, and after #&@$ing it
up (sry :)) I could not delete it. It was a funny discovery I remember I was
new to FBSD and unix in general:).
ON:

I think maybe in older releases the build process may have used the
immutable flag at build??, but the test machine I tried, started out as
maybe 5.2, and I never had this issue once. Now I'm at 8.1-REL. After you
make installworld you get some files immutable, check this:

# cd /usr/src/
# make installworld DESTDIR=/usr/home/testworld/
# cd /usr/home/testworld
# find . -xdev -flags +schg -exec ls -la {} \;
-r-sr-xr-x  1 root  wheel  18584 Sep 23 16:54 ./bin/rcp
-r--r--r--  1 root  wheel  1150968 Sep 23 16:53 ./lib/libc.so.7
-r--r--r--  1 root  wheel  32104 Sep 23 16:53 ./lib/libcrypt.so.5
-r--r--r--  1 root  wheel  76412 Sep 23 16:54 ./lib/libthr.so.3
-r-xr-xr-x  1 root  wheel  220596 Sep 23 16:54 ./libexec/ld-elf.so.1
-r-xr-xr-x  1 root  wheel  663616 Sep 23 16:55 ./sbin/init
-r-sr-xr-x  6 root  wheel  18588 Sep 23 16:56 ./usr/bin/chpass
-r-sr-xr-x  6 root  wheel  18588 Sep 23 16:56 ./usr/bin/chfn
-r-sr-xr-x  6 root  wheel  18588 Sep 23 16:56 ./usr/bin/chsh
-r-sr-xr-x  6 root  wheel  18588 Sep 23 16:56 ./usr/bin/ypchpass
-r-sr-xr-x  6 root  wheel  18588 Sep 23 16:56 ./usr/bin/ypchfn
-r-sr-xr-x  6 root  wheel  18588 Sep 23 16:56 ./usr/bin/ypchsh
-r-sr-xr-x  1 root  wheel  21836 Sep 23 16:56 ./usr/bin/login
-r-sr-xr-x  1 root  wheel  4792 Sep 23 16:56 ./usr/bin/opieinfo
-r-sr-xr-x  1 root  wheel  11868 Sep 23 16:56 ./usr/bin/opiepasswd
-r-sr-xr-x  2 root  wheel  6160 Sep 23 16:56 ./usr/bin/passwd
-r-sr-xr-x  2 root  wheel  6160 Sep 23 16:56 ./usr/bin/yppasswd
-r-sr-xr-x  1 root  wheel  11244 Sep 23 16:56 ./usr/bin/rlogin
-r-sr-xr-x  1 root  wheel  8896 Sep 23 16:56 ./usr/bin/rsh
-r-sr-xr-x  1 root  wheel  14500 Sep 23 16:56 ./usr/bin/su
-r-sr-xr-x  1 root  wheel  27044 Sep 23 16:56 ./usr/bin/crontab
-r--r--r--  1 root  wheel  16604 Sep 23 16:54 ./usr/lib/librt.so.1
total 4
dr-xr-xr-x   2 root  wheel  512 Sep 23 16:53 .
drwxr-xr-x  22 root  wheel  512 Sep 23 16:53 ..

# rm -rf testworld/
rm: testworld/bin/rcp: Operation not permitted
rm: testworld/bin: Directory not empty
rm: testworld/lib/libc.so.7: Operation not permitted
rm: testworld/lib/libcrypt.so.5: Operation not permitted
rm: testworld/lib/libthr.so.3: Operation not permitted
rm: testworld/lib: Directory not empty
rm: testworld/libexec/ld-elf.so.1: Operation not permitted
rm: testworld/libexec: Directory not empty
rm: testworld/sbin/init: Operation not permitted
and so on...

Anton if you wanna be sure just do it, or test it with the version you are
using, but I don't think you will find any immutable files in /usr/obj

/usr/obj]# find . -flags +schg -exec ls -la {} \;
/usr/obj]#


Sorry if this was a bit long, but I hope it helpded!

Regards,

Balazs.



On 23 September 2010 16:42, Arthur Chance <freebsd at qeng-ho.org> wrote:

> On 09/23/10 15:10, Polytropon wrote:
>
>> On Thu, 23 Sep 2010 12:02:17 +0100, Anton Shterenlikht<
>> mexas at bristol.ac.uk>  wrote:
>>
>>> I've never seen a file under /usr/obj/ with immutable flag set.
>>>
>>
>> I think it was a directory called empty/ that couldn't be removed
>> unless the flag was unset. This makes this step neccessary when
>> you rm -rf /usr/obj the object subtree.
>>
>
> I think you're thinking of /var/empty, not something under /usr/obj. On my
> machine find fails to find anything immutable under /usr/obj.
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>


More information about the freebsd-questions mailing list