Ubuntu修改屏幕分辨率

系统:Ubuntu 16.04 64bit openstack创建的实例

Ubuntu下通过xrandr和cvt命令修改屏幕分辨率

命令工具:xrandr cvt

  1. 用cvt增加一个新的分辨率,下面是创建一个1680x1050,刷新频率为60Hz的分辨率。

    cvt 1680 1050

    结果如下:

    ubuntu@host-192-168-96-5:~$ cvt 1680 1050
    # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
    Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
  2. 用xrandr查看当前分辨率。

  3. 新建分辨率

    sudo xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync

    上述参数与步骤1中的modeline的结果一致

  4. 添加新建分辨率到显示器(此处是VGA-1)

    sudo xrandr --addmode VGA-1 "1680x1050_60.00"
  5. 设置显示器的分辨率有两种方法

    • system setting中的display设置
    • 命令行xrandr -s 1680x1050
  6. 不过顺利的话就完成了,但是往往会出现意外,无法设置成功。此时需要手动设置:

    xrandr --output VGA-1 --mode "1680x1050_60.00"
  7. 保存分辨率,开机自启的方法:

    将可以把这个流程,其实也就newmode addmode output三步,做成脚本,开机启动。

    具体方法为:编辑vim etc/profile,在末尾增加:

    xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
    xrandr --addmode VGA-1 "1680x1050_60.00"
    xrandr --output VGA-1 --mode "1680x1050_60.00"

    立马启用修改后的配置:

    source /etc/profile
  8. 存在问题:

    • openstack平台不支持更换较高的分辨率,所以就会造成开机的时候又会恢复成原来的分辨率。不过可以通过在teamviewer上面再输出一次output命令,但是会造成openstack的实例卡住。
    • 如果想要恢复openstack的界面,要么重启,要么更改成更低的分辨率
    • 但是千万不要直接在system settings上设置成高分辨率的,会造成错误,两边都卡死。设置成低分辨率的没有问题,反正要是要设置成高分辨的就是用output命令。
    • 有时候会造成改不成高分辨的情况,那么此时的操作步骤是,先在displays上选择高分辨率的,此时会卡住,然后把拷贝的output命令在连接teamviewer的终端上输入。
    • [开机后]先登录openstack,能够进入系统后,然后再登录teamviewer连接。
    • [更改到更高的分辨率]在teamviewer上输入一遍xrandr --output命令,此时有可能会改不了,那么可以通过修改teamviewer的view上的分辨率,然后再xrandr --output 【问题】软件无法全屏【解决】利用xrandr -s 1680x1050_60.00
    • [降低到较低的分辨率]xrandr --output VGA-1 --mode "1280x1024"

Use fake screen to get videos

Because remote server has no display device, we can't see the training process and save videos.
So we will use the following method to get the remote screen.

  • Change GPU fan setting

    sudo nvidia-xconfig -a --cool-bits=4
  • Download the file dfp-edid.bin & move it to /etc/

  • Open xorg.conf

    sudo vim /etc/X11/xorg.conf
  • Insert the following three lines in each Section "Screen":

screen

Option      "UseDisplayDevice" "DFP-0"
Option      "ConnectedMonitor" "DFP-0"
Option      "CustomEDID" "DFP-0:/etc/dfp-edid.bin"
  • Restart X server(ex. lightdm)
sudo service lightdm restart
  • Auto login setting

bulid(or modify) file vim /etc/lightdm/lightdm.conf
write the following lines:

[Seat:*]
autologin-guest=false
autologin-user=username
autologin-user-timeout=0

then restart X server again. sudo service lightdm restart

  • Install anydesk

    • Download & upload to your server(via sftp, scp or using wget etc.)

    • Install deb: sudo dpkg -i anydesk.XXX.deb

    • Set password:

      anydesk --set-password
      • e.g.echo lovefm26671 | anydesk --with-password
    • run anydesk anydesk

    • Get ID: anydesk --get-id

    • (optinal) if it still doesn't work, try to use cmd export DISPLAY=:0

    • see Command Line Interface for more details.

Use AnyDesk

  • Download AnyDesk from official website, windowsx64 version in this tutorial.
  • Double click to run the application(no need to install).
  • Enter the ID we got from remote server.
  • Enter the password.
  • Then,you can see the remote desktop, enjoy it!

anydesk

posted @ 2020-09-11 09:14  xlchan  阅读(1653)  评论(0编辑  收藏  举报