2 added 1324 characters in body
source | link

Stopping systemctl stop systemd-logind fixed it for me:

sudo systemctl stop systemd-logind

This is suggested as a workaround in this github issue on the nvidia-xrun github page:

Good news guys, systemd-logind is the culprit here. The current workaround is to run the following command after logging out from the "nvidia-xrun" session sudo systemctl stop systemd-logind

Then, you'll have manually remove the other nvidia modules and switch off the DGPU manually. Here's the code snippet that runs after you log out from the "nvidia-xrun" session.

echo 'Unloading nvidia_drm module' 
execute "sudo rmmod nvidia_drm"

echo 'Unloading nvidia_modeset module' 
execute "sudo rmmod nvidia_modeset"

echo 'Unloading nvidia module' 
execute "sudo rmmod nvidia"

echo 'Turning off nvidia GPU' 
execute "sudo tee /proc/acpi/bbswitch <<<OFF"

echo -n 'Current state of nvidia GPU: ' 
execute "cat /proc/acpi/bbswitch"

Systemd issue on Github

Reference link from Nvidia Linux Developers portal

systemctl stop systemd-logind fixed it for me

Stopping systemd-logind fixed it for me:

sudo systemctl stop systemd-logind

This is suggested as a workaround in this github issue on the nvidia-xrun github page:

Good news guys, systemd-logind is the culprit here. The current workaround is to run the following command after logging out from the "nvidia-xrun" session sudo systemctl stop systemd-logind

Then, you'll have manually remove the other nvidia modules and switch off the DGPU manually. Here's the code snippet that runs after you log out from the "nvidia-xrun" session.

echo 'Unloading nvidia_drm module' 
execute "sudo rmmod nvidia_drm"

echo 'Unloading nvidia_modeset module' 
execute "sudo rmmod nvidia_modeset"

echo 'Unloading nvidia module' 
execute "sudo rmmod nvidia"

echo 'Turning off nvidia GPU' 
execute "sudo tee /proc/acpi/bbswitch <<<OFF"

echo -n 'Current state of nvidia GPU: ' 
execute "cat /proc/acpi/bbswitch"

Systemd issue on Github

Reference link from Nvidia Linux Developers portal

1
source | link

systemctl stop systemd-logind fixed it for me