View previous topic :: View next topic |
Author |
Message |
curmudgeon Veteran
Joined: 08 Aug 2003 Posts: 1741
|
Posted: Mon Jan 02, 2017 9:38 am Post subject: Is there some way for portage to ignore /usr/local? |
|
|
I have been having a lot of problems lately with portage trying to access (search for) libraries in /usr/local/ (running aclocal) when I don't really want it to, or even remove (unlink) things there, which is obviously a huge annoyance.
I know virtually nothing about the standard autotools, or how to configure them. I am wondering if there is some way to have portage completely ignore /usr/local/ (basically pretend that it doesn't even exist). That would save me a great deal of grief. Is that possible? |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9530 Location: beyond the rim
|
Posted: Tue Jan 03, 2017 10:57 am Post subject: |
|
|
Not really. While ebuilds should never touch /usr/local (so you shouldn't see unlinking attempts there) it would be very tricky to fix everything to totally ignore it as it is for example hardcoded in certain toolchain components. Typically providing a switch to ignore it, but then they also ignore other hardcoded locations like /usr and you'd probably have to patch things a lot to fix that properly.
What you can try is to bind-mount an empty directory on top of /usr/local so it appears empty, however that would affect your entire system and not just portage (no idea if/how you can use namespaces to limit the effect to portage invoked processes) |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21633
|
Posted: Wed Jan 04, 2017 2:21 am Post subject: |
|
|
If you are willing to use mount namespaces and bind mounts, then they are a good solution to this problem. As Genone suggested, you want to mount an empty directory over some or all of the directories in /usr/local, depending on which directories you want to disable. The quick and very dirty solution would be to run /usr/bin/unshare --mount -- /bin/bash -c '/bin/mount -o nr_inodes=1,mode=755 -t tmpfs /usr/local && original-emerge-command'. If you do this on a regular basis, a wrapper script to run emerge for you in the altered namespace may be appropriate. You could also try keeping the mount namespace open instead of rebuilding it each time. Beware that any private mounts in your main namespace will remain mounted in the inner namespace until explicitly unmounted or the inner namespace ceases to exist. This could be a problem if you unmount a filesystem while the emerge mount namespace exists, since it will not fully unmount until it is released from all mount namespaces that use it. This is mainly a problem with USB attached storage, but loopback mounted files can also be a problem for the same reason. |
|
Back to top |
|
|
|