NVIDIA persistence daemon continuously starting and stopping in syslog

Solution 1:

Although this is an old problem, I've still encountered it myself on Kubuntu 18.04 and nvidia driver 390. Namely, the nvidia-persistence daemon spams the screen during boot (sometimes, not always). Thus, my solution circumvents the standard nvidia daemon startup on system boot by using a separate systemd service.

Like stated before, it seems to be a misconfiguration of starting the nvidia-persistence daemon. More precisely, the udev rules seem to be the problem for me. Thus, I modified /lib/udev/rules.d/71-nvidia.rules and commented out the actions under power-off and power-on. Like mentioned in other answers, you may also comment out the lines for loading and unloading.

Now the daemon does not start on power-on. Consequently, we have to schedule the start of the daemon manually. We can achieve that by copying /lib/systemd/system/nvidia-persistenced.service, e.g.

sudo cp /lib/systemd/system/nvidia-persistenced.service /lib/systemd/system/nvidia-persistenced-manual.service

Now modify /lib/systemd/system/nvidia-persistenced-manual.service to look something like this:

[Unit]
Description=NVIDIA Persistence Daemon
Wants=syslog.target
Requires=local-fs.target

[Service]
Type=forking
User=root
Group=root
ExecStart=/usr/bin/nvidia-persistenced
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced

[Install]
WantedBy=multi-user.target

To enable the service, execute

sudo systemctl enable nvidia-persistenced-manual.service

and if the old service is still enabled, run

sudo systemctl disable nvidia-persistenced.service

This way, the daemon will start on system startup. Feel free to modify the line ExecStart=/usr/bin/nvidia-persistenced to e.g. include --verbose or --user [...].

Keep in mind, that in my default way, the daemon is running with root permissions. If you do not want this, make sure to run the daemon with the --user argument.

Altogether, this is not a perfect solution, but it was able to fix the bug on my system.

Solution 2:

The entries are caused by an unnecessary configuration file from the Nvidia package:

  • Run the command nvidia-smi from the shell, you must see somewhere on the left top "Persistence-M On".
  • You can test if your Nvidia drivers work ok without "Persistence-M".
  • Go to /lib/systemd/system/ . Here you will find a file called nvidia-persistenced.service. Rename or move.
  • Go to /lib/udev/rules.d/
  • Open as root the config file 71-nvidia.rules
  • Comment out # the actions under power on and power off and loading and unloading.
  • Restart and check.

Thanks to void75, forums.linuxmint.com