With Ubuntu 24.10 and a standard Gnome DE, I am having an issue whereby my 2nd monitor is usually (but not always) blank on resume. Some details:
- Framework 16 with latest BIOS & 6.11.0-13-generic
- Lenovo Thinkvision p40w-20
- connected via USB4
- via a Lenovo Thinkpad Thunderbold 4 dock (40B0 / DK2131)
The behaviour I am seeing is as follows:
- switch the laptop on. The external monitor usually (but not always) switches on and displays as expected
- suspend the laptop, then resume. The external monitor usually (but not always) stays blank. The ‘Display’ settings app thinks the second monitor is plugged in & fully operational; I can move my mouse to the 2nd monitor (but not see it). At this point, I have a few options to get it to work again:
- unplug the dock from the USB4 port on the Framework, and plug it back in. The monitor will usually start working again. It is quite annoying to do this every time though; all the windows lose position, the network, audio & other peripherals stop working; etc.
- open the Settings app; change the display to Mirror (rather than Join), then click Apply. At this point, the external display will start mirroring the primary laptop display (i.e. the 2nd monitor is no longer blank). Once this happens, click Join, rearrange the monitors so that they are one above the other, change the Primary Display back to the Built-in Display, change the refresh rate on the second monitor to something not the default (e.g. 59.97Hz), and click Apply. The screen goes blank. Then change the refresh rate back to the default rate (60Hz) and click Apply again. At this point, the 2nd monitor usually displays the desktop as expected again. If it doesn’t - repeat the same procedure. Although it is long & convoluted, this is less disruptive than unplugging and replugging the dock in.
I tried to automate this process via a shell script using xrandr
, to no avail:
#!/bin/bash
# Display names
INTERNAL="eDP-1"
EXTERNAL="DP-5"
# Optimal settings
INTERNAL_RES="2560x1600"
INTERNAL_RATE="164.97"
EXTERNAL_RES="5120x2160"
EXTERNAL_RATE="59.99"
echo "Setting external display off..."
# xrandr --output "$EXTERNAL" --off
sleep 1
echo "Setting internal display..."
xrandr --output "$INTERNAL" --mode "2560x1600" --rate "$INTERNAL_RATE" --primary
sleep 1
echo "Setting temporary mode for external display to mirror internal display..."
# 2560x1600 59.90
xrandr --output "$EXTERNAL" --mode "2560x1600" --rate "59.99" # --above "$INTERNAL" # --same-as "$INTERNAL"
# xrandr --output "$EXTERNAL" --mode "1920x1080" --rate "59.88" --above "$INTERNAL" # --same-as "$INTERNAL"
sleep 2
echo "Setting final mode for external display..."
xrandr --output "$EXTERNAL" --mode "$EXTERNAL_RES" --rate "$EXTERNAL_RATE" --above "$INTERNAL"
# xrandr --output "$INTERNAL" --mode "$INTERNAL_RES" --rate "$INTERNAL_RATE" --primary
echo "Done. Displays should be configured with:"
echo "$INTERNAL: $INTERNAL_RES @ $INTERNAL_RATE Hz"
echo "$EXTERNAL: $EXTERNAL_RES @ $EXTERNAL_RATE Hz"
It simply prints the following error from line 23 (when setting the external display to mirror the internal display:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 139 (RANDR)
Minor opcode of failed request: 7 (RRSetScreenSize)
Serial number of failed request: 29
Current serial number in output stream: 30
Even though the mode is listed in xrandr
’s output (xrandr --screen 0
).
I was hoping for suggestions to either:
- resolve the issue so that the external monitor works correctly when resuming
- a better workaround than the one I stumbled up (e.g. a script which carries the same steps out)
Thanks!