Cannot add new mode in xrandr for external monitor

34,747

Solution 1

I am not sure if you have created the string following xrandr --newmode by yourself or have you copied it from somewhere else, but it won't work in its current form.

I recommend to do it step by step.

First, you need to generate the new mode. I recommend using 60Hz with LCD or 85Hz with CRT monitor

gtf 1280 1024 60

You will get something like:

 # 1280x1024 @ 60.00 Hz (GTF) hsync: 63.60 kHz; pclk: 108.88 MHz 
 Modeline "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync Vsync

Then present this mode to xrandr using --newmode (copy-paste the line starting with 'Modeline'.

 xrandr --newmode "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync Vsync

Then add this mode to VGA-0:

xrandr --addmode VGA-0 "1280x1024_60.00"

And finally you can use this new mode:

 xrandr --output VGA-0 --mode 1280x1024_60.00

Solution 2

i had this BadMatch Error problem until i deleted a previously added "1280x1024_60.00" because it could never use the double quoted mode successfully. Eventually, realized a better name for the mode helped.

So i deleted "1280x1024_60.00" by running the following as a normal user:

$ xrandr --version 
reports 1.4.0 and 1.4
$ xrandr | grep 1280 #Do you see any 1280x1024 anywhere?  Does it have double quotes?
$ xrandr --verbose --delmode VGA1 '"1280x1024_60.00"'
$ xrandr --verbose --rmmode '"1280x1024_60.00"' 

Deleting and removing the junk in the system often did not work or would come back even though i would delete it from my account and root. It would usually come back under the output named VIRTUAL1 instead of VGA1.

Found it much easier to leave the junk and to append a letter at the end of my newly created mode and even dropped the .00, so 1280x1024_60B. Note carefully below there are double quotes around the --newmode parameter, but NOT --addmode nor --mode

$ xrandr --verbose --newmode "1280x1024_60B" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync
$ xrandr --verbose --addmode VGA1 1280x1024_60B
$ xrandr --verbose --output VGA1 --mode 1280x1024_60B

A little screen flicker and my external 19" square monitor is running at 1280x1024.

Share:
34,747

Related videos on Youtube

Borgo
Author by

Borgo

Updated on September 18, 2022

Comments

  • Borgo
    Borgo over 1 year

    Today I was trying to connect my second monitor to my notebook. I have:

    • nvidia graphic card
    • 304.43 drivers [support xrandr 1.2]
    • archlinux [up-to-date]
    • awesome wm
    • xrandr 1.3

    My problem is with bigger resolution than 640x480 for my external monitor (VGA). xrandr -q:

    Screen 0: minimum 8 x 8, current 1920 x 800, maximum 8192 x 8192
    VGA-0 connected 640x480+1280+0 (normal left inverted right x axis y axis) 0mm
       640x480        59.9*+
       320x240       120.1  
    LVDS-0 connected 1280x800+0+0 (normal left inverted right x axis y axis) 331m
       1280x800       59.9*+
    HDMI-0 disconnected (normal left inverted right x axis y axis)
    

    As we can see the is no higher resolution fo VGA, so I add new mode:

    xrandr --newmode $(gtf 1280 1024 70.4 | grep Modeline | sed s/Modeline\ // | tr -d '"')
    

    I checked avaible resolution and refresh rate under windows: one of them was 1024x768x70 (OSD of my monitor said that it is 70.4HZ). After create new mode, I wanted to add it:

    xrandr --addmode VGA-0 1280x1024_70.40
    

    And... It failed:

    X Error of failed request:  BadMatch (invalid parameter attributes)
      Major opcode of failed request:  153 (RANDR)
      Minor opcode of failed request:  18 (RRAddOutputMode)
      Serial number of failed request:  29
      Current serial number in output stream:  30
    

    From google I learned that in older xrandr / nvidia drivers was problem with list of avaible modes, but now with support of xrandr 1.2 by nvidia drivers it should be better. I also try with lower resolution and refresh rate (eg. 1024x768x50), but I've got the same error. I'm out of ideas what to do with this problem...

  • Borgo
    Borgo over 11 years
    You're right, I don't create this: xrandr --newmode $(gtf 1280 1024 70.4 | grep Modeline | sed s/Modeline\ // | tr -d '"') by myself, but I put this into small pieces first to look how it work, first gtf 1280 1024 70.4, then with grep and finally with sed and tr. It give the same output which You have in Your xrandr --newmode with one diff - You have "1280x1024_60.00", I have 1280x1024_60.00` - at the end I'm using tr -d '"' to delete '"'. Unfortunatly I still have the same error.
  • Paweł Rumian
    Paweł Rumian over 11 years
    Why so strange refresh rate? 70.4? Use 60Hz if it's an LCD or 85Hz in case of CRT. And do it step by step, exactly as I have written.
  • Borgo
    Borgo over 11 years
    Now I tried do it step by step, using 60Hz, and I have still the same error.
  • Paweł Rumian
    Paweł Rumian over 11 years
    What is the resolution of your monitor and what mode are you trying to add?
  • Borgo
    Borgo over 11 years
    My resolution is 1280x1024, and I am trying to make (newmode) / add (addmode) this mode: "1280x1024_60.00" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync
  • Paweł Rumian
    Paweł Rumian over 11 years
    PLease paste the exact commands you use and the error message.
  • Borgo
    Borgo over 11 years
    Step by step: $ gtf 1280 1024 60 # 1280x1024 @ 60.00 Hz (GTF) hsync: 63.60 kHz; pclk: 108.88 MHz Modeline "1280x1024_60.00" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync $ xrandr --newmode "1280x1024_60.00" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync $ xrandr --addmode VGA-0 "1280x1024_60.00" X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 153 (RANDR) Minor opcode of failed request: 18 (RRAddOutputMode) Serial number of failed request: 27 Current serial number in output stream: 28
  • Paweł Rumian
    Paweł Rumian over 11 years
    Uh, very weird. May be something with nvidia drivers - do you have nvidia-utils installed?
  • Borgo
    Borgo over 11 years
    Yes, I have nvidia-utils, version 304.43. Two days ago nvidia release newer drivers, today it is in my repo so I check how xrandr work with them.
  • Borgo
    Borgo over 11 years
    Still the same error: X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 153 (RANDR) Minor opcode of failed request: 18 (RRAddOutputMode) Serial number of failed request: 29 Current serial number in output stream: 30 Only two last numbers has changed.
  • Paweł Rumian
    Paweł Rumian over 11 years
    I have no more ideas...
  • jferr4
    jferr4 over 9 years
    This was the only solution after hours of research that worked, thanks a lot, you saved my day. Cheers
  • jferr4
    jferr4 over 9 years
    However setting loses after a session, any solution to make it permanent?
  • M1GEO
    M1GEO over 3 years
    Some monitor cables have DDC (en.wikipedia.org/wiki/Display_Data_Channel) connections, while others do not. If the new cable supports DDC, this explains why it started working.