NVIDIA settings won't write to /etc/xorg

Bug #1822937 reported by Jonas Gamao
86
This bug affects 19 people
Affects Status Importance Assigned to Milestone
nvidia-settings (Ubuntu)
Fix Released
Medium
Alberto Milone
Disco
Won't Fix
Medium
Alberto Milone

Bug Description

I tried running it with root (`sudo nvidia-settings`) and without.

I also generated an xorg file with `nvidia-xconfig`, and do the same thing, but it still won't work.

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: nvidia-settings 418.56-0ubuntu1
ProcVersionSignature: Ubuntu 5.0.0-8.9-generic 5.0.1
Uname: Linux 5.0.0-8-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.10-0ubuntu23
Architecture: amd64
CurrentDesktop: KDE
Date: Wed Apr 3 00:33:48 2019
InstallationDate: Installed on 2019-04-02 (0 days ago)
InstallationMedia: Kubuntu 19.04 "Disco Dingo" - Alpha amd64 (20190326.1)
SourcePackage: nvidia-settings
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Jonas Gamao (yamiyukisenpai) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report. The issue seems similar to the one discussed on https://discourse.ubuntu.com/t/ubuntu-19-04-and-nvidia-settings/10580

Do you get a prompt if you use "pkexec ls"?

Changed in nvidia-settings (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Doug McMahon (mc3man) wrote :

What one would see from terminal (pkexec ls works fine)

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'com.ubuntu.ScreenResolution.Mechanism': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/screen-resolution-extra/nvidia-polkit.py", line 75, in <module>
    operation_status = main(options)
  File "/usr/share/screen-resolution-extra/nvidia-polkit.py", line 42, in main
    conf = get_xkit_service()
  File "/usr/share/screen-resolution-extra/nvidia-polkit.py", line 33, in get_xkit_service
    service_object = dbus.SystemBus().get_object(SERVICE_NAME, OBJECT_PATH)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: Cannot launch daemon, file not found or permissions invalid

ERROR: Unable to open X config file '/etc/X11/xorg.conf' for writing.

Changed in nvidia-settings (Ubuntu):
status: Incomplete → New
Revision history for this message
Sebastien Bacher (seb128) wrote :

what's the output of "dpkg -l | grep screen-resolution-extra"?

Revision history for this message
Doug McMahon (mc3man) wrote :

ii screen-resolution-extra 0.17.4 all Extension for the GNOME screen resolution applet

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-settings (Ubuntu):
status: New → Confirmed
Revision history for this message
Mike Kasberg (mkasberg) wrote :

This bug also affects me on 19.04.

Moreover, I am able to reproduce the bug no matter where I try to save: Unable to open X config file '/home/mkasberg/Desktop/mike-nvidia-xconfig.conf' for writing.

Changed in nvidia-settings (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
Changed in nvidia-settings (Ubuntu):
status: Confirmed → In Progress
Changed in nvidia-settings (Ubuntu Disco):
assignee: nobody → Alberto Milone (albertomilone)
importance: Undecided → Medium
Changed in nvidia-settings (Ubuntu):
importance: Low → Medium
Changed in nvidia-settings (Ubuntu Disco):
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-settings - 418.56-0ubuntu2

---------------
nvidia-settings (418.56-0ubuntu2) eoan; urgency=medium

  * debian/patches/05_add_polkit_support.patch:
    - Use pkexec and call the new binary provided by
      screen-resolution-extra (LP: #1822937).
  * debian/control:
    - Depend on screen-resolution-extra (>= 0.18~).

 -- Alberto Milone <email address hidden> Tue, 21 May 2019 15:20:46 +0200

Changed in nvidia-settings (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Nils Nilsson (persson1589) wrote :

The bug was fixed in nvidia-settings 418.56, but I am using the nvidia 1650 gpu and the 418.56 driver doesn't support my gpu. Will the fix be released for the 430 driver as well?

Revision history for this message
Alberto Milone (albertomilone) wrote :

@Nils: which Ubuntu version are you running? nvidia-settings should work correctly in Ubuntu 19.10 (regardless of whether you are running the 430 driver, or the 435 driver, etc.)

Revision history for this message
van hanegen (4997865862-o) wrote :

This bug is 'alive and well' with 340.107 driver in 19.10

Revision history for this message
van hanegen (4997865862-o) wrote :

Also this bug wasn't fixed with 390 driver (19.10 stable release)

andrey@andrey-G31M-S2L:~$ sudo nvidia-settings
[sudo] пароль для andrey:

(nvidia-settings:3420): GLib-GObject-CRITICAL **: 15:06:56.073: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

ERROR: Local version of NVML doesn't implement this function

** Message: 15:06:56.790: PRIME: No offloading required. Abort
** Message: 15:06:56.790: PRIME: is it supported? no
Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found
usage: nvidia-polkit [-h] [-w FILE] [-b FILE] destination
nvidia-polkit: error: the following arguments are required: destination

ERROR: Unable to open X config file '' for writing.

andrey@andrey-G31M-S2L:~$

Revision history for this message
hookdump (hookdump) wrote :

Running into the same problem:
Ubuntu 19.04
NVIDIA Driver 440.33.01

Output: (Please note that not even writing the conf to my HOME directory works. I've also retried with sudo. Same results.)

------

➜ nvidia-settings

(nvidia-settings:19553): GLib-GObject-CRITICAL **: 10:04:11.973: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

WARNING: Unable to parse X.Org version string.

Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found
Error accessing /usr/share/screen-resolution-extra/nvidia-polkit: No such file or directory

ERROR: Unable to open X config file '/etc/X11/xorg.conf' for writing.

WARNING: Unable to parse X.Org version string.

Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found
Error accessing /usr/share/screen-resolution-extra/nvidia-polkit: No such file or directory

ERROR: Unable to open X config file '/home/ig/test.conf' for writing.

Revision history for this message
Emiliano (gaiagilder) wrote :

I'm still having the problem in (X)Ubuntu 18.4,

NVIDIA-SMI 340.107 Driver Version: 340.107 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GT 130M

Revision history for this message
van hanegen (4997865862-o) wrote :

Fixed with 390.132 driver, NV-CONTROL Version:1.29, Ubuntu 20.04
Thanks

Revision history for this message
ishan (ishankhatri90-deactivatedaccount) wrote :

Emiliano (gaiagilder) Try installing the following packages

sudo apt-get install pkg-config make xutils-dev libtool xserver-xorg-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libudev-dev

I am running Nvidia 440

Revision history for this message
Guillermo (skylinne77) wrote :

I am running Nvidia 440, and i have the same problem. :(

Revision history for this message
Cheval Nathan (kresys) wrote :

Same as Guillermo, on Ubuntu 20.04 using Nvidia 440, same problem ..

Steve Langasek (vorlon)
Changed in nvidia-settings (Ubuntu Disco):
status: In Progress → Won't Fix
Revision history for this message
nikola vulovic (nivukiki) wrote :

I found the solution installing screen-resolution-extra 0.18 from https://packages.ubuntu.com/focal/screen-resolution-extra using dbkg -i place where u downloaded deb file.

Revision history for this message
Haydon (bigh-aus) wrote :

I'm seeing what i think is a related problem using Ubuntu 20.04 and nvidia driver 440. IE default ubuntu 20.04 install from the ISO (and then updated).

My settings do not persist across reboots. (which is really annoying since I have a secondary display rotated. Tried running as sudo - it seems to persist, but doesn't take)

```
$sudo nvidia-settings
[sudo] password for haydon:

(nvidia-settings:51977): GLib-GObject-CRITICAL **: 15:53:13.651: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 15:53:13.925: PRIME: No offloading required. Abort
** Message: 15:53:13.925: PRIME: is it supported? no
Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found

```

Revision history for this message
Vyshynskyi Alexander (wermil) wrote :

Installing xserver-xorg-dev fixed the error:
Package xorg-server was not found in the pkg-config search path.
Perhaps you should add the directory containing `xorg-server.pc '
to the PKG_CONFIG_PATH environment variable
No package 'xorg-server' found

But the settings are reset on reboot.

Ubuntu 20.04
Nvidia 440.100

Revision history for this message
Haydon (bigh-aus) wrote :

Ok I just did a quick test. It is writing to my xorg.conf.

Also I noticed that when ubuntu starts up, on the login screen both screens have the purple background color - it's only after that when it gets to the desktop does the second display turn off.

Revision history for this message
Thomas Bobek (drrock) wrote :

I have also the same problem. With two monitors, I change the monitor positions (left/right) in the nvidia-settings tool (started with sudo) and write it to the X Configuration file (/etc/X11/xorg.conf). The file is changed, but the monitor positions are reset after next reboot.

I wondered why there is only one Monitor section in the xorg.conf file, but the gui of nvidia-settings mentions two monitors (one connected per DVI, one per DP at my Geforce GTX 1060).

I can confirm that the "Package xorg-server was not found " error vanished after installing xserver-xorg-dev, but the following error is still present:

thomas@deepthought2:~$ sudo /usr/bin/nvidia-settings

(nvidia-settings:7845): GLib-GObject-CRITICAL **: 09:17:21.642: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 09:17:21.764: PRIME: No offloading required. Abort
** Message: 09:17:21.764: PRIME: is it supported? no

My setup:
Ubuntu 20.04
Nvidia 450.80.02

Revision history for this message
gui ambros (guiambros) wrote :

Same here, with Nvidia 455.45.01 on Ubuntu 20.04. In fact I've been facing this for years, since 18.04.

The workaround I'm using is to call nvidia-settings via a shell script in Gnome's Startup Applications.

It's a bit annoying because it only applies after you log in, but has the additional benefit that you can execute manually if your monitors get out of sync for some reason (handy if you use a KVM that forces X to re-detect monitors).

You can save your config via nvidia-settings to a separate location, and then extract the exact parameters for each monitor. Here's mine:

# monitor-reset.sh:

sh -c 'nvidia-settings --assign XineramaInfoOrder="USB-C-0" --assign CurrentMetaMode="DP-5: 1920x1200 +0+560, USB-C-0: 2560x1600 +1920+160, HDMI-0: 1920x1200 +4480+0 {rotation=left}"' > /dev/null 2>&1

Revision history for this message
JXT (jtipton-x-deactivatedaccount) wrote :

Problem still exists in 21.04 nv470.

Revision history for this message
Yogesh (yogesh590440) wrote :

Same with 20.04 et nv390 (proprétaire, testé).

Revision history for this message
Yogesh (yogesh590440) wrote :

Installing xserver-xorg-dev fixed the error !

Revision history for this message
Jürgen (leineses) wrote :

Problem still exists in 21.10 nv495 ..

Revision history for this message
Peter Posto (peter-posto) wrote :

And still existing on Sunday, March 13, 2022! Driver in use: 510.

Revision history for this message
Foo Bar (foobarbaz1) wrote :

The instructions here solved my problem: https://www.programmersought.com/article/45694457131/

There seemed to be a missing symlink to the nvidia-polkit python file:
1. cd /usr/share/screen-resolution-extra && ls
2. sudo ln -s nvidia-polkit.py nvidia-polkit
3. sudo chmod +x nvidia-polkit

Also, ensure that the system is using python 3:
4. sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
5. sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
6. sudo update-alternatives --display python

I can confirm that after I ran 1-6, then ran $ nvidia-settings, I was able to successfully save my X-config file, and then reboot, with the settings loading automatically during reboot.

Note that updating the default python version may break things that assume `which python` == `which python2` (e.g. terminator)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.