您好,我在 Ubuntu 22.04 上安装 Virtualbox 时遇到问题。Ubuntu 内核:5.17.2-051702-generic
重置配置的输出:
$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
linux-headers-generic linux-headers-5.17.2-051702-generic
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
linux-headers-generic linux-headers-5.17.2-051702-generic
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.
$ sudo systemctl status vboxdrv
× vboxdrv.service - VirtualBox Linux kernel module
Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-09-06 14:10:59 -03; 9min ago
CPU: 366ms
set 06 14:10:59 vboxdrv.sh[136567]: Starting VirtualBox services.
set 06 14:10:59 vboxdrv.sh[136549]: vboxdrv.sh: Building VirtualBox kernel modules.
set 06 14:10:59 vboxdrv.sh[136604]: This system is currently not set up to build kernel modules.
set 06 14:10:59 vboxdrv.sh[136604]: Please install the Linux kernel "header" files matching the current kernel
set 06 14:10:59 vboxdrv.sh[136604]: for adding new hardware support to the system.
set 06 14:10:59 vboxdrv.sh[136604]: The distribution packages containing the headers are probably:
set 06 14:10:59 vboxdrv.sh[136604]: linux-headers-generic linux-headers-5.17.2-051702-generic
set 06 14:10:59 systemd[1]: vboxdrv.service: Control process exited, code=exited, status=1/FAILURE
set 06 14:10:59 systemd[1]: vboxdrv.service: Failed with result 'exit-code'.
set 06 14:10:59 systemd[1]: Failed to start VirtualBox Linux kernel module.
任何帮助都值得感激,谢谢!
答案1
我的解决方案是:
sudo apt install gcc-12 --reinstall
sudo ln -s /usr/bin/gcc-12 /usr/bin/gcc -f
sudo apt install --reinstall linux-headers-$(uname -r) virtualbox-dkms dkms
核心:6.1-rc5和Virtualbox-7.0