The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 83     Votes:  2 
Tags: nvidia   24.04   display-resolution   reboot   vga  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/1556116
Title: Lost display configuration after reboot
ID: /2025/09/15/Lost-display-configuration-after-reboot
Created: September 15, 2025
Upload: November 23, 2025    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


I have two external displays. One of them, controlled through Thunderbolt 4K display adapter, can be wonky after a reboot. I created a function I can call from a command line to reset all three displays to desired resolution and position in virtual screen of X11.

Here is the xrandr code that works on my system:

xrandr –output HDMI-0 –mode 1920x1080 –pos 0x0 –rotate normal –fb 1920x1080 –panning 1920x1080 –output DP-1-1 –mode 3840x2160 –pos 1920x0 –rotate normal –output eDP-1-1 –mode 1920x1080 –pos 3840x2160 –rotate normal –primary;

Using the type -a command. you can see the function xreset, in ~/.bashrc, is available from the command line:

$ type -a xreset
xreset is a function
xreset () 
{ 
    xrandr --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --fb 1920x1080 --panning 1920x1080 --output DP-1-1 --mode 3840x2160 --pos 1920x0 --rotate normal --output eDP-1-1 --mode 1920x1080 --pos 3840x2160 --rotate normal --primary;
    echo Now use System settings, Screen display, Apply, Keep this configuration
}

Of course this function wouldn’t work in your system because the number of external displays, their resolutions and positioning are all different. If you are using Wayland instead of X11 another way of resetting is required.

How to setup enviroment variables by linking a file in Ubuntu/Debian/Raspberry Pi OS?  ⇩