我正在运行 debian 7 并尝试使用以下命令安装 virtualbox:
sudo apt-get install virtualbox
并得到这个输出:
Selecting previously unselected package virtualbox.
Unpacking virtualbox (from .../virtualbox_4.1.18-dfsg-2+deb7u1_amd64.deb) ...
Selecting previously unselected package virtualbox-dkms.
Unpacking virtualbox-dkms (from .../virtualbox-dkms_4.1.18-dfsg-2+deb7u1_all.deb) ...
Selecting previously unselected package virtualbox-qt.
Unpacking virtualbox-qt (from .../virtualbox-qt_4.1.18-dfsg-2+deb7u1_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for menu ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for shared-mime-info ...
Processing triggers for desktop-file-utils ...
Setting up libvncserver0:amd64 (0.9.9+dfsg-1) ...
Setting up virtualbox (4.1.18-dfsg-2+deb7u1) ...
insserv: script virtualbox: service vboxdrv already provided!
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: error processing virtualbox (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of virtualbox-dkms:
virtualbox-dkms depends on virtualbox (>= 4.1.18-dfsg-2+deb7u1); however:
Package virtualbox is not configured yet.
dpkg: error processing virtualbox-dkms (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of virtualbox-qt:
virtualbox-qt depends on virtualbox (= 4.1.18-dfsg-2+deb7u1); however:
Package virtualbox is not configured yet.
dpkg: error processing virtualbox-qt (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
virtualbox
virtualbox-dkms
virtualbox-qt
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人可以帮忙吗?
答案1
这篇(法语)文章描述了 Debian 上的相同错误:Virtualbox 和 vboxdrv
解决方案是删除两个文件并重新安装 Virtualbox,如下所示
rm -r /etc/init.d/vboxdrv
rm -r /var/lib/update-rc.d/vboxdrv
apt-get install virtualbox virtualbox-dkms virtualbox-guest-utils virtualbox-guest-additions virtualbox-qt
文章还列出了适用于 Fedora 的解决方案:
/etc/init.d/vboxdrv setup
后来有一条评论说apt-get purge virtualbox
应该使用 而不是apt-get remove
,这也会删除初始化脚本,所以这也许是问题的真正原因,只需执行 即可解决purge
。
答案2
收到该错误后,尝试 apt-get -f install 强制安装由于错误而未加载的文件。然后再次尝试 apt-get upgrade,来回 apt-get -f install 直到只剩下出现错误的软件包。