So, when I suspend my laptop, then wake it up later, my laptop does turn on, I'm able to, for example, turn up and down the volume with audio confirmation using the kepboard, but my screen remains black and doesn't show anything until after I restart my laptop.
It is the buggy nouveau driver again. That's what solved the issue for me.
Edit the file
/etc/default/grub (using Vi editor -- some users have not been able to save after editing in Vi and have had to use the alternate "Ex" editing mode, which substitutes
sudo edit below, then Alt+:w and :x for the save and exit commands).
$ sudoedit /etc/default/grub
nouveau.modeset=0 to the line that says
GRUB_CMDLINE_LINUX then press CtrlO then Enter to save the file and CtrlX to leave Editor.
$ sudo update-grub
Here is what fixed this issue for me on Kubuntu 20.04 Intel NUC PC (NUC8i7HVK), which has Intel HD graphics + embedded Radeon RX Vega M GH:
I went into UEFI BIOS settings and enabled PCIe ASPM (Active State Power Management). I left some other settings such as "Native ACPI OS PCIe" disabled
This is very easy to test so give it a shot and see if it helps.
Ubuntu 21.10/22.04 NVIDIA 470/510
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.
(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
In case you nuke it, the contents of
#!/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: Ubuntu 18.04.2 immediately wakes up from suspend
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 How to find previous boot log after Ubuntu 16.04+ restarts? :
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)
- Ubuntu 21.10 resume produces blank screen
- Suspend not working: Ubuntu 20.04 (does not work at all) / 21.10(in battery mode does not work )
- Suspend not working properly (cannot wake up) on Ubuntu 20.04 with NVIDIA
- Ubuntu 21.04 won't wake from sleep
- Getting suspend to work on Ubuntu (21.10 - impish release)?
I don't know how to really solve the problem, but remember: before you hold down the power button to hard reboot, you can always soft reboot with this funky sequence:
Hold down Ctrl + Alt + PrScr, then press the following keys one-at-a-time while holding those first 3 keys down the whole time: R, E, I, S, U, B.
Note that on some (many?) laptops/keyboards,the PrScr button may require your Function key, Fn, to activate it, so you may have to hold down Ctrl + Alt + PrScr + Fn instead, while typing the REISUB reboot key sequence.
I don't remember where I learned this, but I read it from someone else years ago on Ask Ubuntu or SuperUser somewhere. The last key, "B", stands for 'B'oot. So, when you press that key your computer will restart.
Keep this in mind for any Linux problem. Only do a hard reboot if this soft reboot sequence first fails.
A few final thoughts:
- If you have a Yubikey plugged in, unplug it! It enumerates itself as a USB keyboard to your computer and may have a "jammed key" or otherwise interfere with your computer's normal operation. I make a USB keyboard device called the "Computa Pranksta" and sometimes have a similar problem.
- You may have a hardware problem, as I once had on my computer here. To test this, boot into your BIOS/UEFI boot menu and choose to run a full hardware diagnostics test suite, assuming your computer has such an option from the factory. It may reveal bad RAM, a bad motherboard, or something else.
- This answer by @Vijay Prema looks promising, but unfortunately I don't have the BIOS password on the computer I'm having problems on, so I can't change the BIOS settings to find out.
Sorry if what I'm saying is weird (I'm using the google translator). In my case, I am using an Asus Vivobook S15. After desperately searching, I accidentally gave the solution (in my case) and I wanted to share it. What I did was install the Unity Desktop:
$ sudo apt install ubuntu-unity-desktop
And although it seems absurd, it began to work, almost magically. I hope this information is useful for someone. A greeting!
I tried all the answers given in this post, none of them helped me(changed drivers, updated drivers, edited /etc/default/grub, changed display manager, made more swap, spent some hours, prayed to laptop).
I then finally gave up & thought to enable hibernate mode, while enabling that I ran
Which gave me
Then I felt it is due to UEFI
boot mode in BIOS. Made that option to
legacy support which enabled another option
Boot priority, let this be default as
After this I am able to resume the system after suspend.
now gives more options which has
This was done on Legion Y540 (GTX 1650 with Nvidia drivers - 418 (no IGPU) /Ubuntu 20 LTS/ Kernel 5.4/ latest BIOS as of date)
P.S. Windows never had any problem resuming from sleep.
For KDE / Kubuntu:Along with changing volume, I could also see the mouse cursor and was able to move it around in the black background(screen). Because of the black "screen", I was not able to login/logout or perform a graceful shutdown or restart.
Previously, killing plasmashell or Xorg from tty, would fix the issue, however this resulted in loss of open applications/windows and unsaved buffer data (like text in Kate etc.)
I finally figured out that I could kill kscreenlocker instead. To do the same.
ctrl + alt + f2
pkill -9 kscreenlocker_gor
pkill -9 kscreenlocker_greet
ctrl + alt + f1
Now, the kscreenlocker_greet should have restarted, allowing user login!
Note: This solution is restricted to KDE users only, however it doesn't require changing drivers/display settings, as suggested by above answers.
Probably the equivalent of someone pressing buttons to see if it fixes their problems, but looks like adding the
persistent keyword to the
GRUB_CMDLINE_LINUX_DEFAULT line did the trick for me.
What used to happen is every time I would lock my screen, it turned off my monitor.
After adding the
persistent keyword to the
GRUB_CMDLINE_LINUX_DEFAULT line of the
/etc/default/grub file and running
sudo update-grub, my screen no longer turns off after locking.
Nowadays, I can come back and enter my password to login and continue my work like a pro without having to do the
F3 key combination that some of you may have gotten used to!
persistent KEYWORD IN MY
GRUB_CMDLINE_LINUX_DEFAULT LINE! (and also megashake)
Here's a sample of my
# If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' GRUB_DEFAULT=0 GRUB_TIMEOUT_STYLE=menu GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="vga=0 rdblacklist=nouveau nouveau.modeset=0 acpi_osi=Linux persistent" GRUB_CMDLINE_LINUX="" # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # Uncomment to disable graphical terminal (grub-pc only) #GRUB_TERMINAL=console # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo' GRUB_GFXMODE=1024x768 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux #GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_RECOVERY="true" # Uncomment to get a beep at grub start GRUB_INIT_TUNE="480 440 1" #GRUB_DISABLE_OS_PROBER=false
This seems to work for me (as a temporary solution).
Device: HP 245 G5
OS: Xubuntu 18.04
When your screen is blank, this sequence of actions seems to do the trick:
(wait 5 seconds)
CTRL + ALT + F2 (wait a second)
CTRL + ALT + F3 (wait a second)
CTRL + ALT + F7 (wait a second)
ESC (wait a second)
ENTER (3 times XD)
Close your laptop (wait 5 seconds).
Open back your laptop.
And the terrific blank screen is gone.