Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 434956 - app-eselect/eselect-opengl-1.2.6.1: improper ROOT and EROOT handling (was: x11-drivers/nvidia-drivers-304.48: programs cannot find libnvidia-tls.so.304.48)
Summary: app-eselect/eselect-opengl-1.2.6.1: improper ROOT and EROOT handling (was: x1...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on: 728286
Blocks:
  Show dependency tree
 
Reported: 2012-09-13 23:06 UTC by PM
Modified: 2020-09-12 21:06 UTC (History)
13 users (show)

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 PM 2012-09-13 23:06:15 UTC
Since upgrading to this version, KDE and at least one other application (namely google-chrome) fail to load because they cannot find libnvidia-tls.so.304.48:

$ LC_ALL=C startkde
startkde: Starting up...
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
kbuildsycoca4 running...
kbuildsycoca4(5028) KBuildSycoca::checkTimestamps: checking file timestamps
kbuildsycoca4(5028) KBuildSycoca::checkTimestamps: timestamps check ok
kbuildsycoca4(5028) kdemain: Emitting notifyDatabaseChanged ()
kded(5027) Kded::loadModule: Could not load library "kded_powerdevil" . [ "Cannot load library /usr/lib64/kde4/kded_powerdevil.so: (libnvidia-tls.so.304.48: cannot open shared object file: No such file or directory)" ] 
QObject::connect: Cannot connect (null)::deviceFound(Device*) to BlueDevilDaemon::deviceFound(Device*)
QObject::connect: Cannot connect QTimer::timeout() to (null)::stopDiscovery()
kded(5027) Kded::loadModule: Could not load library "kded_keyboard" . [ "Cannot load library /usr/lib64/kde4/kded_keyboard.so: (libnvidia-tls.so.304.48: cannot open shared object file: No such file or directory)" ] 
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
kded(5027)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
Could not open library ksmserver: Cannot load library /usr/lib64/libkdeinit4_ksmserver.so: (libnvidia-tls.so.304.48: cannot open shared object file: No such file or directory)
ksmserver: error while loading shared libraries: libnvidia-tls.so.304.48: cannot open shared object file: No such file or directory
startkde: Shutting down...
klauncher: Exiting on signal 1
startkde: Running shutdown scripts...
startkde: Done.

A working workaround is to LD_PRELOAD this library.

This problem doesn't go away if I downgrade to 304.43, which used to work.
Comment 1 Aaron Pelton 2012-09-13 23:58:05 UTC
/etc/ld.so.conf is missing / at the beginning of

/usr/lib64/OpenCL/vendors/nvidia
/usr/lib32/OpenCL/vendors/nvidia
/usr/lib64/opengl/nvidia/lib
/usr/lib32/opengl/nvidia/lib

Also, 32 was before 64. reordered and edited as above and running ldconfig solves the problem.
Comment 2 Aaron Pelton 2012-09-14 00:00:06 UTC
(In reply to comment #1)
> /etc/ld.so.conf is missing / at the beginning of
> 
> /usr/lib64/OpenCL/vendors/nvidia
> /usr/lib32/OpenCL/vendors/nvidia
> /usr/lib64/opengl/nvidia/lib
> /usr/lib32/opengl/nvidia/lib
> 
> Also, 32 was before 64. reordered and edited as above and running ldconfig
> solves the problem.

I should say "solves the immediate problem" -- I have no idea why ld.so.conf was borked nor how it should be "properly" addressed.
Comment 3 Aaron Pelton 2012-09-14 00:49:58 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > /etc/ld.so.conf is missing / at the beginning of
> > 
> > /usr/lib64/OpenCL/vendors/nvidia
> > /usr/lib32/OpenCL/vendors/nvidia
> > /usr/lib64/opengl/nvidia/lib
> > /usr/lib32/opengl/nvidia/lib
> > 
> > Also, 32 was before 64. reordered and edited as above and running ldconfig
> > solves the problem.
> 
> I should say "solves the immediate problem" -- I have no idea why ld.so.conf
> was borked nor how it should be "properly" addressed.

It's something deeper. chromium and virtualbox had failed to compile due to the same issue. I restarted emerge after the fix above and had to refix after both chromium and virtualbox as each time /etc/ld.so.conf was borked.
Comment 4 Aaron Pelton 2012-09-14 01:04:11 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > /etc/ld.so.conf is missing / at the beginning of
> > > 
> > > /usr/lib64/OpenCL/vendors/nvidia
> > > /usr/lib32/OpenCL/vendors/nvidia
> > > /usr/lib64/opengl/nvidia/lib
> > > /usr/lib32/opengl/nvidia/lib
> > > 
> > > Also, 32 was before 64. reordered and edited as above and running ldconfig
> > > solves the problem.
> > 
> > I should say "solves the immediate problem" -- I have no idea why ld.so.conf
> > was borked nor how it should be "properly" addressed.
> 
> It's something deeper. chromium and virtualbox had failed to compile due to
> the same issue. I restarted emerge after the fix above and had to refix
> after both chromium and virtualbox as each time /etc/ld.so.conf was borked.

Last post, promise...

/etc/env.d/03opencl and 03opengl are missing leading / in the LDPATH (ie LDPATH="usr/lib32/OpenCL/vendors/nvidia:usr/lib64/OpenCL/vendors/nvidia").

putting the leading / in resolves the repeated borking of /etc/ld.so.conf I assume until reemerging nvidia-drivers rebuilds the env file (assuming that's how it works)
Comment 5 Mark R. Pariente 2012-09-14 04:44:14 UTC
This bug is pretty bad, rendered my system unusable as well. Solution was to downgrade to 304.43, fix /etc/env.d/03opencl and /etc/env.d/03opengl to have a leading slash in front of each element in LDPATH, fix /etc/ld.so.conf to reorder 64 before 32 and put leading slashes in and finally run ldconfig.

Let's pull 304.48 off or put in a fix before it can do more damage to others :)
Comment 6 Cyril 2012-09-14 07:03:52 UTC
Same here, but doing
 eselect opengl set nvidia
 eselect opencl set nvidia

solves the problem of startkde
Comment 7 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2012-09-14 09:39:23 UTC
(In reply to comment #6)
> Same here, but doing
>  eselect opengl set nvidia
>  eselect opencl set nvidia
> 
> solves the problem of startkde

Same here, although ld.so.conf stays broken.
Comment 8 László Szalma 2012-09-14 09:41:20 UTC
I confirm #6 comment:
eselect opengl set nvidia
eselect opencl set nvidia
solves the problems (Virtualbox running, compiling etc), no manual editing of /etc files was needed
Comment 9 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2012-09-14 09:55:35 UTC
(In reply to comment #7)
> Same here, although ld.so.conf stays broken.

That was a mistake. Running eselect manually indeed fixes it. Even when I replicate exactly nvidia-driver's pkg_postinst() in a shell, it works. For some reason, it omits the leading slash when in the context of the ebuild, though.

The problem disappears if I downgrade app-admin/eselect to 1.3.1 so it has to be introduced by some changes in app-admin/eselect-1.3.2.
Comment 10 Aaron Pelton 2012-09-14 10:23:00 UTC
I can confirm that
emerge =eselect-1.3.1
emerge nvidia-drivers
leaves /etc/env.d/03open[cg]l and /etc/ld.so.conf in the correct state with no additional work.

Similarly after reupgrading to eselect-1.3.2 and reemerging nvidia-drivers, the env files are "incorrect" but
eselect open[gc]l set nvidia 
also corrects the env files for me *now*. I swear I tried it yesterday but it didn't work. 

Still leaves 32bit first in order but perhaps that doesn't matter.
Comment 11 Ulrich Müller gentoo-dev 2012-09-14 10:25:46 UTC
eselect-1.3.2 assigns EROOT=${ROOT%/}${EPREFIX} whereas 1.3.1 had EROOT=${ROOT}${EPREFIX}.

With non-empty EPREFIX (which will always start with a /) this will remove a duplicate slash. With empty EPREFIX, it might remove a trailing slash in EROOT (which was never guaranteed to end with one, however).
Comment 12 Ulrich Müller gentoo-dev 2012-09-14 11:00:44 UTC
Package masked eselect-1.3.2, for the time being:

# Ulrich Müller <ulm@gentoo.org> (14 Sep 2012)
# Exposes breakage in eselect-opengl.
Masked until bug 434956 is sorted out.
=app-admin/eselect-1.3.2
Comment 13 Ulrich Müller gentoo-dev 2012-09-14 11:27:47 UTC
Adding eselect-opengl maintainer to CC.
Comment 14 Ulrich Müller gentoo-dev 2012-09-14 22:23:38 UTC
I've investigated this further. The problem is in eselect-opengl and can be reproduced from within the shell. In the following, I'm always assuming the non-prefix case, i.e. EPREFIX="".

$ ROOT="" eselect opengl set 1
This is working fine.

$ ROOT=/ eselect opengl set 1
This causes the leading / to be missing in /etc/env.d/03opengl, as described in comment #4.

The problem is in line 267 of opengl.eselect:

    ldpath="${ldpath:+${ldpath}:}${PREFIX#${ROOT}}/${libdir}/opengl/${gl_local}/lib"

PREFIX is assigned to "${EROOT}/usr" before. Therefore, the assignment will be faulty with ROOT=/ and EROOT=${ROOT%/}${EPREFIX} (i.e., empty EROOT) which is the behaviour of eselect-1.3.2.

Unfortunately, I cannot change the assignment in eselect to EROOT=${ROOT%/}${EPREFIX}/ (which is was Portage does) because that would expose another bug in e.g. line 51 of the opengl module:

    [[ ${ROOT} != / ]] && libdir=${libdir#${EROOT}}

I've added a workaround for EROOT in eselect-1.3.2-r1 now.

However, the eselect-opengl is very brittle and needs auditing, both on non-prefix and on prefix.
Comment 15 William Throwe 2013-11-10 09:41:15 UTC
eselect-opengl is still broken in prefix.  It still gives no leading / in ld.so.conf entries.

Since the module assumes that ${PREFIX} is ${ROOT}${EPREFIX}/usr (which it currently is in the non-prefix case) one solution would be to actually set it to that, rather than to ${EROOT}/usr .  Then ${PREFIX#{ROOT}} would give ${EPREFIX}/usr as expected.

Another possibility would be to strip off ${ROOT%${EPREFIX:+/}} instead of ${ROOT}, since that is what eselect is currently prepending to ${EPREFIX} to get ${EROOT}, but this would break later if eselect changed to using portage's value.