I have a dual monitor setup and a Nvidia graphics card. After installing 18.04, the settings go back to the default after rebooting. I followed the procedure from the Nvidia docs but nothing seems to work. Does any one have a similar issue?

5 Answers 5


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.

  • 1
    Nice detailed explanation. Thank you! I am bit cautious on adding the setting command to the .profile file as it will run every time it is loaded like when I open a terminal session. I saw the screen reset the display everytime it happens and so added it as a startup script instead. It could be just in my case but would like to know your observations. Thanks again for the detailed explanation.
    – gsk308
    Jan 9, 2020 at 12:29
  • @srikrishna that's a good point. I'm using zsh+oh-my-zsh and it doesn't source the .profile by default, however, GNOME will still use it when starting it up. So a new terminal session doesn't cause the screen to reset. I'll update my answer to reflect that. Jan 9, 2020 at 19:32
  • This works nicely on Xubuntu 22.04. Thanks to you I can now rescue both my displays at the touch of a button with a keyboard shortcut.
    – evild4ve
    Mar 28 at 17:35

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.

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.

  • 1
    Please refer to the update by @OozeMeister which has detailed steps.
    – gsk308
    Jan 11, 2020 at 3:55

I was able to get my display settings to persist after reboot by installing the Nvidia X Server Settings application from the Ubuntu software center.

Steps taken:

1) Use proprietary Nvidia Drivers:

  • Click the Ubuntu menu button, or windows button if you have one on your keyboard.
  • Type Software & Upgrades and click the Icon that comes up with that name.
  • Click the Additional Drivers tab. And select the appropriate Nvidia Driver to use, click apply and wait for it to finish.
  • Reboot, although it might not be needed.

2) Install Nvidia X Server Settings:

  • Click the Ubuntu menu button again.
  • Type Nvidia
  • Click Nvidia X Server Settings
  • Click Install
  • Once done installing, set the display settings (again) you would like to keep in the Ubuntu Displays configuration
  • Save/Apply/Keep settings. Note: you may have to change the settings to something else and back again just to get it to save
  • Reboot to test

Some steps may not be necessary for others but this is what worked for me. Hopefully it helps someone else.

  • Thanks for your reply. I did install the nvidia drivers and the settings utility. But the settings do not seem to persist. As of now I am using a startup script to update the display settings every time the system boots. I am using the below settings 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}" These are the same settings set from the settings utility as well.
    – gsk308
    Jun 3, 2018 at 0:33

If anyone else has this issue, I created a small bash script which is used as a daemon.

You can find it here: https://github.com/fberrez/display-daemon

  • I'm looking at your code and it seems this is HDMI specific. Is that true?
    – Robbie
    Sep 15, 2019 at 23:16
  • @Robbie: I did not try but I think you can edit the output name. In my code, it is 'HDMI-2' because it was the name of my HDMI output. Try to find yours, even if it is not a HDMI, and let me know if it works
    – fberrez
    Sep 19, 2019 at 16:35

In my case ubuntu GUI did not load. After a bit of searching I found that:

apt-get install --reinstall ubuntu-desktop

[add sudo if needed] With updates and upgrades got it working.

Source: https://www.youtube.com/watch?reload=9&v=s4uXBjcb5zo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .