| name | linux-display-setup |
| title | Linux Display Setup |
| description | Fix Linux display issues: broken EDID, custom modelines, multi-monitor setup, GPU driver diagnosis, and refresh rate configuration. Covers xrandr workflows, autostart persistence, and NVIDIA G-Sync activation. |
| triggers | ["User says monitor is \"unknown display\" / not detected","User wants custom resolution or refresh rate (e.g. 144Hz)","EDID-related display issues (0mm x 0mm in xrandr)","Multi-monitor layout configuration","GPU driver check (NVIDIA, AMD, Intel)","G-Sync / VRR setup","Second monitor detected at wrong resolution"] |
| version | 1.0.0 |
| author | Hermes Agent |
| license | MIT |
Linux Display Setup
Diagnostic Workflow
When a monitor shows wrong resolution or is detected as "unknown display",
work through this checklist before proposing fixes:
-
Identify GPU and current driver
lspci | grep -E "VGA|3D|Display"
nvidia-smi 2>/dev/null || echo "No NVIDIA GPU detected"
-
List all displays and current modes
xrandr --query
* = currently active mode
+ = preferred mode (from EDID)
- Look for monitors reporting
0mm x 0mm — hallmark of broken EDID
-
Get detailed monitor info (especially for "unknown display")
xrandr --verbose | grep -A30 "^<PORT>"
Check: vrr_capable, max bpc, connection type (subconnector: Native)
-
Calculate correct modeline
cvt 1920 1080 144
cvt <width> <height> <refresh> for standard timing
cvt -r <width> <height> <refresh> for reduced blanking (some monitors prefer this)
- If both fail, try known-working GTF timings from monitor forums
EDID Repair — Custom Modeline
When EDID is broken, the monitor reports no physical size (0mm x 0mm) and only
shows basic resolutions like 1024x768 or 640x480. The fix is to manually add a
custom modeline.
Step 1: Create the new mode
xrandr --newmode "1920x1080_cvt144" 452.50 1920 2088 2296 2672 1080 1083 1088 1177 -hsync +vsync
The name (e.g. 1920x1080_cvt144) is free-form — use something descriptive.
Step 2: Add mode to the correct output port
xrandr --addmode DP-1-1 "1920x1080_cvt144"
Find the port from xrandr --query: look for connected entries (DP-0, HDMI-0, DP-1-1, etc.).
Step 3: Activate the mode
xrandr --output DP-1-1 --mode "1920x1080_cvt144" --rate 144 --right-of eDP-1-1
Position options: --right-of, --left-of, --above, --below, or --same-as.
Step 4: Verify
xrandr --query | grep -A5 "DP-1-1"
Look for the new mode with * (active marker). Example output:
DP-1-1 connected 1920x1080+1920+0
1920x1080_cvt144 143.88* # ← 144Hz aktiv!
Important: xrandr vs NVIDIA MetaMode
Modes added via xrandr --newmode + --addmode are NOT managed by
nvidia-settings. Attempting to set CurrentMetaMode with
ForceCompositionPipeline or AllowGSYNCCompatible via nvidia-settings
on an xrandr-created mode will fail with Attribute not available.
To get G-Sync working on custom modelines, use xrandr to set vrr_capable:
xrandr --output DP-1-1 --set "vrr_capable" 1
But note: G-Sync via nvidia-settings requires modes to be set through
NVIDIA's own MetaMode system (via nvidia-xconfig or nvidia-settings GUI),
not through raw xrandr.
Persistence (Autostart)
Custom modelines do not survive a reboot because the EDID is still broken.
Three persistence strategies:
A. xrandr Autostart Script (Recommended, simple)
- Create a script in
~/bin/:
mkdir -p ~/bin
cat > ~/bin/monitor-setup.sh << 'SCRIPT'
xrandr --newmode "1920x1080_cvt144" 452.50 1920 2088 2296 2672 1080 1083 1088 1177 -hsync +vsync 2>/dev/null
xrandr --addmode DP-1-1 "1920x1080_cvt144" 2>/dev/null
xrandr --output DP-1-1 --mode "1920x1080_cvt144" --rate 144 --right-of eDP-1-1
SCRIPT
chmod +x ~/bin/monitor-setup.sh
- Add to Gnome/KDE autostart:
mkdir -p ~/.config/autostart
cat > ~/.config/autostart/monitor-setup.desktop << 'EOF'
[Desktop Entry]
Type=Application
Name=Monitor Setup
Exec=/home/bratan/bin/monitor-setup.sh
X-GNOME-Autostart-enabled=true
NoDisplay=true
EOF
B. xorg.conf (Advanced, NVIDIA only)
Add to /etc/X11/xorg.conf:
Section "Monitor"
Identifier "DP-1-1"
Modeline "1920x1080_144" 452.50 1920 2088 2296 2672 1080 1083 1088 1177 -hsync +vsync
Option "PreferredMode" "1920x1080_144"
EndSection
C. Kernel boot parameter (EDID override)
Add video=DP-1-1:1920x1080@144 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.
This works for simple resolutions but not for custom timings.
G-Sync / VRR on Custom Modes
G-Sync with custom xrandr modelines is limited:
-
Check if VRR is supported on the port:
xrandr --props | grep -A5 "DP-1-1" | grep vrr_capable
vrr_capable: 0 means disabled.
-
Enable VRR via xrandr (partial):
xrandr --output DP-1-1 --set "vrr_capable" 1
This may enable variable refresh at the driver level.
-
Full G-Sync with nvidia-settings requires the mode to be set through
NVIDIA's MetaMode system, not xrandr. Steps:
- Generate xorg.conf:
sudo nvidia-xconfig
- Add custom modeline to xorg.conf
- Set
AllowGSYNCCompatible=On in the Display Device section
- Reboot
Multi-Monitor Layout Quick Reference
| Command | Effect |
|---|
--right-of eDP-1-1 | External right of laptop |
--left-of eDP-1-1 | External left of laptop |
--above eDP-1-1 | External above laptop |
--same-as eDP-1-1 | Mirror (clone) mode |
--primary | Set as primary display |
Pitfalls
-
cvt pixel clock may exceed DisplayPort bandwidth.
DP 1.2 max: 540 MHz. CVT 1920x1080@144 = 452.50 MHz — fine.
CVT 2560x1440@144 = 596.50 MHz — exceeds DP 1.2 limit! Use cvt -r for reduced blanking.
-
Custom modes vanish on display sleep/wake. The autostart script
may not re-run. Workaround: create a udev rule or use xrandr in
a systemd user service that watches for DP-1-1 reconnect.
-
xrandr --newmode fails if mode name already exists. Always
use unique names (e.g. include refresh rate in the name) and
redirect stderr: 2>/dev/null.
-
nvidia-settings --assign CurrentMetaMode fails on xrandr-created modes.
The error is Attribute not available — NVIDIA's MetaMode system
only recognizes modes configured through nvidia-settings or xorg.conf.
-
EDID works fine on Windows but not Linux. This is common with
certain monitor firmware/GPU combinations. The fix is always the same
(xrandr custom modeline), regardless of the root cause.
Reference Files
references/edid-modeline-recipes.md — Known-working modelines for specific monitors