我无法在 UBUNTU 上安装 virtual-box。我有一个 i686 CPU 和 UBNUTU 16.04 LTS。
但运行此命令会导致错误。
$ sudo aptitude reinstall virtualbox-dkms
The following packages will be REINSTALLED:
virtualbox-dkms
0 packages upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 617 kB of archives. After unpacking 0 B will be used.
Get: 1 http://us.archive.ubuntu.com/ubuntu xenial/multiverse i386 virtualbox-dkms all 5.0.18-dfsg-2build1 [617 kB]
Fetched 617 kB in 2s (251 kB/s)
(Reading database ... 189192 files and directories currently installed.)
Preparing to unpack .../virtualbox-dkms_5.0.18-dfsg-2build1_all.deb ...
------------------------------
Deleting module version: 5.0.18
completely from the DKMS tree.
------------------------------
Done.
Unpacking virtualbox-dkms (5.0.18-dfsg-2build1) over (5.0.18-dfsg-2build1) ...
Setting up virtualbox-dkms (5.0.18-dfsg-2build1) ...
Loading new virtualbox-5.0.18 DKMS files...
Building only for 4.15.0-45-generic
Building initial module for 4.15.0-45-generic
ERROR (dkms apport): kernel package linux-headers-4.15.0-45-generic is not supported
Error! Bad return status for module build on kernel: 4.15.0-45-generic (i686)
Consult /var/lib/dkms/virtualbox/5.0.18/build/make.log for more information.
Job for virtualbox.service failed because the control process exited with error code. See "systemctl status virtualbox.service" and "journalctl -xe" for details.
invoke-rc.d: initscript virtualbox, action "restart" failed.
● virtualbox.service - LSB: VirtualBox Linux kernel module
Loaded: loaded (/etc/init.d/virtualbox; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-09-03 02:49:59 +0430; 47ms ago
Docs: man:systemd-sysv-generator(8)
Process: 14663 ExecStart=/etc/init.d/virtualbox start (code=exited, status=1/FAILURE)
Sep 03 02:49:59 ee-sys systemd[1]: Starting LSB: VirtualBox Linux kern....
Sep 03 02:49:59 ee-sys virtualbox[14663]: * Starting VirtualBox kerne...s
Sep 03 02:49:59 ee-sys virtualbox[14663]: * No suitable module for ru...d
Sep 03 02:49:59 ee-sys virtualbox[14663]: ...fail!
Sep 03 02:49:59 ee-sys systemd[1]: virtualbox.service: Control process...1
Sep 03 02:49:59 ee-sys systemd[1]: Failed to start LSB: VirtualBox Lin....
Sep 03 02:49:59 ee-sys systemd[1]: virtualbox.service: Unit entered fa....
Sep 03 02:49:59 ee-sys systemd[1]: virtualbox.service: Failed with res....
Hint: Some lines were ellipsized, use -l to show in full.
系统类型
uname -a
Linux ee-sys 4.15.0-45-generic #48~16.04.1-Ubuntu SMP 2019 年 1 月 29 日星期二 18:03:19 UTC i686 i686 i686 GNU/Linux
日志:/var/lib/dkms/virtualbox/5.0.18/build/make.log
linux/alloc-r0drv-linux.c:31:/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:在函数“rtR0MemAllocEx”中:/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/the-linux-kernel.h:252:42:错误:“cpu_has_pge”未声明(在此函数中首次使用)# 定义 MY_PAGE_KERNEL_EXEC __pgprot(cpu_has_pge?__PAGE_KERNEL_EXEC | _PAGE_GLOBAL:__PAGE_KERNEL_EXEC)^ ./arch/x86/include/asm/pgtable_types.h:433:36: 注意:在宏“__pgprot”的定义中#define __pgprot(x) ((pgprot_t) { (x) } ) ^ /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:269:100: 注意:在宏“MY_PAGE_KERNEL_EXEC”的扩展中 pHdr = (PRTMEMHDR)__vmalloc(cb + sizeof(*pHdr), GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN, MY_PAGE_KERNEL_EXEC); ^ /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/the-linux-kernel.h:252:42: 注意:每个未声明的标识符仅在其出现在每个函数中报告一次 # define MY_PAGE_KERNEL_EXEC __pgprot(cpu_has_pge ? __PAGE_KERNEL_EXEC | _PAGE_GLOBAL : __PAGE_KERNEL_EXEC) ^ ./arch/x86/include/asm/pgtable_types.h:433:36: 注意:在宏“__pgprot”的定义中 #define __pgprot(x) ((pgprot_t) { (x) } ) ^ /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:269:100: 注意:在宏“MY_PAGE_KERNEL_EXEC”的扩展中 pHdr = (PRTMEMHDR)__vmalloc(cb + sizeof(pHdr)、GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN、MY_PAGE_KERNEL_EXEC); ^ 在从 /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:31:0 包含的文件中: /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c: 在函数“VBoxHost_RTMemContAlloc”中: /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/the-linux-kernel.h:309:47: 错误:函数“set_pages_x”的隐式声明 [-Werror=implicit-function-declaration] # define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages) ^ /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:444:13: 注意:在宏“MY_SET_PAGES_EXEC”的扩展中 MY_SET_PAGES_EXEC(&paPages[iPage], 1); ^ /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c: 在函数“VBoxHost_RTMemContFree”中:/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/the-linux-kernel.h:310:47: 错误:函数“set_pages_nx”的隐式声明 [-Werror=implicit-function-declaration] # define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages) ^ /var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:492:13: 注意:在宏的扩展中'MY_SET_PAGES_NOEXEC' MY_SET_PAGES_NOEXEC(&paPages[iPage], 1); ^ cc1:一些警告被视为错误 scripts/Makefile.build:332:目标“/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.o”的配方失败 make[2]:[/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv/r0drv/linux/alloc-r0drv-linux.o] 错误 1 scripts/Makefile.build:606: 目标‘/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv’的配方失败 make[1]: *[/var/lib/dkms/virtualbox/5.0.18/build/vboxdrv] 错误 2 Makefile:1551:目标配方'模块/var/lib/dkms/virtualbox/5.0.18/build' 失败 make:*** [模块/var/lib/dkms/virtualbox/5.0.18/build] 错误 2 make:离开目录“/usr/src/linux-headers-4.15.0-45-generic”
答案1
最后我解决了这个问题
删除旧的虚拟盒:
sudo apt remove virtualbox
从这里下载 virtualBox 5关联
在终端运行
$ sudo dpkg -i virtualbox-5.2_5.2.32-132073~Ubuntu~xenial_i386.deb
感谢您的ajgringo619
有益评论。
2021 年更新
强烈建议使用apt
而不是dpkg
安装程序包。
$ sudo apt-get install ./virtualbox-5.2_5.2.32-132073~Ubuntu~xenial_i386.deb