How to change virtual screen resolution on Ubuntu (connecting via VNC without real display connected)?

12

8

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?

GJ.

Posted 2010-08-29T21:24:54.663

Reputation: 8 151

Please provide info from xorg.conf – Andrew Bolster – 2010-09-10T22:31:50.553

Answers

10

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

SuperJames

Posted 2010-08-29T21:24:54.663

Reputation: 294

2Thanks, it works great for a new desktop. However, I need to use an existing desktop with various open windows already there. Is there a way I can connect to the original display :0 with a different geometry? – GJ. – 2010-09-26T18:43:18.087

... alternatively is there a way to move all windows in a single batch operation from the the main display to this new VNC display? – GJ. – 2010-09-26T18:44:24.840

Although I have not tried it yet, I believe that you can use "x11vnc" in the place of the "vncserver" above, with a specific -geometry parameter. This should give you access to the :0 display. I looked for parameters to the gnome vino server, but could not find any. – SuperJames – 2010-09-27T19:36:12.947

1

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

Andrew Bolster

Posted 2010-08-29T21:24:54.663

Reputation: 1 198

1

I'm able to change my vncserver resolution at will with the following command:

vncconfig -set randr=1552x1175 ; xrandr -s 1552x1175

( HT Matt D.)

Ross Rogers

Posted 2010-08-29T21:24:54.663

Reputation: 3 025

What is vncconfig? You mean vnc4config? – Wtower – 2014-12-19T09:42:31.050

Suse calls it vncconfig. – Ross Rogers – 2014-12-19T16:45:44.737

Ah, right then :) – Wtower – 2014-12-20T11:34:29.420