Ubuntu虚拟显示器且远程控制(无显示器接入)

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
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值