Changing screen resolution on a headless Ubuntu machine?

Joined
Oct 30, 2002
Messages
42,371
Location
Great Lakes
I have a headless media PC running Ubuntu 18.04.

Years ago, back when I initially set it up, I had to configure a dummy display on it or else I couldn't connect remotely to it with TeamViewer because TeamViewer was not detecting any monitor output. Now I want to change the resolution that I initially set for that dummy display, but for the life of me I can't recall how I did it. I appear to have the xserver-xorg-video-dummy installed, but the machine is not responding to any changes in resolution made in xorg.conf file.


I also appear to have a "resolution.sh.desktop" file sitting in /home/username/.config/autostart folder which is pointing to a "resolution.sh" file that has a few xrandr commands in it, but again, any changes I make to this resolution.sh file are not making any difference.

I've googled for hours, and still can't figure out how to change the resolution. The max resolution currently set is 1360x768 and I want to change it so something higher.

Thanks.
 
Can you connect a monitor to the machine just for configuration?
This won't work. As soon as I disconnect the monitor, the higher resolution will disappear.

Yes, as I mentioned above, I already played around with xorg, but any changes made to xorg.config file seem to be ignored. Possibly I'm doing something wrong, but can't figure it out. Even manually trying to increase resolution by executing xrandr commands fails. It keeps saying "xrandr: Failed to get size of gamma for output default."

The machine keeps thinking 1360x768 is max. I've obviously defined it somewhere in the past. I just can't recall how/where.
 
Last edited:
The machine will be looking at /etc/X11/xorg.conf as well as anything and everything in /usr/share/X11/xorg.conf.d/; the latter overriding the former. One can certainly step on one's you-know-what by editing something.conf when their original edits were in a new file in something.conf.d/myedits.conf. I wouldn't know anything about that, of course.

From your description in the OP, the .desktop file seems unnecessary: Could the bash script not be placed directly into the autostart directory?
I'm throwing Hail Mary's, here; but is resolution.sh executable? (Maybe a quick chmod +x /path/to/resolution.sh would tie that one up; sudo chmod... if the file is somewhere other than your /home.)

... And I'd expect the xrandr command to look something akin to (if you wanted 1280x1024, for example):
Bash:
xrandr --fb 1280x1024 -display :0

Is there some funky instruction in GRUB that'd limit the resolution? Does the card and/ or memory assigned to it support the resolution/ frame rate you're asking of it?
 
The machine will be looking at /etc/X11/xorg.conf as well as anything and everything in /usr/share/X11/xorg.conf.d/; the latter overriding the former. One can certainly step on one's you-know-what by editing something.conf when their original edits were in a new file in something.conf.d/myedits.conf. I wouldn't know anything about that, of course.
I have the same xorg.conf file in both directories, and it looks like this:
Code:
Section "Device"
Identifier "Configured Video Device"
Driver "dummy"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
HorizSync 31.5-48.5
VertRefresh 50-70
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection


From your description in the OP, the .desktop file seems unnecessary: Could the bash script not be placed directly into the autostart directory?
I'm throwing Hail Mary's, here; but is resolution.sh executable? (Maybe a quick chmod +x /path/to/resolution.sh would tie that one up; sudo chmod... if the file is somewhere other than your /home.)
Sorry, this went right over my head. I don't know too much about Linux.


... And I'd expect the xrandr command to look something akin to (if you wanted 1280x1024, for example):
Bash:
xrandr --fb 1280x1024 -display :0
This is what happens when I execute this xrandr command:
Code:
xrandr: Failed to get size of gamma for output default
xrandr: specified screen 1280x1024 not large enough for output default (1360x768+0+0)
xrandr: screen cannot be larger than 1360x768 (desired size 1280x1024)
So again, something somewhere is telling it that 1360x768 is the max. I know I configured this specific resolution somewhere by following some youtube video, I just can't recall where/how.


Is there some funky instruction in GRUB that'd limit the resolution?
I have this in GRUB:
Code:
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="nomodeset"


Does the card and/ or memory assigned to it support the resolution/ frame rate you're asking of it?
It's an integrated Intel HD Graphics 5000. According to Intel, max resolution is 3280x2000@60Hz. I am only trying to go up to 1920x1080@60Hz.
 
Contents of resolution.sh.desktop:
Code:
[Desktop Entry]
Type=Application
Exec=/home/pete/resolution.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_CA]=Resolution Update
Name=Resolution Update
Comment[en_CA]=
Comment=

Contents of resolution.sh:
Code:
#!/bin/bash

xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VIRTUAL1 1920x1080_60.00
xrandr --output VIRTUAL1 --mode 1920x1080_60.00
 
I think with that chipset at 3280x2000@60Hz, you're going to have to figure out how to have your dummy monitor be HDMI only.
 
Here is someone who asked a similar question and had some fiddlin' to do with xrandr commands which seemed to work:

 
Here is someone who asked a similar question and had some fiddlin' to do with xrandr commands which seemed to work:

Every xrandr command I execute results in this error message: "Failed to get size of gamma for output default" and I can't figure out how to solve it.
 
OK, I've figured it out. @wwillson was right earlier - Intel video drivers were not loading. After running this command:
Code:
apt install xserver-xorg-hwe-18.04 xserver-xorg-video-all-hwe-18.04
Intel drivers got installed - it is now correctly reporting the name of the graphics card and I've got my higher resolution.

Thanks all.
 
Back
Top