Ubuntu 在 VirtualBox 中报错的原因有很多,具体要看报错内容。下面我按「常见报错类型」给你一个排查清单,你可以对照看看是哪一种。
报错示例
VT-x is not availableAMD-V is disabledFailed to open a session for the virtual machine解决方法
# 管理员 PowerShell
bcdedit /set hypervisorlaunchtype off
然后重启。
报错示例
Kernel driver not installedvboxdrv not loaded解决方法(Ubuntu 主机)
sudo apt update
sudo apt install --reinstall virtualbox-dkms
sudo /sbin/vboxconfig
或干脆升级 VirtualBox 到最新版。
可能原因
解决
报错
Unable to find the sources of your current kernel解决
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)
再安装 Guest Additions。
报错
UUID does not matchCannot register the hard disk解决
VBoxManage internalcommands sethduuid "磁盘路径.vdi"
你可以贴出:
例如:
Ubuntu 22.04 虚拟机,VirtualBox 7.0,报错:VT-x not available
我可以直接告诉你一步一步怎么修。