![卸载模块](https://linux22.com/image/913058/%E5%8D%B8%E8%BD%BD%E6%A8%A1%E5%9D%97.png)
在 Ubuntu 中,VirtualBox 安装apt install virtualbox
仅提供旧版本 v5.2.18。
user@linux:~$ apt show virtualbox
Package: virtualbox
Version: 5.2.18-dfsg-2~ubuntu18.04.5
Priority: optional
Section: multiverse/misc
Origin: Ubuntu
最初,我使用这个版本有一段时间了。
然后,我决定下载并安装最新版本(v6.0.8)这里。
user@linux:~$ sha256sum virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb
17f1a24848dcf8ec1025790d35281f7f38b2c98740ddbccac6259a0f4c1786f7 virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb
user@linux:~$
最初,我无法安装最新版本。
user@linux:~$ sudo dpkg -i virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb
[sudo] password for user:
Selecting previously unselected package virtualbox-6.0.
dpkg: considering removing virtualbox in favour of virtualbox-6.0 ...
dpkg: no, cannot proceed with removal of virtualbox (--auto-deconfigure will help):
virtualbox-qt depends on virtualbox (= 5.2.18-dfsg-2~ubuntu18.04.5)
virtualbox is to be removed.
dpkg: regarding virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb containing virtualbox-6.0:
virtualbox-6.0 conflicts with virtualbox
virtualbox (version 5.2.18-dfsg-2~ubuntu18.04.5) is present and installed.
dpkg: error processing archive virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb (--install):
conflicting packages - not installing virtualbox-6.0
Errors were encountered while processing:
virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb
user@linux:~$
删除VirtualBox 5.2.18
解决了这个问题
user@linux:~$ sudo apt remove virtualbox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgsoap-2.8.60 virtualbox-dkms
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
virtualbox virtualbox-qt
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 108 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 229334 files and directories currently installed.)
Removing virtualbox-qt (5.2.18-dfsg-2~ubuntu18.04.5) ...
Removing virtualbox (5.2.18-dfsg-2~ubuntu18.04.5) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
user@linux:~$
然后,我再次继续安装,没有任何问题。
user@linux:~$ sudo dpkg -i virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb
(Reading database ... 229023 files and directories currently installed.)
Preparing to unpack virtualbox-6.0_6.0.8-130520~Ubuntu~bionic_amd64.deb ...
Unpacking virtualbox-6.0 (6.0.8-130520~Ubuntu~bionic) over (6.0.8-130520~Ubuntu~bionic) ...
Setting up virtualbox-6.0 (6.0.8-130520~Ubuntu~bionic) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
Processing triggers for systemd (237-3ubuntu10.23) ...
Processing triggers for ureadahead (0.100.0-21) ...
ureadahead will be reprofiled on next reboot
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (1.9-2) ...
user@linux:~$
不幸的是,我以前的图像都无法在新的 VirtualBox 上使用。
Failed to open a session for the virtual machine Ubuntu-18.04-Server.
The virtual machine 'Ubuntu-18.04-Server' has terminated unexpectedly during startup with exit code 1 (0x1).
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MachineWrap
Interface: IMachine {5047460a-265d-4538-b23e-ddba5fb84976}
发生了什么事以及如何解决这个问题?
答案1
我在安装 virtualbox 6 时遇到了同样的问题,因为 virtualbox 5 已经安装好了。在安装 virtualbox-6.0 之前,我尝试过
sudo apt remove virtualbox
进而
sudo apt install virtualbox-6.0
但尝试“apt upgrade”时出现以下问题:
The following packages have unmet dependencies:
virtualbox-6.0 : Conflicts: virtualbox
Conflicts: virtualbox-qt but 5.2.18-dfsg-2~ubuntu18.04.5 is to be installed
所以我意识到有些包没有被正确删除。
sudo apt autoremove --purge virtualbox*
sudo apt install virtualbox-6.0
最终对我有用。
答案2
“Virtualbox 内核模块与此版本的 virtualbox 不匹配”
我认为解释得很好。
你安装的 virtualbox 内核模块仍然是 5.xx 版本。但是你安装的 virtualbox 版本是 6.xx 有一个不匹配。
卸载模块
您可以手动卸下模块。
sudo modprobe -r vboxpci
sudo modprobe -r vboxnetadp
sduo mdoprobe -r vboxnetflt
[...]
sudo modprobe -r vboxdrv
注意:不要介意 modprobe 报告模块未找到
然后重新启动 virtualbox。
重启
... 或者 (不是并且)您只需重新启动即可。