系統:Ubuntu 16.04 64bit openstack創建的實例
Ubuntu下通過xrandr和cvt命令修改屏幕分辨率
命令工具:xrandr cvt
-
用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
-
用xrandr查看當前分辨率。
-
新建分辨率
sudo xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
上述參數與步驟1中的modeline的結果一致
-
添加新建分辨率到顯示器(此處是VGA-1)
sudo xrandr --addmode VGA-1 "1680x1050_60.00"
-
設置顯示器的分辨率有兩種方法
- system setting中的display設置
- 命令行xrandr -s 1680x1050
-
不過順利的話就完成了,但是往往會出現意外,無法設置成功。此時需要手動設置:
xrandr --output VGA-1 --mode "1680x1050_60.00"
-
保存分辨率,開機自啟的方法:
將可以把這個流程,其實也就
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
-
存在問題:
- 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":
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
- e.g.
-
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!