问题描述
在 VirtualBox 5.2.44, Guest Ubuntu 20.04 TLS 中,即使安装 Guest Additions 组件中,显示器分辨率自动调整还是存在问题。
最后,我们通过在 Ubuntu 中自定义分辨率来解决该问题,以实现虚拟机屏幕显示最大化。
该笔记将记录:在 Ubuntu 20.04 中,如何自定义屏幕分辨率(适用于 X.Org 桌面环境),以及相关问题的解决方法。
解决方案
临时配置
> cvt 1840 1015 # 1840x1015 59.94 Hz (CVT) hsync: 63.11 kHz; pclk: 154.50 MHz Modeline "1840x1015_60.00" 154.50 1840 1952 2144 2448 1015 1018 1028 1053 -hsync +vsync > xrandr --newmode "1840x1015_60.00" 154.50 1840 1952 2144 2448 1015 1018 1028 1053 -hsync +vsync > xrandr --listactivemonitors Monitors: 1 0: +*VGA-1 1840/487x1015/269+0+0 VGA-1 > xrandr --addmode VGA-1 1840x1015_60.00
最后,在 Settings 中,选择 1840×1015 分辨率即可。
持久保存
配置是临时的,无法持久化。如果希望持久化:
1)需要修改 ~/.profile 文件,添加命令,以在登录时自动执行;
2)或通过 xorg.conf 配置:How to set display resolution permanent in Ubuntu 16.04
常用设置
// ---------------------------------------------------------------------------- // Linux as Host # cvt 1880 972 # xrandr --newmode "1880x972_60.00" 151.25 1880 2000 2192 2504 972 975 985 1009 -hsync +vsync # xrandr --listactivemonitors ... # xrandr --addmode Virtual1 "1880x972_60.00" # cvt 1920 972 xrandr --newmode "1920x972_60.00" 154.75 1920 2040 2240 2560 972 975 985 1009 -hsync +vsync # xrandr --listactivemonitors xrandr --addmode Virtual2 "1920x972_60.00" // ---------------------------------------------------------------------------- // Windows as Host # cvt 1840 1015 xrandr --newmode "1840x1015_60.00" 154.50 1840 1952 2144 2448 1015 1018 1028 1053 -hsync +vsync # xrandr --listactivemonitors xrandr --addmode Virtual1 1840x1015_60.00
参考文献
How to Set A Custom Screen Resolution in Ubuntu Desktop | UbuntuHandbook
How to set display resolution permanent in Ubuntu 16.04 – Ask Ubuntu
Screen resolution not showing all options
Screen Resolution: xrandr “cannot find mode”