Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 408357 - app-portage/gentoolkit - revdep-rebuild follows /var/cache symlink and then complains about it
Summary: app-portage/gentoolkit - revdep-rebuild follows /var/cache symlink and then c...
Status: RESOLVED DUPLICATE of bug 263661
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-15 13:56 UTC by David Flogeras
Modified: 2012-08-09 15:55 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Flogeras 2012-03-15 13:56:42 UTC
I have installed an SSD, and to avoid unnecessary wear I did the following:

- Mounted /dev/sda3 to /mnt/sd3
- Put my var/ and tmp/ folders on that partition
- Made symlinks in / for /var and /tmp that point to /mnt/sda3/var and /mnt/sda3/tmp respectively

Now if I try to run revdep-rebuild, it is smart enough to know that I pulled the rug out from under it's feet and fails with the following:

 * Configuring search environment for revdep-rebuild
 * Working directory expected to be /var/cache/revdep-rebuild, but it is /mnt/sda3/var/cache/revdep-rebuild

So really, am I doing something unsupported, or should the tool be less strict?

Reproducible: Always
Comment 1 Paul Varner (RETIRED) gentoo-dev 2012-07-25 15:46:28 UTC
Sorry about the late response. I'm not sure how I missed this when you filed the bug.

This is done on purpose to prevent symlink attacks on revdep-rebuild when run as root.  The security bug for the design decision is Bug 203414.  Please note the discussion at the end of the bug for removing the check only applied when revdep-rebuild was run as a user.

The solution to fix the problem is to not use a symlink, but to bind mount the desired directories.

So assuming that you have the following:

/mnt/sd3/var is your desired location for /var instead of making /var as symlink to /mnt/sd3/var you want to do the following:

mount --bind /mnt/sd3/var /var

The /etc/fstab entry to do this automatically should look like:
/mnt/sd3/var /var none bind

Also be sure to set the permissions and ownership of /var/cache/revdep-rebuild
chown root:root /var/cache/revdep-rebuild
chmod 700 /var/cache/revdep-rebuild

*** This bug has been marked as a duplicate of bug 263661 ***
Comment 2 David Flogeras 2012-08-09 15:55:48 UTC
Cheers, and sorry for the late response-reponse :)

I like that solution much better than symlinks anyway, just never thought of it