Persistent Display Settings on 18.04


I’m running Ubuntu on a dual boot iMac in a college lab, this has a GeForce GT 755M. This is a Ubuntu 18.04 /kernel 5.4.0-81-generic with the nvidia driver 460.91.03 installed through apt. Mokutil reports secure boot as not available. I think I have checked most of the obvious issues from reading other threads.

I am able to run the nvidia-settings software and configure res and mirrored settings, however I’m struggling to make these settings save and persist. I have tried creating the .nvidia-settings-rc, I’m unable to load this file manually on the command line with the nvidia-settings command and haven’t been able to find anything that works. The xorg file doesn’t manage to save through the software too, and manually saving this in place doesn’t seem to work either.

Any advice on how to get these settings to persist would be great as I ideally need the screens to mirror so the machine can do demonstrations with the projector attached to the machine.

Thanks in advance

To save an Xorg.conf via nvidia-settings, you need to start it as root.

Anything further would need a bug report. So run as root and attach the resulting file here.

I had previously tried running nvidia-settings as root, this still gave me the message “unable to open x config file”. I thought it was because the file didn’t exist, but I ran touch /etc/X11/xorg.conf, but this still gave the same message. Ubuntu 18.04 seems to have all the xorg conf in many separate files in xessions.d rather than in xorg.conf.

I’ll upload the bug report.

nvidia-bug-report.log.gz (297.6 KB)

Before looking at the report.
Just open nvidia-settings as root, do your settings → Hit save. That should create a /etc/X11/xorg.conf.

This is an example of a mirrored monitor setup, that looks good to me:

(with intel, but same thing just the device section should be nvidia).

Unfortunately this was what I had tried to do, sudo nvidia-settings still gave an error when it came to saving a file at /etc/X11/xorg.conf. I tried to get around this by using the preview option to see xorg.conf text in nvidia-settings, I then copied/pasted this manually to /etc/X11/xorg.conf, but again this didn’t seem to help me.

As I could see most setting held in the Xsession.d directory, I tried copying this file in there also but no luck either.

/usr/share/X11/xorg.conf.d/ is the directory for all the custom settings in Ubuntu.

Looks like you generated an xorg.conf already today…

Also possible with xrandr:

Thanks for the suggestions Mart, I have tried a few things here.

xrandr doesn’t list a great deal of resolutions for the iMac’s in built display. I have tried using xrandr --addmode DP-2 --mode 1920x1080 to give a resolution that will match the secondary display, unfortunately this gives the following error:

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 36
Current serial number in output stream: 37

This is really confusing as the nvidia tool allows me to adjust the main display to 1920x1080 and mirror without a problem. Once the settings were applied with the nvidia tool, I would have thought I could try interrogating the display settings with xrandr --current but this doesn’t give me anything useful.