在 Debian + VirtualBox 里设置显存,主要有两种方式:通过 VirtualBox 图形界面设置 和 通过命令行(VBoxManage)设置。下面分别说明,并补充一些常见注意事项。
关闭 Debian 虚拟机
显存只能在虚拟机关机状态下修改。
打开 VirtualBox 管理器
选中你的 Debian 虚拟机 → 点击 设置(Settings)
进入 显示(Display)
在 显存大小(Video Memory) 处调整:
可选设置:
点击 确定 → 启动 Debian
适合服务器或无 GUI 环境。
VBoxManage showvminfo "Debian" | grep -i "VRAM"
VBoxManage modifyvm "Debian" --vram 128
把
"Debian"换成你的虚拟机名称
glxinfosudo apt install mesa-utils
glxinfo | grep -i "memory"
grep -i vram /var/log/Xorg.0.log
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)
然后在 VirtualBox 菜单:
设备 → 安装增强功能(Insert Guest Additions CD)
建议:
VirtualBox 对 Wayland 支持有限,若出现显示问题:
echo "export GDK_BACKEND=x11" >> ~/.profile
或切换到 X11 登录会话。
| 使用场景 | 显存 | 3D 加速 |
|---|---|---|
| 命令行 | 16–32MB | 关闭 |
| Xfce / LXQt | 64–128MB | 开启 |
| GNOME / KDE | 128–256MB | 开启 |
如果你愿意,可以告诉我:
我可以给你一个最优配置方案。