Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 May 2010 11:54:11 -0500
From:      Scot Hetzel <swhetzel@gmail.com>
To:        Christian Baer <christian.baer@uni-dortmund.de>
Cc:        stable@freebsd.org
Subject:   Re: screwed up permissions in tree
Message-ID:  <i2l790a9fff1005070954p4b7ca72ds79ebacf67e87b2b8@mail.gmail.com>
In-Reply-To: <4BE43A64.9000704@uni-dortmund.de>
References:  <4BE43A64.9000704@uni-dortmund.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 7, 2010 at 11:05 AM, Christian Baer
<christian.baer@uni-dortmund.de> wrote:
> Hi there people!
>
> I guess I really screwed up the rights within my source-tree (and maybe
> share too). It all started pretty innocent. :-)
>
> I wanted to encrypt /usr and /var, which are both mounted on dedicated
> partions on this machine. There was still one unused partition, which I
> will call (and mount) /enctmp for the steps I took. This is how I did it:
>
> - cp -rpv /usr/* /enctmp

This is where you went wrong.  -r =3D -RL (see cp(1) man page). This
caused cp change the symbolic links to directories.  You should have
used either:

cp -Rpv /usr/* /enctmp

or used tar:

tar -cf -cf - -C /usr/ . | tar -xpf - -C destdir

NOTE: tar would have preserved the hardlinks.

> What doesn't work, is installing world! :-O I went to /usr/src/, did a
> make buildworld and make buildkernel (both of which worked). Even make
> installkernel worked, just the world refuses to be installed:
>
> --------------------------------------------------------------
>>>> Making hierarchy
> --------------------------------------------------------------
> cd /usr/src; make -f Makefile.inc1 hierarchy
> cd /usr/src/etc; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0make distrib-dirs
> mtree -eU =A0-f /usr/src/etc/mtree/BSD.root.dist -p /
> mtree -eU =A0-f /usr/src/etc/mtree/BSD.var.dist -p /var
> mtree -eU =A0-f /usr/src/etc/mtree/BSD.usr.dist -p /usr
> mtree -eU =A0-f /usr/src/etc/mtree/BSD.include.dist =A0-p /usr/include
> mtree -deU =A0-f /usr/src/etc/mtree/BSD.sendmail.dist -p /
> cd /; rm -f /sys; ln -s usr/src/sys sys
> cd /usr/share/man/en.ISO8859-1; ln -sf ../man* .
> ln: ./man1: Operation not permitted
> ln: ./man1aout: Operation not permitted
> ln: ./man2: Operation not permitted
> ln: ./man3: Operation not permitted
> ln: ./man4: Operation not permitted
> ln: ./man5: Operation not permitted
> ln: ./man6: Operation not permitted
> ln: ./man7: Operation not permitted
> ln: ./man8: Operation not permitted
> ln: ./man9: Operation not permitted

The problem here is that these are now directories, instead of links.
Your /usr/share/man/en.ISO8859-1 shoud look like:

# ls -l /usr/share/man/en.ISO8859-1
total 20
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat1
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat1aout
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat2
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat3
drwxr-xr-x  7 man   wheel   7 Feb  7 09:47 cat4
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat5
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat6
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat7
drwxr-xr-x  6 man   wheel   6 Feb  7 09:47 cat8
drwxr-xr-x  2 man   wheel   2 Feb  7 09:47 cat9
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man1 -> ../man1
lrwxr-xr-x  1 root  wheel  11 May  6 07:24 man1aout -> ../man1aout
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man2 -> ../man2
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man3 -> ../man3
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man4 -> ../man4
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man5 -> ../man5
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man6 -> ../man6
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man7 -> ../man7
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man8 -> ../man8
lrwxr-xr-x  1 root  wheel   7 May  6 07:24 man9 -> ../man9

To fix this, just delete the man1* - man9 directories, and run make
installworld.  Since /usr/share/man is not needed during an
installworld, the best solution to recover diskspace is to remove this
directory:

cd /usr/src
rm -rf /usr/share/man
make installworld

This would let installworld recreate the man hierarchy.

NOTE: There might be other locations where symbolic links were changed
to directories, just remove those directories and re-run 'make
installworld'.

Scot



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?i2l790a9fff1005070954p4b7ca72ds79ebacf67e87b2b8>