How to fix"error while loading shared libraries: libgl.so.1"
Solution 1
@Braiam is spot on. You should also know that finding a file with locate
does not mean it exists. locate
uses a database that is refreshed every now and then. It does not search the actual file systsem but it's database. You can run updatedb
to refresh the database before searching or use the -e
flag:
-e, --existing
Print only entries that refer to files existing at the time locate is run.
For example:
$ touch stupid_stupid_file.txt
$ locate stupid_stupid_file.txt ## No results
$ sudo updatedb ## refresh database
$ locate stupid_stupid_file.txt
/home/terdon/stupid_stupid_file.txt ## the file was found after updatedb
$ rm stupid_stupid_file.txt ## delete the file
$ locate stupid_stupid_file.txt
/home/terdon/stupid_stupid_file.txt ## the file is still in the database
$ locate -e stupid_stupid_file.txt ## the file is not found using -e
Solution 2
It's probably because some linked libraries got broken when you uninstalled several package at once. You should have run dpkg -l |grep ^rc|awk '{print $2}'
before hand to know what will happen. Luckily this can be solved using sudo ldconfig
. This recreates the linked libraries cache and will (hopefully) fix your libraries.
Of course, that will only works if you really have the /usr/lib/libGL.so.1
library installed:
ls -l /usr/lib/x86_64-linux-gnu/libGLU.so.1
lrwxrwxrwx 1 root root 15 sep 18 14:03 /usr/lib/x86_64-linux-gnu/libGLU.so.1 -> libGLU.so.1.3.1
dpkg -S libGL.so.1
libgl1-mesa-glx:i386: /usr/lib/i386-linux-gnu/mesa/libGL.so.1
libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
libgl1-mesa-glx:i386: /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
(mine is 64bits that's why the difference.)
Related videos on Youtube
Ziu
Updated on September 18, 2022Comments
-
Ziu over 1 year
After I run this command
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
I got the problem while opening smplayer,cairo-dock,unity-2d-shell and amdconfig ,"error while loading shared libraries: libGL.so.1:cannot open shared object file: No such file or directory". Maybe there are other applications would meet the same problem.
But I do have the file
locate libGL.so.1 /usr/lib/FGL.renamed.libGL.so.1.2 /usr/lib/libGL.so.1 /usr/lib/libGL.so.1.2 /usr/lib/i386-linux-gnu/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so.1.2 /usr/lib/i386-linux-gnu/fglrx/fglrx-libGL.so.1.2 /usr/lib/i386-linux-gnu/mesa/FGL.renamed.libGL.so.1.2 /usr/lib/x86_64-linux-gnu/mesa/FGL.renamed.libGL.so.1.2 /usr/lib32/libGL.so.1 /usr/lib32/libGL.so.1.2 ldd $(which unity-2d-shell)|grep libGL libGL.so.1 => not found ldd $(which mplayer)|grep not libGL.so.1 => not found
But
ldd $(which smplayer)|grep libGL
got nothing.
-
Ziu over 10 yearsIt's weird. I have rebooted. But it seems like didn't update the database. And after that, it turns out that that package dose not exists. But using "apt-get install" , I can't find that package. Using "apt-file search", many package include this lib, and how can i install that lib correctly?
-
Ziu over 10 yearsIt's my fault. TI don't have the /usr/lib/libGL.so.1 actually. How can I install that lib?
-
terdon over 10 years@Ziu you need to run
updatedb
to update the database, rebooting is irrelevant. Anyway, check the dependencies of mplayer:apt-cache depends mplayer | grep -i libgl
that will return the packages thatmplayer
depends on. One of them should belibgl1-mesa-glx
. -
Ziu over 10 yearsFinally fix it. It is libgl1-mes-glx, but when I try to install that, it reminds me have installed the latest version. Then I thought that maybe it is something wrong with the graphics drive. So i uninstall it, and it works correctly. and the libGL:
libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f1e83fa7000)
. Then i install the amd drive again, and it still works. But the dependency changes. libGL:libGL.so.1 => /usr/lib/libGL.so.1 (0x00007fe24e687000)
. Thanks