需要帮助解决 Ubuntu 20.04 上 VirtualBox 安装失败的问题,请

需要帮助解决 Ubuntu 20.04 上 VirtualBox 安装失败的问题,请

我刚刚构建了一个新的 Ubuntu 桌面来替换我的旧机器,但未能成功安装 VirtualBox。这是我尝试安装时收到的消息:

sudo gdebi virtualbox-6.1_6.1.18-142142_Ubuntu_eoan_amd64.deb
[sudo] password for myusername: 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done

Oracle VM VirtualBox
 VirtualBox is a powerful PC virtualization solution allowing you to run a
 wide range of PC operating systems on your Linux system. This includes
 Windows, Linux, FreeBSD, DOS, OpenBSD and others. VirtualBox comes with a broad
 feature set and excellent performance, making it the premier virtualization
 software solution on the market.
Do you want to install the software package? [y/N]:y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
  c = findall("[[(](\S+)/\S+[])]", msg)[0].lower()
(Reading database ... 280449 files and directories currently installed.)
Preparing to unpack virtualbox-6.1_6.1.18-142142_Ubuntu_eoan_amd64.deb ...
Unpacking virtualbox-6.1 (6.1.18-142142~Ubuntu~eoan) over (6.1.18-142142~Ubuntu~eoan) ...
Setting up virtualbox-6.1 (6.1.18-142142~Ubuntu~eoan) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
Processing triggers for systemd (245.4-4ubuntu3.4) ...
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) .

然后我执行sudo /sbin/vboxconfig并收到上面显示的相同消息。

`sudo modprobe vboxdrv modprobe:严重:在目录 /lib/modules/5.11.6-051106-generic 中未找到模块 vboxdrv'

这是 vbox-setup.log 文件的摘录:

Building the main VirtualBox module.
Building the net filter module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/5.11.6-051106-generic/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j12 modules
make[1]: warning: -j12 forced in submake: resetting jobserver mode.
make -f ./scripts/Makefile.build obj=/tmp/vbox.0 \
single-build= \
need-builtin=1 need-modorder=1
  gcc -Wp,-MMD,/tmp/vbox.0/linux/.VBoxNetFlt-linux.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/9/include -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 --param=allow-store-data-races=0 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -include /tmp/vbox.0/include/VBox/SUPDrvMangling.h -fno-pie -Wno-declaration-after-statement -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_AMD64  -DMODULE  -DKBUILD_BASENAME='"VBoxNetFlt_linux"' -DKBUILD_MODNAME='"vboxnetflt"' -c -o /tmp/vbox.0/linux/VBoxNetFlt-linux.o /tmp/vbox.0/linux/VBoxNetFlt-linux.c
.
. **items left out**
.
/tmp/vbox.0/linux/VBoxNetFlt-linux.c: In function ‘vboxNetFltNeedsLinkState’:
/tmp/vbox.0/linux/VBoxNetFlt-linux.c:1761:47: error: dereferencing pointer to incomplete type ‘const struct ethtool_ops’
 1761 |     if (pDev->ethtool_ops && pDev->ethtool_ops->get_drvinfo)
      |                                               ^~
/tmp/vbox.0/linux/VBoxNetFlt-linux.c:1763:32: error: storage size of ‘Info’ isn’t known
 1763 |         struct ethtool_drvinfo Info;
      |                                ^~~~
/tmp/vbox.0/linux/VBoxNetFlt-linux.c:1766:20: error: ‘ETHTOOL_GDRVINFO’ undeclared (first use in this function)
 1766 |         Info.cmd = ETHTOOL_GDRVINFO;
      |                    ^~~~~~~~~~~~~~~~
/tmp/vbox.0/linux/VBoxNetFlt-linux.c:1766:20: note: each undeclared identifier is reported only once for each function it appears in
/tmp/vbox.0/linux/VBoxNetFlt-linux.c:1763:32: warning: unused variable ‘Info’ [-Wunused-variable]
 1763 |         struct ethtool_drvinfo Info;
      |                                ^~~~
make[2]: *** [scripts/Makefile.build:279: /tmp/vbox.0/linux/VBoxNetFlt-linux.o] Error 1
make[1]: *** [Makefile:1806: /tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:117: vboxnetflt] Error 2

然后我按照建议https://superuser.com/questions/1438279/how-to-sign-a-kernel-module-ubuntu-18-04但这似乎对安装没有帮助。

我的系统信息:

Kernel      : Linux 5.11.6-051106-generic (x86_64)
Version     : #202103111435 SMP Thu Mar 11 14:42:39 UTC 2021
C Library       : GNU C Library / (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
Distribution        : Ubuntu 20.04.2 LTS

-Computer-
Processor       : AMD Ryzen 5 5600X 6-Core Processor
Memory      : 32882MB (4133MB used)
Machine Type        : Desktop
Operating System        : Ubuntu 20.04.2 LTS
User Name       : root (root)
Date/Time       : Thu 11 Mar 2021 05:49:58 PM CST


任何帮助都将不胜感激。谢谢。

答案1

在搭载 5.1.14 主线内核的 Ubuntu 20.04 上测试

你应该安装测试构建此链接中的版本https://www.virtualbox.org/wiki/Testbuilds

首先卸载所有其他版本。

wget https://www.virtualbox.org/download/testcase/VirtualBox-6.1.19-142995-Linux_amd64.run
chmod +x VirtualBox*.run
./VirtualBox-6.1.19-142995-Linux_amd64.run

然后下载 extpack 文件并通过单击或在 VirtuaBox 中启动它。

wget https://www.virtualbox.org/download/testcase/Oracle_VM_VirtualBox_Extension_Pack-6.1.19-142994.vbox-extpack

您也可以在链接中找到每日构建(6.1.97)。

相关内容