12

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

4
  • 2
    You'll want to post what worked for you as an answer so you can mark it as accepted and others can benefit.
    – kiri
    Oct 7, 2013 at 12:31
  • Seems same as askubuntu.com/questions/453109/…
    – user.dz
    Nov 1, 2014 at 22:54
  • TightVNC server does not have a -geometry option.
    – baptx
    Mar 3, 2021 at 18:12
  • -geometry. One dash, not two dashes. See vnc4server --help.
    – tai271828
    Apr 14, 2022 at 16:09

2 Answers 2

11

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

4
  • xrandr: command not found is what I get on Ubuntu 12.04. Suppose it isn't installed everywhere by default
    – vladkras
    May 16, 2016 at 4:13
  • How is this up voted? Gives the exact same error.
    – Elad Weiss
    May 15, 2019 at 12:08
  • Testing this on raspbian and setting it to the same resolution that the local Ubuntu screen is set to allows for the perfect fullscreen mode that you would expect. Currently connecting via vncviewer 6.22.515, but it should be the same for any viewer since the resolution is set on the host (vnc server) side.
    – iyrin
    Aug 19, 2022 at 6:52
  • This works great for me, thanks. How do you make it permanent? Dec 12, 2022 at 0:10
4

Looking at the documentation for xrandr, it relies on getting information from the display for supported resolutions. With no monitor connected, xrandr has no information to draw on for setting a display resolution and most likely draws from the resolution set in your Display preferences for the VNC connection. No display = no screen resolution changing.

6
  • I am using the VNC Viewer client from RealVNC, and can't find the option to control the screen resolution in client. and within the Ubuntu, $vnc4server --geometry 1440x900 does not help. Apr 28, 2013 at 11:06
  • Clarification: display resolution set from host computers' Display Preferences, not resolution settings of VNC client. If the host computer has no monitor attached, resolution switching will not work.
    – douggro
    Apr 28, 2013 at 16:15
  • But I can't change the resolution settings in System Settings >> Display, when I click it, it says "RANDR extension is too old(must be at least 1.2) Apr 29, 2013 at 2:53
  • 1
    Then you might have to remove and reinstall xrandr. Current version is 1.4.0. Regardless, without a monitor connected, you will not be able to switch resolutions. Without a monitor connected what is the output in Terminal of xrandr?
    – douggro
    Apr 29, 2013 at 3:09
  • I have updated my xrandr to 1.4.0-1 from here and still get same error. If I can't switch resolution within VNC after I connect, how can I set the resolution before I connect so it takes effect when I initially open the VNC viewer? Apr 29, 2013 at 7:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .