Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 112413

Summary: Moving/Symlinking "/usr/lib" breaks Gentoo Linux
Product: Gentoo Linux Reporter: takken <d.h.j.takken>
Component: New packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: VERIFIED INVALID    
Severity: normal CC: ebjohnso, netbox253, rich0, tim-gentoobugzilla
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description takken 2005-11-13 06:53:38 UTC
When you move the /usr/lib directory to another location (due to lack of diskspace for instance) 
and replace them with symlinks to the new location, lots and lots of Gentoo packages fail to build, 
because many libraries can no longer be found by the system. 
 
The source of the problem is that /usr/lib contains many relative symlinks. For example: 
 
lrwxrwxrwx  1 root root 20 Jun 29 09:50 /usr/lib/libdl.so -> ../../lib/libdl.so.2 
 
This symlink will break as soon as /usr/lib is moved to /mnt/more_space/lib for instance, because 
the symlink will no longer point to /lib but to /mnt. 
 
IMHO Gentoo Linux policy should be to not use relative paths in symlinks, or *at least* to have 
portage check if /usr/lib is not a symlink before emerging an ebuild, and display a clear warning 
when this is the case. 

Reproducible: Always
Steps to Reproduce:
1. move /usr/lib to another location 
2. replace /usr/lib with symlink to new location 
3. ldconfig -v will display errors. 
 
Actual Results:  
Many ebuilds failed to build, lots of compiler/linker errors. 

Expected Results:  
* A clear error message indicating what the problem is
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2005-11-13 07:21:27 UTC
> When you move the /usr/lib directory to another location 

then you should use mount --bind instead symlinks.
Comment 2 kfm 2005-11-13 07:27:32 UTC
Symlinking is wholly inappropriate. Either:

1) Migrate the contents of /usr/lib to an independent filesystem then mount the
filesystem at /usr/lib

2) Bind mount the new location to /usr/lib (mount -o bind /mnt/more_space/lib
/usr/lib)

Suggesting that symlinks should not be used in a useful context so that a
user-imlemented symlink may be used in a daft context or that portage should be
modified on account of this will almost certainly be given short shrift.
Comment 3 takken 2005-11-13 09:02:48 UTC
I am totally unfamiliar with the bind option of mount, and when I look at the Gentoo forums, I 
see that am not the only one why screwed the system by symlinking.  
 
It would be really nice for me and other users who are unfamiliar with the mount trick, to 
display a hint that says using symlinks will probably cause portage to fail.  
Comment 4 erik johnson 2006-03-22 10:25:03 UTC
Did you have to manually redo all of the symlinks?

I just did the same thing.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2006-05-27 05:49:14 UTC
*** Bug 134506 has been marked as a duplicate of this bug. ***
Comment 6 Marien Zwart (RETIRED) gentoo-dev 2006-07-14 09:10:09 UTC
*** Bug 126873 has been marked as a duplicate of this bug. ***
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2006-11-12 14:12:43 UTC
*** Bug 154934 has been marked as a duplicate of this bug. ***
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2007-07-10 18:23:12 UTC
*** Bug 184862 has been marked as a duplicate of this bug. ***
Comment 9 Richard Freeman gentoo-dev 2007-07-10 18:54:14 UTC
What is considered the appropriate place to perform a bind mount of /usr?

Is it supported to have /usr be a symlink during initial booting and then overlay it with a mount --bind once local.start runs?  

I'd rather not make usr its own partition, but it won't fit on the root...
Comment 10 Jakub Moc (RETIRED) gentoo-dev 2007-07-10 18:56:50 UTC
(In reply to comment #9)
> What is considered the appropriate place to perform a bind mount of /usr?

/etc/fstab supports bind mounts just fine :)