问题
在ubuntu上使用apt-get安装软件包,系统会自动安装依赖的软件包,但是使用dpkg在ubuntu上安装软件包时不会,有时会遇到下面的错误:
pengdl@pengdl-HP:~/Soft$ sudo dpkg -i virtualbox-7.0_7.0.14-161095~Ubuntu~focal_amd64.deb [sudo] password for pengdl: Selecting previously unselected package virtualbox-7.0. (Reading database ... 278532 files and directories currently installed.) Preparing to unpack virtualbox-7.0_7.0.14-161095~Ubuntu~focal_amd64.deb ... Unpacking virtualbox-7.0 (7.0.14-161095~Ubuntu~focal) ... dpkg: dependency problems prevent configuration of virtualbox-7.0: virtualbox-7.0 depends on libqt5help5 (>= 5.9.0); however: Package libqt5help5 is not installed. virtualbox-7.0 depends on libqt5opengl5 (>= 5.0.2); however: Package libqt5opengl5 is not installed. virtualbox-7.0 depends on libqt5x11extras5 (>= 5.6.0); however: Package libqt5x11extras5 is not installed. virtualbox-7.0 depends on libqt5xml5 (>= 5.0.2); however: Package libqt5xml5 is not installed. dpkg: error processing package virtualbox-7.0 (--install): dependency problems - leaving unconfigured Processing triggers for systemd (245.4-4ubuntu3.23) ... Processing triggers for gnome-menus (3.36.0-1ubuntu1) ... Processing triggers for desktop-file-utils (0.24-1ubuntu3) ... Processing triggers for mime-support (3.64ubuntu1) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Processing triggers for shared-mime-info (1.15-1) ... Errors were encountered while processing: virtualbox-7.0
解决
- 查看当前的依赖关系问题:
$ sudo apt install --fix-missing 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-7.0 : Depends: libqt5help5 (>= 5.9.0) but it is not installed Depends: libqt5opengl5 (>= 5.0.2) but it is not installed Depends: libqt5x11extras5 (>= 5.6.0) but it is not installed Depends: libqt5xml5 (>= 5.0.2) 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 install --fix-broken pengdl@pengdl-HP:~/Soft$ sudo apt install --fix-broken Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: gir1.2-goa-1.0 libfwupdplugin1 libpkgconf3 libxmlb1 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libqt5help5 libqt5opengl5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5 The following NEW packages will be installed: libqt5help5 libqt5opengl5 libqt5sql5 libqt5sql5-sqlite libqt5x11extras5 libqt5xml5 0 upgraded, 6 newly installed, 0 to remove and 12 not upgraded. 1 not fully installed or removed. Need to get 554 kB of archives. After this operation, 2,408 kB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5sql5 amd64 5.12.8+dfsg-0ubuntu2.1 [121 kB] Get:2 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5help5 amd64 5.12.8-0ubuntu1 [134 kB] Get:3 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5opengl5 amd64 5.12.8+dfsg-0ubuntu2.1 [136 kB] Get:4 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5x11extras5 amd64 5.12.8-0ubuntu1 [10.3 kB] Get:5 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5xml5 amd64 5.12.8+dfsg-0ubuntu2.1 [105 kB] Get:6 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5sql5-sqlite amd64 5.12.8+dfsg-0ubuntu2.1 [47.6 kB] Fetched 554 kB in 1s (385 kB/s) Selecting previously unselected package libqt5sql5:amd64. (Reading database ... 279268 files and directories currently installed.) Preparing to unpack .../0-libqt5sql5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ... Unpacking libqt5sql5:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Selecting previously unselected package libqt5help5:amd64. Preparing to unpack .../1-libqt5help5_5.12.8-0ubuntu1_amd64.deb ... Unpacking libqt5help5:amd64 (5.12.8-0ubuntu1) ... Selecting previously unselected package libqt5opengl5:amd64. Preparing to unpack .../2-libqt5opengl5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ... Unpacking libqt5opengl5:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Selecting previously unselected package libqt5x11extras5:amd64. Preparing to unpack .../3-libqt5x11extras5_5.12.8-0ubuntu1_amd64.deb ... Unpacking libqt5x11extras5:amd64 (5.12.8-0ubuntu1) ... Selecting previously unselected package libqt5xml5:amd64. Preparing to unpack .../4-libqt5xml5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ... Unpacking libqt5xml5:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Selecting previously unselected package libqt5sql5-sqlite:amd64. Preparing to unpack .../5-libqt5sql5-sqlite_5.12.8+dfsg-0ubuntu2.1_amd64.deb ... Unpacking libqt5sql5-sqlite:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Setting up libqt5x11extras5:amd64 (5.12.8-0ubuntu1) ... Setting up libqt5sql5:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Setting up libqt5xml5:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Setting up libqt5opengl5:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Setting up libqt5sql5-sqlite:amd64 (5.12.8+dfsg-0ubuntu2.1) ... Setting up libqt5help5:amd64 (5.12.8-0ubuntu1) ... Setting up virtualbox-7.0 (7.0.14-161095~Ubuntu~focal) ... Adding group `vboxusers' (GID 138) ... Done. Processing triggers for libc-bin (2.31-0ubuntu9.14) ...
完。