如何在 Debian 8 中安装 VirtualBox?

如何在 Debian 8 中安装 VirtualBox?

所以,我为此哭了好几个小时。我一直在尝试在 64 位 Debian Jessie 中安装 virtual box 5.0,但我一直无法弄清楚。我尝试从 .deb 源安装它,然后我发现,一切都无济于事。最后一个似乎是最有希望的,所以我决定采用它。我更新了 resources.list 文件,运行了wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -,最后:

sudo apt-get update
sudo apt-get install virtualbox-5.0 

好吧,在最后一个命令中,我得到以下输出(请记住我已经完成了sudo apt-get install linux-headers-$(uname -r)):

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libsdl-ttf2.0-0
Recommended packages:
  linux-headers
The following NEW packages will be installed:
  libsdl-ttf2.0-0 virtualbox-5.0
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/64.1 MB of archives.
After this operation, 158 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libsdl-ttf2.0-0:amd64.
(Reading database ... 238408 files and directories currently installed.)
Preparing to unpack .../libsdl-ttf2.0-0_2.0.11-3_amd64.deb ...
Unpacking libsdl-ttf2.0-0:amd64 (2.0.11-3) ...
Selecting previously unselected package virtualbox-5.0.
Preparing to unpack .../virtualbox-5.0_5.0.14-105127~Debian~jessie_amd64.deb ...
Unpacking virtualbox-5.0 (5.0.14-105127~Debian~jessie) ...
Processing triggers for systemd (215-17+deb8u3) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for mime-support (3.58) ...
Setting up libsdl-ttf2.0-0:amd64 (2.0.11-3) ...
Setting up virtualbox-5.0 (5.0.14-105127~Debian~jessie) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modules ...done.
Trying to register the VirtualBox kernel modules using DKMSError! Bad return status for module build on kernel: 3.16.0-4-amd64 (x86_64)
Consult /var/lib/dkms/vboxhost/5.0.14/build/make.log for more information.
 ...failed!
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...failed!
  (Look at /var/log/vbox-install.log to find out what went wrong)
Processing triggers for libc-bin (2.19-18+deb8u2) ...

然后,当我尝试运行时virtualbox,我得到:

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (3.16.0-4-amd64) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /sbin/rcvboxdrv setup

         You will not be able to start VMs until this problem is fixed.

所以,我自然会这样做sudo /sbin/rcvboxdrv setup,以获得:

Bad argument setup

所以,我这样做了sudo /sbin/rcvboxdrv,但没有得到任何输出。然后我virtualbox再次运行并得到与上面相同的错误。有任何想法吗?

更新:使用向后移植安装,我收到此错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libsdl-ttf2.0-0
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  libgsoap5 libvncserver0 virtualbox-dkms virtualbox-qt
Suggested packages:
  vde2 virtualbox-guest-additions-iso
The following NEW packages will be installed:
  libgsoap5 libvncserver0 virtualbox virtualbox-dkms virtualbox-qt
0 upgraded, 5 newly installed, 0 to remove and 82 not upgraded.
Need to get 22.0 MB of archives.
After this operation, 97.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.us.debian.org/debian/ jessie/main libgsoap5 amd64 2.8.17-1 [202 kB]
Get:2 http://ftp.us.debian.org/debian/ jessie/main libvncserver0 amd64 0.9.9+dfsg2-6.1+deb8u1 [191 kB]
Get:3 http://httpredir.debian.org/debian/ jessie-backports/contrib virtualbox-dkms all 5.0.14-dfsg-1~bpo8+1 [639 kB]
Get:4 http://httpredir.debian.org/debian/ jessie-backports/contrib virtualbox-qt amd64 5.0.14-dfsg-1~bpo8+1 [7,030 kB]
Get:5 http://httpredir.debian.org/debian/ jessie-backports/contrib virtualbox amd64 5.0.14-dfsg-1~bpo8+1 [14.0 MB]
Fetched 22.0 MB in 4s (4,454 kB/s)                                            
Selecting previously unselected package libgsoap5:amd64.
(Reading database ... 238416 files and directories currently installed.)
Preparing to unpack .../libgsoap5_2.8.17-1_amd64.deb ...
Unpacking libgsoap5:amd64 (2.8.17-1) ...
Selecting previously unselected package libvncserver0:amd64.
Preparing to unpack .../libvncserver0_0.9.9+dfsg2-6.1+deb8u1_amd64.deb ...
Unpacking libvncserver0:amd64 (0.9.9+dfsg2-6.1+deb8u1) ...
Selecting previously unselected package virtualbox-dkms.
Preparing to unpack .../virtualbox-dkms_5.0.14-dfsg-1~bpo8+1_all.deb ...
Unpacking virtualbox-dkms (5.0.14-dfsg-1~bpo8+1) ...
Selecting previously unselected package virtualbox.
Preparing to unpack .../virtualbox_5.0.14-dfsg-1~bpo8+1_amd64.deb ...
Unpacking virtualbox (5.0.14-dfsg-1~bpo8+1) ...
Selecting previously unselected package virtualbox-qt.
Preparing to unpack .../virtualbox-qt_5.0.14-dfsg-1~bpo8+1_amd64.deb ...
Unpacking virtualbox-qt (5.0.14-dfsg-1~bpo8+1) ...
Processing triggers for systemd (215-17+deb8u3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for mime-support (3.58) ...
Setting up libgsoap5:amd64 (2.8.17-1) ...
Setting up libvncserver0:amd64 (0.9.9+dfsg2-6.1+deb8u1) ...
Setting up virtualbox-dkms (5.0.14-dfsg-1~bpo8+1) ...
Loading new virtualbox-5.0.14 DKMS files...
First Installation: checking all kernels...
Building only for 3.16.0-4-amd64
Building initial module for 3.16.0-4-amd64
Error! Bad return status for module build on kernel: 3.16.0-4-amd64 (x86_64)
Consult /var/lib/dkms/virtualbox/5.0.14/build/make.log for more information.
Setting up virtualbox (5.0.14-dfsg-1~bpo8+1) ...
[ ok ] Stopping VirtualBox kernel modules.
[....] Starting VirtualBox kernel modules[....] No suitable module for running k[FAIL found ... failed!
 failed!
invoke-rc.d: initscript virtualbox, action "restart" failed.
Setting up virtualbox-qt (5.0.14-dfsg-1~bpo8+1) ...
Processing triggers for libc-bin (2.19-18+deb8u2) ...
Processing triggers for systemd (215-17+deb8u3) ...

答案1

使用 Debian jessie-backportsvirtualbox软件包。版本是5.0.14-dfsg-1~bpo8+1.我在 AMD64 Jessie 安装中使用它,零问题。当然,请确保首先删除所有其他相关软件包和本地安装。

要安装,请添加:

deb httpredir.debian.org/debian jessie-backports main contrib non-free

给你的/etc/apt/sources.list.然后跑apt-get update。要安装,请执行

apt-get install -t jessie-backports virtualbox

需要说明的是,这些是 Debian 中当前可用的版本virtualbox,适用于 jessie 及更高版本。

apt-cache policy virtualbox
virtualbox:
  Installed: 5.0.14-dfsg-1~bpo8+1
  Candidate: 5.0.14-dfsg-1~bpo8+1
  Version table:
     5.0.14-dfsg-2+b1 0
         50 tor+http://httpredir.debian.org/debian/ unstable/contrib amd64 Packages
 *** 5.0.14-dfsg-1~bpo8+1 0
        100 tor+http://httpredir.debian.org/debian/ jessie-backports/contrib amd64 Packages
        100 /var/lib/dpkg/status
     4.3.36-dfsg-1+deb8u1 0
        500 tor+http://security.debian.org/ jessie/updates/contrib amd64 Packages
     4.3.32-dfsg-1+deb8u2 0
        500 tor+http://httpredir.debian.org/debian/ jessie/contrib amd64 Package

此列表不包括测试版本。

相关内容