Virtualbox 无法在 Ubuntu 18.04 上启动-Qt lib 问题

Virtualbox 无法在 Ubuntu 18.04 上启动-Qt lib 问题

在全新安装 Ubuntu 18.04(使用 GNOME)后,我通过以下方式安装了 virtualbox:sudo apt-get install virtualbox

但是,当我从命令行运行它时,我得到:

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

当我检查 Qt 库时,我发现它们已正确安装,因为它们具有 ii 状态。

dpkg -l | grep libqt5

ii  libqt5concurrent5:amd64                    5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 concurrent module
ii  libqt5core5a:amd64                         5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 core module
ii  libqt5dbus5:amd64                          5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 D-Bus module
ii  libqt5gui5:amd64                           5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 GUI module
ii  libqt5network5:amd64                       5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 network module
ii  libqt5opengl5:amd64                        5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 OpenGL module
ii  libqt5opengl5-dev:amd64                    5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 OpenGL library development files
ii  libqt5printsupport5:amd64                  5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 print support module
ii  libqt5sql5:amd64                           5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 SQL module
ii  libqt5sql5-sqlite:amd64                    5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 SQLite 3 database driver
ii  libqt5svg5:amd64                           5.9.5-0ubuntu1                      amd64        Qt 5 SVG module
ii  libqt5test5:amd64                          5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 test module
ii  libqt5widgets5:amd64                       5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 widgets module
ii  libqt5x11extras5:amd64                     5.9.5-0ubuntu1                      amd64        Qt 5 X11 extras
ii  libqt5x11extras5-dev:amd64                 5.9.5-0ubuntu1                      amd64        Qt 5 X11 extras development files
ii  libqt5xml5:amd64                           5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 XML module

但是,找不到以下库:

$ ldd /usr/lib/virtualbox/VirtualBox.so | grep not
libQt5Core.so.5 => not found
libQt5Gui.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
libQt5Widgets.so.5 => not found
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found

同样在这里:

$ ldd /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 | grep not
ldd: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: No such file or directory

还:

$ dpkg -S /usr/bin/virtualbox
virtualbox-qt: /usr/bin/virtualbox

然后我进一步搜索了 Qt 并找到了这个帖子,但解决方案也不起作用:Ubuntu 18.4 libQt5Core.so.5:无法打开共享对象文件:没有此文件或目录

您还可以看到库文件指向的位置:

ls -alht /usr/lib/x86_64-linux-gnu/libQt5*
lrwxrwxrwx 1 root root   24 Apr 14 21:31 /usr/lib/x86_64-linux-gnu/libQt5X11Extras.so.5 -> libQt5X11Extras.so.5.9.5
lrwxrwxrwx 1 root root   24 Apr 14 21:31 /usr/lib/x86_64-linux-gnu/libQt5X11Extras.so.5.9 -> libQt5X11Extras.so.5.9.5
-rw-r--r-- 1 root root  15K Apr 14 21:31 /usr/lib/x86_64-linux-gnu/libQt5X11Extras.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 14 21:23 /usr/lib/x86_64-linux-gnu/libQt5Svg.so.5 -> libQt5Svg.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 14 21:23 /usr/lib/x86_64-linux-gnu/libQt5Svg.so.5.9 -> libQt5Svg.so.5.9.5
-rw-r--r-- 1 root root 342K Apr 14 21:23 /usr/lib/x86_64-linux-gnu/libQt5Svg.so.5.9.5
lrwxrwxrwx 1 root root   25 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Concurrent.so.5 -> libQt5Concurrent.so.5.9.5
lrwxrwxrwx 1 root root   25 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Concurrent.so.5.9 -> libQt5Concurrent.so.5.9.5
-rw-r--r-- 1 root root  27K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Concurrent.so.5.9.5
lrwxrwxrwx 1 root root   37 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5EglFSDeviceIntegration.so.5 -> libQt5EglFSDeviceIntegration.so.5.9.5
lrwxrwxrwx 1 root root   37 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5EglFSDeviceIntegration.so.5.9 -> libQt5EglFSDeviceIntegration.so.5.9.5
-rw-r--r-- 1 root root 714K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5EglFSDeviceIntegration.so.5.9.5
lrwxrwxrwx 1 root root   30 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5EglFsKmsSupport.so.5 -> libQt5EglFsKmsSupport.so.5.9.5
lrwxrwxrwx 1 root root   30 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5EglFsKmsSupport.so.5.9 -> libQt5EglFsKmsSupport.so.5.9.5
-rw-r--r-- 1 root root  96K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5EglFsKmsSupport.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 -> libQt5Gui.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9 -> libQt5Gui.so.5.9.5
-rw-r--r-- 1 root root 5.4M Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.9.5
lrwxrwxrwx 1 root root   21 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5 -> libQt5OpenGL.so.5.9.5
lrwxrwxrwx 1 root root   21 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.9 -> libQt5OpenGL.so.5.9.5
-rw-r--r-- 1 root root 346K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5.9.5
lrwxrwxrwx 1 root root   27 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5PrintSupport.so.5 -> libQt5PrintSupport.so.5.9.5
lrwxrwxrwx 1 root root   27 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5PrintSupport.so.5.9 -> libQt5PrintSupport.so.5.9.5
-rw-r--r-- 1 root root 443K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5PrintSupport.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 -> libQt5Sql.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5.9 -> libQt5Sql.so.5.9.5
-rw-r--r-- 1 root root 292K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5.9.5
lrwxrwxrwx 1 root root   19 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Test.so.5 -> libQt5Test.so.5.9.5
lrwxrwxrwx 1 root root   19 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Test.so.5.9 -> libQt5Test.so.5.9.5
-rw-r--r-- 1 root root 217K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Test.so.5.9.5
lrwxrwxrwx 1 root root   22 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 -> libQt5Widgets.so.5.9.5
lrwxrwxrwx 1 root root   22 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.9 -> libQt5Widgets.so.5.9.5
-rw-r--r-- 1 root root 6.3M Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.9.5
lrwxrwxrwx 1 root root   21 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 -> libQt5XcbQpa.so.5.9.5
lrwxrwxrwx 1 root root   21 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.9 -> libQt5XcbQpa.so.5.9.5
-rw-r--r-- 1 root root 1.1M Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5 -> libQt5Xml.so.5.9.5
lrwxrwxrwx 1 root root   18 Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5.9 -> libQt5Xml.so.5.9.5
-rw-r--r-- 1 root root 240K Apr 13 00:24 /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5.9.5

有什么帮助吗?

答案1

谢谢cmak.fr为我指明解决方案。我不得不重新安装libqt5core5alibdouble-conversion1包。请注意,这也删除了virtualbox-qt,因此必须重新安装:

sudo apt-get remove libqt5core5a
sudo apt-get install libqt5core5a
sudo apt-get remove libdouble-conversion1
sudo apt-get install libdouble-conversion1
sudo apt-get install virtualbox-qt

最后,可以检查ldd /usr/lib/x86_64-linux-gnu/libQt5Core.so.5是否还有其他缺失的依赖项。如果有,请尝试找到相应的包名称并重新安装它们。

答案2

就我的情况(全新安装的 Ubuntu 18.10)ldd 显示只缺少 libQt5Widgets.so.5,运行 virtualbox 会显示如下内容:

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

因此,这非常接近 OP 的错误。因此,我不得不:

sudo apt install --reinstall libqt5widgets5

但后来我遇到了一个与该线程中上面的错误非常相似的错误:

Qt FATAL: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)

提升调试级别后:

export QT_DEBUG_PLUGINS=1

它表明我必须安装另外两个缺失的依赖项:

sudo apt install --reinstall libqt5dbus5
sudo apt install --reinstall libxcb-xinerama0

答案3

在更新的 Ubuntu 18.04 上,我遇到了与上述类似的问题,在终端上运行 virtualbox 时出现以下消息:

Qt FATAL: This application failed to start because it could not find or load
the Qt platform plugin "xcb" in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen,
vnc, xcb.

正如上面的答案所建议的那样,我尝试删除并重新安装,但没有成功。在对 virtualbox 二进制文件运行 ldd 后,我发现实际上没有缺少 Qt 库。

问题是 ld 实际上使用的 Qt 库版本与 virtualbox 预期的版本不同。原因是我曾经在默认位置 (/opt/Qt5) 安装了 Qt5,其所有库都是 5.13.2 版本。当然,当时我必须更新 ld.conf,以便 5.13.2 版本的 Qt 库在整个系统范围内可见。

花了好几个小时才找出发生了什么,所以我在这里分享它,以帮助人们将来解决这个问题,即使是在不同版本的 Ubuntu、virtualbox 和 Qt 软件中。

因此,在我纠正问题之前:(为了简洁起见,仅列出了其中一个 Qt 库)

libQt5Core.so.5 => /opt/Qt/5.13.2/gcc_64/lib/libQt5Core.so.5 (0x00007fd1f5a62000)

在我修正了问题之后:

libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f2518473000)

Ubuntu 18.04 中的 virtuabox 需要 5.9.5 版本的 Qt 库,因为上面的链接将到达文件

/usr/lib/x86_64-linux-gnu/libQt5Core.so.5.9.5

现在 virtualbox 可以完美运行了!

答案4

我在全新的 Ubuntu 18.04 中遇到了同样的问题。

然后我执行了下一个命令:

sudo apt upgrade

我得到了这个输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 virtualbox-6.1 : Depends: libqt5opengl5 (>= 5.0.2) but it is not installed
                  Depends: libsdl1.2debian (>= 1.2.11) but it is not installed
                  Recommends: libsdl-ttf2.0-0 but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

然后我运行:

sudo apt --fix-broken install

并且我能够成功打开Virtualbox!

相关内容