40

I have Ubuntu 18.04.

While launching virtual box I am getting an error

$ virtualbox
VirtualBox: supR3HardenedMainGetTrustedMain: dlopen("/usr/lib/virtualbox/VirtualBox.so",) failed: libQt5Core.so.5: cannot open shared object file: No such file or directory

$ ldd /usr/lib/virtualbox/VirtualBox.so | grep Qt
libQt5X11Extras.so.5 => /usr/lib/x86_64-linux-gnu/libQt5X11Extras.so.5 (0x00007f7dcec8e000)
libQt5Core.so.5 => not found
libQt5Gui.so.5 => not found
libQt5Widgets.so.5 => not found
libQt5PrintSupport.so.5 => /usr/lib/x86_64-linux-gnu/libQt5PrintSupport.so.5 (0x00007f7dcea1f000)
libQt5OpenGL.so.5 => /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 (0x00007f7dce7c8000)
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
libQt5Widgets.so.5 => not found
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
libQt5Widgets.so.5 => not found
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found

$ apt-file search libQt5Gui.so.5
libqt5gui5: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
libqt5gui5: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9
libqt5gui5: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5

The system has libqt5* packages but I cannot list some of them using

$ ls /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
ls: cannot access '/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5': No such file or directory

How can I fix this?

Zanna
  • 69,223
  • 56
  • 216
  • 327
jobycxa
  • 501
  • 1
  • 4
  • 3

5 Answers5

57

For me, the libqt5gui5 package was already installed. I tried reinstalling like in the other answer, but still got the error:

...
ImportError: libQt5Core.so.5: cannot open shared object file: No such file or directory

I found a similar problem at https://github.com/dnschneid/crouton/wiki/Fix-error-while-loading-shared-libraries:-libQt5Core.so.5

The kernel needs to be at least 3.15 for a very real but (to me) esoteric reason: "Qt 5.10 uses the renameat2 system call which is only available since kernel 3.15". If you want to read a very long thread, look here:

https://bbs.archlinux.org/viewtopic.php?id=232682

...

sudo strip --remove-section=.note.ABI-tag /usr/lib64/libQt5Core.so.5

The above command "strips out" a piece of code which is looking in the kernel for something not there, and allows the module to load.

I'm actually running Debian testing (bullseye) 3.12-1-amd64. The path to my library is /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 so the command in my case is

strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5

After that, I was able to get the app (Electrum) working

tolos
  • 671
  • 5
  • 3
  • 8
    I had to run it with `sudo` command on Ubuntu 20.x and it worked like a charm. – nick-s Apr 20 '20 at 23:50
  • 13
    this even worked on WSL running Debian bullseye with kernel 4.4.0 – elig Jun 22 '20 at 00:55
  • 5
    Yeah, `strip` does the work in WSL. I used Calibre to convert epub to mobi and fased with problem... See official report: https://github.com/microsoft/WSL/issues/3023 – gavenkoa Aug 15 '20 at 19:30
  • 1
    Thank you!!! This made my day, also running on WSL debian 10, kernel: 4.4.0-19041-Microsoft – ph_0 Oct 08 '20 at 16:23
  • That's interesting. I am also running Debian 10 on WSL 1, and I am getting `bash: strip: command not found`. Not sure which package gives this executable either! Any pointers? Thanks. – Samik R Oct 12 '20 at 13:11
  • After running the strip command I get `Segmentation fault`. :( – fsevenm Feb 25 '21 at 22:34
  • 1
    worked like a charm on wsl. +1 – ariaman5 Apr 29 '21 at 17:35
  • I would recommend running `sudo apt-mark hold libqt5gui5` (or the equivalent command for your distro) after running the `strip` command to avoid it being overwritten by future OS updates. – alexia Feb 06 '22 at 15:37
  • When I execute this on an ubuntu 22.04 based singularity container I get the error: `strip: /usr/lib/x86_64-linux-gnu/libQt5Core.so: could not create temporary file to hold stripped copy: cause of error unknown`. I am running as `sudo` and the container is `--writable`, does anyone have any ideas? – Paidoo Feb 21 '23 at 16:36
13

For all the "not found" libraries, identify their package as you have done with apt-file search for libQt5Gui.so.5. Then install the packages with sudo apt-get install,for example:

sudo apt-get install libqt5gui5

The installation of the packages should put the libraries in the proper location so they will be found.


If files are not present, either they were installed in the wrong place (manually forced somewhere), they are the wrong architecture (i386 instead of amd64, so would be in /usr/lib/i386-linux-gnu), or the installation did not run properly (check the status of the packages with the command:

dpkg -l | grep libqt5  

The properly installed packages will have status "ii".

You could use the locate command to find the file(s) if they are somewhere else on the system, but if you installed them, that possibility is not likely.

ubfan1
  • 17,041
  • 4
  • 39
  • 47
  • I have installed all the libqt5* packages but i can not find them on the location – jobycxa May 10 '18 at 12:14
  • Please see the below commands for clarification # dpkg -l | grep libqt5gui5 ii libqt5gui5:amd64 5.9.5+dfsg-0ubuntu1 amd64 Qt 5 GUI module – jobycxa May 11 '18 at 00:39
  • You can add such info to your original question. So it's installed, but not in the expected location. How did you install? Can you reinstall? Is anything present in /usr/lib/x86_64-linux-gnu (since the error might be a missing directory)? – ubfan1 May 11 '18 at 01:05
4

Try reinstall all libqt5 packages. It helped me in similar case:

sudo apt install --reinstall libqt5widgets5 libqt5gui5 libqt5dbus5 libqt5network5 libqt5core5a

After reinstalling ldd $(which qbittorrent) displayed all library .so files in their places.

Envek
  • 173
  • 6
  • 2
    not solved in my case – thanos.a May 31 '20 at 15:11
  • Which libraries are still missing in `ldd` output? – Envek Jun 02 '20 at 10:17
  • After installing the libraries you mentioned I still got the same error "ls: cannot access '/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5': No such file or directory". The I switched to sqlitebrowser in windows so currently I am unable to reproduce it. – thanos.a Jun 02 '20 at 10:19
  • This is weird: `dpkg --search /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5` says that this file is owned by `libqt5gui5` package. Please make sure that `libqt5gui5` is actually installed. – Envek Jun 02 '20 at 14:58
  • I am missing the libQt5Core.so.5 not the libqt5Gui.so.5. Here you are: https://paste.ofcode.org/utGtYmtGfTGwbyPGD4haEQ it is the libQt5Core.so.5 – thanos.a Jun 02 '20 at 15:12
  • Check whether library is actually in place (what `ls -lh /usr/lib/x86_64-linux-gnu/libQt5Core.so.5` says?) If it actually exists then check your system dynamic library loader settings (is row `/usr/lib/x86_64-linux-gnu` existis in file `/etc/ld.so.conf.d/x86_64-linux-gnu.conf`?). Read from here for details: https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html – Envek Jun 03 '20 at 15:46
1

Installed dependency to fix this issue.

You might want to run sudo apt --fix-broken install to correct these errors:

The following packages have unmet dependencies:
 virtualbox-6.1 : Depends: libqt5opengl5 (>= 5.0.2) but it is not going to be installed
                  Depends: libqt5x11extras5 (>= 5.6.0) but it is not going to be installed
                  Depends: libsdl1.2debian (>= 1.2.11) but it is not going to be installed
                  Recommends: libsdl-ttf2.0-0 but it is not going to be installed
d1bro
  • 2,274
  • 12
  • 23
0

I have working solution. Choose and download .deb package for your distribution from Official site: https://wkhtmltopdf.org/downloads.html

Next, my steps for Ubuntu 20.04:

  1. wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
  2. sudo apt --fix-broken install ./wkhtmltox_0.12.6-1.focal_amd64.deb