How to change the screen resolution in VNC viewer for Ubuntu 12.04 without a monitor?

I have Ubuntu 12.04 installed on a machine and I always use it remotely from VNC.
When I have monitor connected to this machine, I can change the resolution of my VNC viewer in the following line:

$vnc4server --geometry 1440x900

This worked for me, but I always use this machine remotely, I unplug the monitor and reboot. and the above command line not work anymore.

Then I tried xrandr

 SZ:    Pixels          Physical       Refresh
*0   1024 x 768    ( 260mm x 195mm )  *60  
Current rotation - normal
Current reflection - none
Rotations possible - normal 
Reflections possible - none

There is only one option available, so I tried to add a new one.

$cvt 1440 900
# 1440x900 59.89 Hz (CVT 1.30MA) hsync: 55.93 kHz; pclk: 106.50 MHz
Modeline "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync


$xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync

$xrandr --addmode S2 "1440x900_60.00"

then I checked with xrandr again and can’t see the new mode added.

I try to execute the following command and get error says my RandR is too old.

$xrandr --output S2 --mode 1440x900_60.00
xrandr: Server RandR version before 1.2

but this does not make sense to me, if I plug in the monitor back and run the xrandr command, it works again! It seems that Ubuntu must conntect to a real monitor before I can change my resolution in my VNC viewer.

Can anyone help?

UPDATE:
Finally I solved this problem by changing to tightvncserver

$tightvncserver -geometry 1440x900 

works for me.

Thanks everything answered my question

Answer

You can change resolution when you connect to monitor-less PC via VNC by executing the following command:

xrandr --fb 1280x1024

Source:
http://www.x.org/archive/X11R7.5/doc/man/man1/xrandr.1.html

Attribution
Source : Link , Question Author : Mr.Wang from Next Door , Answer Author : John M

Leave a Comment