在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 5 的同時安裝 virtualbox 6 時遇到了同樣的問題。在安裝virtualbox-6.0之前,我只是嘗試過
sudo apt remove virtualbox
進而
sudo apt install virtualbox-6.0
但當嘗試“apt升級”時會導致:
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。
重啟
... 或 (不和)您只需重新啟動即可。