Can't add custom resolution via xrandr

Hello,
I’m having a bit of an issue trying to create a custom resolution for one of my displays.
I do the usual steps with cvt 1280 960 144, then using xrandr --newmode [output] and lastly xrandr --addmode DP-4 "1280x960_144.00", however on that last step I always get the following error:

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

I looked online and other people have the same issue, however none of the fixes provided there worked for me. In case it’s relevant, I’m using the latest proprietary nvidia 520 drivers.
If you have any idea what might be going on or how I could fix my issue, please let me know

EDIT: I know that that specific resolution works on my monitor, because I have used it while I was still using Windows without any issues or problems

Welcome to ask.fedaora @linda

Please check if you have your preferred resolution listed and if the Hz is correct with:
(Just as a reminder, you cant’t use xrandr with Wayland)
xrandr -q

See also this document:
https://linuxconfig.org/how-to-configure-your-monitors-with-xrandr-in-linux

You can try to use one of this:

the resolution i’m trying to set isn’t listed, which is precisely why i want to add it

Can you please give us an output of inxi -Fzx and post it here as preformatted </> text.

As i highlighted above the error says BadMatch … so there must be something wrong with your command you try to add the resolution/frequency.

sure, here you go!

System:
  Kernel: 6.0.5-200.fc36.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.37-36.fc36 Desktop: GNOME v: 42.5 Distro: Fedora release 36 (Thirty
    Six)
Machine:
  Type: Desktop System: Micro-Star product: MS-7A34 v: 3.0
    serial: <superuser required>
  Mobo: Micro-Star model: B350 TOMAHAWK ARCTIC (MS-7A34) v: 3.0
    serial: <superuser required> UEFI: American Megatrends LLC. v: H.M5
    date: 07/18/2022
CPU:
  Info: 6-core model: AMD Ryzen 5 1600 bits: 64 type: MT MCP arch: Zen rev: 1
    cache: L1: 576 KiB L2: 3 MiB L3: 16 MiB
  Speed (MHz): avg: 3741 high: 3900 min/max: N/A cores: 1: 3900 2: 3338
    3: 3900 4: 3166 5: 3900 6: 3900 7: 3900 8: 3900 9: 3900 10: 3290 11: 3900
    12: 3900 bogomips: 93602
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
  Device-1: NVIDIA GP106 [GeForce GTX 1060 6GB] driver: nvidia v: 520.56.06
    arch: Pascal bus-ID: 26:00.0
  Display: x11 server: X.Org v: 1.20.14 with: Xwayland v: 22.1.3 driver: X:
    loaded: nvidia gpu: nvidia,nvidia-nvswitch resolution: 1: 1920x1080
    2: 1920x1080~60Hz
  OpenGL: renderer: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2 v: 4.6.0 NVIDIA
    520.56.06 direct render: Yes
Audio:
  Device-1: NVIDIA GP106 High Definition Audio driver: snd_hda_intel
    v: kernel bus-ID: 1-2:2
  Device-2: AMD Family 17h HD Audio vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel bus-ID: 28:00.3
  Device-3: Kingston HyperX 7.1 Audio type: USB
    driver: hid-generic,snd-usb-audio,usbhid
  Sound API: ALSA v: k6.0.5-200.fc36.x86_64 running: yes
  Sound Server-1: PulseAudio v: 15.0 running: no
  Sound Server-2: PipeWire v: 0.3.59 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Micro-Star MSI driver: r8169 v: kernel port: f000 bus-ID: 23:00.0
  IF: enp35s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Drives:
  Local Storage: total: 1.93 TiB used: 94.16 GiB (4.8%)
  ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 980 1TB size: 931.51 GiB
    temp: 38.9 C
  ID-2: /dev/sda vendor: Patriot model: Burst size: 111.79 GiB
  ID-3: /dev/sdb vendor: Seagate model: ST1000DM003-1ER162 size: 931.51 GiB
Partition:
  ID-1: / size: 929.91 GiB used: 93.89 GiB (10.1%) fs: btrfs dev: /dev/dm-0
    mapped: luks-f565721e-82b0-4513-89ff-c5c4cb8cbf7b
  ID-2: /boot size: 973.4 MiB used: 269.3 MiB (27.7%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-3: /boot/efi size: 598.8 MiB used: 14 MiB (2.3%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-4: /home size: 929.91 GiB used: 93.89 GiB (10.1%) fs: btrfs
    dev: /dev/dm-0 mapped: luks-f565721e-82b0-4513-89ff-c5c4cb8cbf7b
Swap:
  ID-1: swap-1 type: zram size: 8 GiB used: 0 KiB (0.0%) dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 35.8 C mobo: N/A gpu: nvidia temp: 46 C
  Fan Speeds (RPM): N/A gpu: nvidia fan: 48%
Info:
  Processes: 378 Uptime: 4h 50m Memory: 15.54 GiB used: 4.59 GiB (29.5%)
  Init: systemd target: graphical (5) Compilers: gcc: 12.2.1 Packages: 45
  note: see --rpm Shell: Bash v: 5.2.2 inxi: 3.3.22

It is possible that the frequency you want to use is unsupported at that resolution by that monitor. Have you tried the same when specifying 60 Hz instead of 144 Hz?

as I said, the refresh rate @ that resolution can’t be unsupported because I ran exactly that under Windows.

I ended up switching from Fedora on GNOME to the KDE spin and wrote an xrandr script that just scales my resolution down by the factor that results in my prefered resolution, as a sort of workaroudn solution (the reason why I switched is because I had some scaling issues under GNOME that I knew i didn’t have on KDE)

I guess that concludes that I was sadly not able to fix this issue in the way I wanted to, however the workaround is sufficient enough, at least for now.
Thanks for all the responses I got, I learned something new!

1 Like

Do not forget, Nvidia is closed source. And Linux drivers already have been given less attention. This is why even Linus had shown his in satisfaction about Nvidia. Never less, with your workaround you found a way out of this dilemma (more or less :wink: ).

oh I will not be buying another nvidia card if I ever decide to upgrade, thats for sure haha - and not just for Linux reasons, the company, their price hiking and the shady stuff they do has become too much to accept