How to change virtual screen resolution on Ubuntu (connecting via VNC without real display connected)?
I have an Ubuntu server with no physical access to it, only via ssh/vnc.
It is stuck on a 1680x1050 resolution and in the system display settings the menus are disabled since there is no detected real display connected.
I need to lower the resolution to e.g. 800x600.
When I try:
$ xrandr --output VGA1 --mode 800x600
I'm getting:
xrandr: cannot find mode 800x600
The results are the same even if I first try:
$ xrandr --newmode "800x600_60.00" 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync
The props are:
$ xrandr --prop
Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 4096 x 4096
VGA1 disconnected 1680x1050+0+0 (normal left inverted right x axis y axis) 593mm x 371mm
1680x1050 (0x43) 146.2MHz
h: width 1680 start 1784 end 1960 total 2240 skew 0 clock 65.3KHz
v: height 1050 start 1053 end 1059 total 1089 clock 60.0Hz
Any ideas?
It sounds like you are using the vino server to share the desktop via VNC. Although I think you can change your /etc/X11/xorg.conf, or whatever the X config file is now, I have another suggestion. Leave the X config alone and create another session for your vnc.
Install vnc
$ sudo apt-get install vnc4server
Create vnc start and stop scripts
vnc.sh
#!/bin/sh
vncserver :12 -name "My-Server" -geometry 1600x1100
vnc-kill.sh
#!/bin/sh
vncserver -kill :12
12 is just an arbitrary display number. You will use this when you connect to the server. It can be any number except 0. That is what the vino server uses by default (I think). Don't forget to chmod +x the scripts.
Optional: Start vnc session on boot
Add the vnc.sh to your /etc/rc.local so that the session will start when the computer starts. sudo vi /etc/rc.local and add this to the end before the "exit 0"
su - YourUserName -c "/home/YourUserName/bin/vnc.sh"
I run the vnc server as a user here. I don't want the server to run under the root context. Replace the "YourUserName", of course. Alternatively, you do not need to put this here, you could ssh in and run the "vnc.sh" script manually. Your call.
Set your vnc password
(this is separate from the other vnc desktop password)
$ vncpasswd
Edit your vnc session file
$ vi ~/.vnc/xstartup
Comment out everything and put this at the end
gnome-session &
Test it
Run your vnc.sh script and connect from another computer.
vncviewer.exe -connect Server:12
You could consider changing the resolution on the VNC server?
I'm not sure of your setup but if the VNC server is on the virtualized machine you could check the vncserver instantiation point and change the -geometry
flag there?
Alternatively, I would look at xorg.conf and add the mode you are looking for, since xrandr
is saying its not availiable. This article covers the basics of xorg.conf editing
I'm able to change my vncserver resolution at will with the following command:
vncconfig -set randr=1552x1175 ; xrandr -s 1552x1175
( HT Matt D.)