Mostly people avoid using Linux as it is more inclined towards commands and not GUI. But some of the distributions like Ubuntu, Mint etc provide good GUI interface to interact and customize things. Using commands will give you a thorough knowledge of the actual things happening inside the system. Like today I connected my laptop to a much bigger display using VGA cable. But my linux distribution based on Debian was not able to recognize this other monitor. Changing the resolution using the normal settings resulted in only two resolution options which were too low. So today we will see how to change resolution of unknown display in Linux.
Here is the normal way to change the display resolution using the settings panel. Jump into Menu -> Settings. After that choose Display out of all the other things. If you have connected your laptop/PC to another monitor/projector/display then you will see both. Select the display whose resolution you want to change. If the display is recognized by the system then you will see various resolution options. But that is not the case for unknown display.
How to change resolution of unknown display in Linux?
We will do this using a preinstalled utility called ‘xRandR’, which can configure the orientation, size and reflection for different output screens. It is really no rocket science, just follow the commands mentioned below and the issue will be resolved.
We will start by checking some information like default available resolutions, frequency and devices connected. Open up your terminal and type in:
# xrandr
Note: You can use sudo if it asks for permission
You will get an output like the one mentioned below. Just remember the connected devices parameter from this.
Now you have the available resolutions, connected devices, refresh rates and stuff like that. You can always go ahead and add custom resolutions to xrandr if they are not present in the default file. Next we need to generate the modeline for the desired resolution of our unknown display. Mine is a Samsung Syncmaster monitor with a max resolution of 1440×900.
# cvt 1440 900
You are reading: How to change resolution of unknown display in Linux
Just substitute your desired values and you will get the modeline like this:
After that we need to define this new mode in the system using ‘newmode’ attribute. Just copy the content from the previous output after Modeline and use it with this command : xrandr –newmode modeline
# xrandr –newmode “1440x900_60.00” 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
After defining the mode, you need to add it in the system using addmode command.
# xrandr –addmode VGA1 1440x900_60.00
VGA1 is the output device parameter taken from the result of first step. 1440×900 is my desired resolution while 60 is the refresh rate. In your case you can refer the modeline for the values. The new resolution is now successfully added and we just need to set it using this command:
# xrandr –output VGA1 –mode 1440x900_60.00
This is the final command which will change the resolution of your unknown display. These commands will just make temporary changes until the system is rebooted. After that the changes will be gone, so we need to add this to the startup default parameters.
You can either make a bash or python script and initialize it to run at the start. Or add these commands to /etc/gdm/init this file. In my case it was gdm3 instead of just gdm. To edit the file simply type:
# nano /etc/gdm3/init
After adding the commands, just give your system a restart and check if everything is working properly. So this is how to change the resolution of unknown display in linux. If you have any doubts please post them in the comment section below.
That script threw some errors in my Ubuntu 16.04 because it is creating the modeline too late at boot, so I’ve found that creating a new xorg.conf for unknown monitor works fine because it takes effect earlier on in the bootup sequence.
cat /usr/share/X11/xorg.conf.d/10-monitor.conf
Section “Monitor”
Identifier “DP1”
Modeline “1440x900_60.00” 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
Option “PreferredMode” “1440x900_60.00”
Option “DPMS” “true”
EndSection
See also:
https://wiki.archlinux.org/index.php/multihead
https://wiki.ubuntu.com/X/Config/Multihead/