Ubuntu 21.10 NVIDIA 470/510 nv_restore_user_channels
bug
This started happening to me as soon as I moved to Ubuntu 21.10 on my Lenovo ThinkPad P51 NVIDIA Quadro M1200, and based on kernel traces, it is this exact bug: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-510/+bug/1946303 My duplicated investigation: https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-510/+bug/1953674
To reproduce the problem easily, I had to disconnect the power cable from my laptop and be on battery only. Otherwise, the problem would only happen sometimes, and more commonly after suspending for a few hours.
Workarounds:
(tested for several days now, seems to be working) the bug report links to https://forums.developer.nvidia.com/t/fixed-suspend-resume-issues-with-the-driver-version-470/187150/3 from heroic user humblebee which has workaround:
sudo systemctl stop nvidia-suspend.service
sudo systemctl stop nvidia-hibernate.service
sudo systemctl stop nvidia-resume.service
sudo systemctl disable nvidia-suspend.service
sudo systemctl disable nvidia-hibernate.service
sudo systemctl disable nvidia-resume.service
sudo mv /lib/systemd/system-sleep/nvidia ~/nvidia.bak
and reboot.
In case you nuke it, the contents of nvidia.bak
are:
#!/bin/sh
case "$1" in
post)
/usr/bin/nvidia-sleep.sh "resume"
;;
esac
That post gives their root cause:
the 470 driver migrated to systemd method while previous versions relied on Kernel Driver Callback. Apparently this is broken on some setups and kernels.
PURGE EVERYTHING FROM NVIDIA: uninstall all nvidia packages (dpkg -l | grep -i nvidia
, sudo apt uninstall
), and purge their configs as well (sudo apt purge ...
). But then you have no acceleration.
Note that even non graphic stuff like NVIDIA's CUDA/OpenCL package was still breaking things, notably I couldn't suspend after removing the graphics but keeping them, related: https://askubuntu.com/questions/1133919/ubuntu-18-04-2-immediately-wakes-up-from-suspend/1363662#1363662
It is easy to know if you've hit the same bug or not, just look for the following stack traces on your dmesg.
Because you are likely shutting down the computer and restarting, you have to look for them in the dmesg of the previous boot as per https://askubuntu.com/questions/765315/how-to-find-previous-boot-log-after-ubuntu-16-04-restarts :
journalctl -b-1
The traces are:
WARNING: CPU: 0 PID: 18016 at /var/lib/dkms/nvidia/510.47.03/build/nvidia/nv.c:3935 nv_restore_user_channels+0xce/0xe0 [nvidia]
Call Trace:
<TASK>
nv_set_system_power_state+0x22b/0x3e0 [nvidia]
nv_procfs_write_suspend+0xe9/0x140 [nvidia]
proc_reg_write+0x5a/0x90
? __cond_resched+0x1a/0x50
vfs_write+0xc3/0x250
ksys_write+0x67/0xe0
__x64_sys_write+0x19/0x20
do_syscall_64+0x61/0xb0
? exit_to_user_mode_prepare+0x37/0xb0
? syscall_exit_to_user_mode+0x27/0x50
? __x64_sys_newfstatat+0x1c/0x20
? do_syscall_64+0x6e/0xb0
? syscall_exit_to_user_mode+0x27/0x50
? do_syscall_64+0x6e/0xb0
? asm_exc_page_fault+0x8/0x30
entry_SYSCALL_64_after_hwframe+0x44/0xae
WARNING: CPU: 0 PID: 18016 at /var/lib/dkms/nvidia/510.47.03/build/nvidia/nv.c:4152 nv_set_system_power_state+0x2d0/0x3e0 [nvidia]
nv_procfs_write_suspend+0xe9/0x140 [nvidia]
proc_reg_write+0x5a/0x90
? __cond_resched+0x1a/0x50
vfs_write+0xc3/0x250
ksys_write+0x67/0xe0
__x64_sys_write+0x19/0x20
do_syscall_64+0x61/0xb0
? exit_to_user_mode_prepare+0x37/0xb0
? syscall_exit_to_user_mode+0x27/0x50
? __x64_sys_newfstatat+0x1c/0x20
? do_syscall_64+0x6e/0xb0
? syscall_exit_to_user_mode+0x27/0x50
? do_syscall_64+0x6e/0xb0
? asm_exc_page_fault+0x8/0x30
entry_SYSCALL_64_after_hwframe+0x44/0xae
I was also seeing the following ACPI error:
ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.LPCB.EC.HKEY.DEVT.PEGS], AE_NOT_FOUND (20210331/psargs-330)
No Local Variables are initialized for Method [DEVT]
Initialized Arguments for Method [DEVT]: (1 arguments defined for method invocation)
Arg0: 00000000fe968048 <Obj> Integer 00000000000000D3
ACPI Error: Aborting method \_SB.PCI0.LPCB.EC.HKEY.DEVT due to previous error (AE_NOT_FOUND) (20210331/psparse-529)
Related:
crypsetup
may is waiting for a password but that fact is not visible on locked/blanked screen. Asking because of bug reports of the swap itself being encrypted creating a chicken-and-egg issue. See: bugs.launchpad.net/ubuntu/+source/linux/+bug/1774950 affecting many users.