Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hibernate resumes to black screen (nvidia drivers)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
AkkoBaka
n00b
n00b


Joined: 12 Apr 2022
Posts: 6

PostPosted: Tue Apr 12, 2022 11:25 am    Post subject: Hibernate resumes to black screen (nvidia drivers) Reply with quote

I am trying to hibernate (i.e. suspend-to-disk) my computer, using the "suspend to disk with swap file" instructions on the wiki[0]. This works as long as X is not started, i.e. I am in a TTY. If X is started, even if I press ctrl-alt-f2 and go into a TTY, after hibernating and restarting the computer I am greeted with a black screen. I'm using recent nvidia proprietary drivers with a GTX 1070 GPU.
Note that the issue is specifically with hibernate, not suspend. The issue occurs both when running
Code:
loginctl hibernate
as well as
Code:
echo disk > /sys/power/state
.
I specifically need the hibernate functionality to be working, not the suspend, as my intention is to reboot into a different OS after hibernating, then later back into Gentoo without losing work.

Any leads? I looked for solutions online but I'm only seeing either issues with suspend (which I both can get to work and do not need) or systemd-specific reports.

Code:

$ uname -a
Linux alpha 5.16.18-gentoo-dist #1 SMP PREEMPT Wed Mar 30 08:01:03 -00 2022 x86_64 AMD Ryzen 5 1600 Six-Core Processor AuthenticAMD GNU/Linux


[0] https://wiki.gentoo.org/wiki/Suspend_and_hibernate
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Tue Apr 12, 2022 3:19 pm    Post subject: Reply with quote

Plz create a wake up script like
https://wiki.gentoo.org/wiki/Elogind#Hook_scripts_to_be_run_when_suspending.2Fhibernating_and.2For_when_resuming.2Fthawing
and inside maybe reload nvidia drivers
Code:

rmmod nvidia
modprobe nvidia

_________________
:)
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Tue Apr 12, 2022 3:56 pm    Post subject: Reply with quote

Is this reproducible on an untainted kernel?
Back to top
View user's profile Send private message
AkkoBaka
n00b
n00b


Joined: 12 Apr 2022
Posts: 6

PostPosted: Tue Apr 12, 2022 4:20 pm    Post subject: Reply with quote

alamahant wrote:
Plz create a wake up script like
https://wiki.gentoo.org/wiki/Elogind#Hook_scripts_to_be_run_when_suspending.2Fhibernating_and.2For_when_resuming.2Fthawing
and inside maybe reload nvidia drivers
Code:

rmmod nvidia
modprobe nvidia


Sure! (I actually already have this file because I applied the bug fix described in https://bugs.gentoo.org/693384, which fixed suspend but not hibernate).
How exactly do you want me to configure it? Both in pre, both in post, one in pre and one in post?
I tried it with both of those in the post hook but it did not fix my issue. Wouldn't the nvidia module be loaded and unable to be rmmod'd?

Hu wrote:
Is this reproducible on an untainted kernel?


Could you elaborate on what you mean by "untainted kernel"?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Tue Apr 12, 2022 4:24 pm    Post subject: Reply with quote

In the post/*) section then just have
modprobe nvidia.
Quote:


Could you elaborate on what you mean by "untainted kernel"?

Hu means a kerenl to which no out-of-tree modules have been installed.
nvidia is one of these.
_________________
:)
Back to top
View user's profile Send private message
AkkoBaka
n00b
n00b


Joined: 12 Apr 2022
Posts: 6

PostPosted: Tue Apr 12, 2022 4:33 pm    Post subject: Reply with quote

alamahant wrote:
In the post/*) section then just have
modprobe nvidia.
Quote:


Could you elaborate on what you mean by "untainted kernel"?

Hu means a kerenl to which no out-of-tree modules have been installed.
nvidia is one of these.


No dice on modprobe nvidia, that doesn't fix the issue.

I could try without the nvidia module but I'd have to find some time for it, because I imagine it would take a while to reconfigure my system until I can get into X again with the free drivers.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9677
Location: almost Mile High in the USA

PostPosted: Tue Apr 12, 2022 5:29 pm    Post subject: Re: Hibernate resumes to black screen (nvidia drivers) Reply with quote

AkkoBaka wrote:
I specifically need the hibernate functionality to be working, not the suspend, as my intention is to reboot into a different OS after hibernating, then later back into Gentoo without losing work.

Uh ... no. You will always have a severe risk of losing work when doing this!!! Unless you simply do not touch ALL disks/partitions that were mounted in Gentoo at the time of suspend, you will have a serious risk of losing data.

Anyway the idea for nvidia is not modprobe nvidia, but rather rmmod nvidia prior to hibernating. Of course this is not easily or impossible to be done because there are so many hooks into the nvidia module ... Also nvidia being no source available, it's hard to debug these things without source code, hence the suggestion to not use it...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
AkkoBaka
n00b
n00b


Joined: 12 Apr 2022
Posts: 6

PostPosted: Tue Apr 12, 2022 9:38 pm    Post subject: Re: Hibernate resumes to black screen (nvidia drivers) Reply with quote

eccerr0r wrote:
AkkoBaka wrote:
I specifically need the hibernate functionality to be working, not the suspend, as my intention is to reboot into a different OS after hibernating, then later back into Gentoo without losing work.

Uh ... no. You will always have a severe risk of losing work when doing this!!! Unless you simply do not touch ALL disks/partitions that were mounted in Gentoo at the time of suspend, you will have a serious risk of losing data.


Well, I meant "not losing work" as in "not having to re-open all my windows and position them and so on", but I guess I should've worded myself more clearly. Of course I would save my open files and so on before doing it, just as I would before a normal reboot; It's just to save myself the chore of putting everything in the right place.

EDIT: Unless there's something I'm not fully understanding here? Is this a particularly dangerous operation? The OS I would be booting into would be Windows for what it's worth, so I don't feel at risk of even accidentally mounting my Linux install.

eccerr0r wrote:

Anyway the idea for nvidia is not modprobe nvidia, but rather rmmod nvidia prior to hibernating. Of course this is not easily or impossible to be done because there are so many hooks into the nvidia module ... Also nvidia being no source available, it's hard to debug these things without source code, hence the suggestion to not use it...


I don't think there's anyone who associates the nvidia proprietary drivers with a feeling of joy but last I'm aware Nouveau just isn't quite up to par especially when it comes to things like video games. My next GPU will probalby be AMD, but with prices being what they are...
Regardless, I don't think I'm down to give Nouveau another try as a replacement for the nvidia module right now, I wouldn't consider that a solution to my problem.

I am curious though, why do you suggest rmmod nvidia prior to hibernating?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Tue Apr 12, 2022 9:46 pm    Post subject: Reply with quote

The nVidia drivers have a long history of being involved with weird problems, and the inability to meaningfully debug them just exacerbates the situation. If your problem goes away when using Nouveau, that would strongly suggest a bug in the nVidia drivers. If it persists while using Nouveau, that says your problem is either hardware or a more general kernel problem. Removing the nVidia drivers before hibernating, while not as good as hibernating from an untainted kernel, would partly test whether the nVidia drivers are responsible for your problem.

Running Windows in the interim is probably fine. Mounting a Linux filesystem that was also mounted at hibernation time is strongly discouraged, which is what eccerr0r was warning against.
Back to top
View user's profile Send private message
AkkoBaka
n00b
n00b


Joined: 12 Apr 2022
Posts: 6

PostPosted: Tue Apr 12, 2022 11:01 pm    Post subject: Reply with quote

Alright, I'm back to report that the issue does not show up with nouveau. Also, my mouse cursor is comically large.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Wed Apr 13, 2022 1:19 am    Post subject: Reply with quote

That is good news. It suggests the problem is in nVidia drivers, and that it can be fixed there. It is also bad news, since only nVidia has the source to the drivers and therefore only they can reasonably debug or fix this.
Back to top
View user's profile Send private message
AkkoBaka
n00b
n00b


Joined: 12 Apr 2022
Posts: 6

PostPosted: Wed Apr 13, 2022 12:50 pm    Post subject: Reply with quote

Hu wrote:
That is good news. It suggests the problem is in nVidia drivers, and that it can be fixed there. It is also bad news, since only nVidia has the source to the drivers and therefore only they can reasonably debug or fix this.


Welp, I figured it'd probably end up like this... I think I'm gonna throw in the towel then and try to come up with a different solution to my problem. If I were using systemd I'd have another crack at it since there's various systemd-specific bug reports and fixes floating around, but I'm not, so whatever~
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21602

PostPosted: Wed Apr 13, 2022 2:50 pm    Post subject: Reply with quote

Now that you know nVidia drivers are the problem, you could experiment with newer or older versions of the drivers, in hopes that either this is a recent regression you can avoid in an older version, or that it is already fixed in a newer version. You could try to enable/disable functionality in the drivers to see if some optional part, hopefully one you don't care about, is guilty. You could try raising an issue with nVidia.
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2716

PostPosted: Wed Apr 13, 2022 6:56 pm    Post subject: Reply with quote

I don't use hibernation myself but there's been a lot reports for regressions with hibernation since 460 branch and recall it got even worse in 465 (kinda go far back), which were never really fully resolved afaik (and these older version aren't supported by nvidia anymore and plagued with security issues, and 390 is generally unsuitable so I wouldn't bother with it -- Edit: not in-tree anymore due to security but 450.119.03 would probably be the one to try if really wanted to.. albeit it it'll need IgnoreABI with newer Xorg to load the module, and a older LTS kernel branch.. think 5.10 was okay?).

If was systemd, there's nvidia-{hibernate,resume,suspend}.services to enable for the intended nvidia way. Could also want to try to switch NVreg_PreserveVideoMemoryAllocations=0 to =1 if these services were enabled in /etc/modprobe.d/nvidia.conf (default to 0 because it tend to work better with missing services or with openrc/elogind according to reports). Although some people had issue even with systemd since 460.

If find solutions/workarounds that could be integrated in the nvidia ebuild feel free to file a bug/PR, but otherwise nothing I can do about this :(
Back to top
View user's profile Send private message
smartding
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jan 2021
Posts: 129

PostPosted: Thu Apr 14, 2022 3:16 am    Post subject: Reply with quote

I had a similar but different issue: black screen after wake up from suspend to ram.

Many people were kind enough to offer help: https://forums.gentoo.org/viewtopic-t-1133268-highlight-.html.

Maybe their solutions will help you too.
Back to top
View user's profile Send private message
Viorel
Developer
Developer


Joined: 13 Feb 2012
Posts: 16

PostPosted: Sat Apr 30, 2022 5:59 pm    Post subject: Reply with quote

Nvidia is very hit and miss. I noticed resume from hibernate works if I use lightdm instead of gdm, but I lose the screensaver: the screen is always on, it's not blanking after a while by itself. I use GNOME. It seems gnome power works only if I use gdm (but then resume from hibernate leaves me in a black screen).

Anyway, given the choice I choose hibernate. I can hibernate and go to Fedora and back without losing anything (I configured Fedora to use a different swap partition).

On resume, everything that uses GL turns to garbage, I have to click on every Firefox window to force it to redraw, also if I leave a game running in Steam I have to exit it and restart it, it doesn't repair by itself. It's clear nvidia doesn't actually save its vram when I hibernate. So there are a few flaws in this process, but it kind of works.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum