1.问题说明
当连接Ubuntu的显示器关闭时,即无显示器接入,通过Teamviewer和Anydesk等远程控制软件无法正常访问该Ubuntu系统。
2.解决方案
使用虚拟显示器,而后就能正常访问。
0.最开始安装桌面:
sudo apt install lightdm
配置为lightdm桌面。
1.安装Ubuntu虚拟显示器的软件(xserver-xorg-video-dummy):
sudo apt-get install xserver-xorg-core
sudo apt-get install xserver-xorg-video-dummy
sudo apt install xserver-xorg-core-hwe-18.04
or
sudo apt-get install xserver-xorg-video-dummy --fix-missing
2.修改/创建配置文件(慎用,默认就会使用虚拟显示器,而不是显示连接好的外接屏幕):
sudo gedit /etc/X11/xorg.conf
or
sudo gedit /usr/share/X11/xorg.conf.d/xorg.conf
Section "Device"
Identifier "Configured Video Device"
Driver "dummy"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
HorizSync 31.5-48.5
VertRefresh 50-70
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
注释:
Section “Device” # 显卡信息
Section “Monitor” # 显示器的信息
Section “Screen” # 显卡和显示器
3.重启电脑即可。注意:重启之后,即使接入了显示器,也不会输出信号到显示器上。
解决思路:
1)不需要虚拟显示器时,把/etc/X11/xorg.conf移动到桌面;
2)需要虚拟显示器时,从桌面移动到/etc/X11/xorg.conf;
命令:
sudo mv /etc/X11/xorg.conf /home/shalom/Desktop/xorg.conf
sudo mv /home/shalom/Desktop/xorg.conf /etc/X11/xorg.conf
4.xrandr: 在使用虚拟显示器之后,使用 xrandr 命令查看显示器信息。
xrandr -q
调整屏幕的分辨率:
xrandr --fb 1280x1024