Display settings lost on reboot on ubuntu 18.04

Going off of @sri krishna's answer and taking it a step further to explain where the config string came from. Run the Nvidia Settings GUI app directly and set up your display configuration the way you like it.

Then, in the terminal, run nvidia-settings -q=CurrentMetaMode. This will dump output of your current configuration:

Attribute 'CurrentMetaMode' (tx-0:0.0): id=50, switchable=no, source=nv-control :: 
   DPY-1: nvidia-auto-select @1920x1080 +4608+360 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0},
   DPY-3: nvidia-auto-select @2560x1440 +2048+0 {ViewPortIn=2560x1440, ViewPortOut=3840x2160+0+0},
   DPY-2: nvidia-auto-select @2048x1152 +0+288 {ViewPortIn=2048x1152, ViewPortOut=2048x1152+0+0}

Note that I've formatted it slightly here for readablility. I have three displays, here labeled as DPY-1, DPY-2, and DPY-3. Copy the output starting at the first display name all the way to the end of the output and use that for the --assign flag to assign the CurrentMetaMode varible with nvidia-settings:

nvidia-settings --assign CurrentMetaMode="DPY-1: nvidia-auto-select @1920x1080 +4608+360 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}, DPY-3: nvidia-auto-select @2560x1440 +2048+0 {ViewPortIn=2560x1440, ViewPortOut=3840x2160+0+0}, DPY-2: nvidia-auto-select @2048x1152 +0+288 {ViewPortIn=2048x1152, ViewPortOut=2048x1152+0+0}"

Don't forget the quotes!

You can put this in a startup script or if you're using a shell like Zsh throw it in your .profile for GNOME to pick up when logging in.


just in case any one else has this issue

i added a script to my startup applications to apply the nvidia settings at every login.

#!/bin/bash
nvidia-settings --assign CurrentMetaMode="HDMI-0: 2560x1440 +0+0 {viewportin=2560x1440, viewportout=2560x1440+0+0}, DVI-D-0: 1600x900 +2560+0 {viewportin=1600x900, viewportout=1600x900+0+0}"

This makes my default screen as the HDMI output with the set resolution and the DVI output as my second screen next to my primary.

Tags:

Display

18.04