Bumblebee-Project / Bumblebee

Bumblebee daemon and client rewritten in C
http://www.bumblebee-project.org/
GNU General Public License v3.0
1.29k stars 144 forks source link

GPU unusable after wake from sleep on Arch Linux #961

Open MicroDroid opened 6 years ago

MicroDroid commented 6 years ago

After wake up from sleep (suspend to RAM):

$ optirun echo hi
[58168.281473] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA GPU at PCI:1:0:0.  Please

[58168.281502] [ERROR]Aborting because fallback start is disabled.

Relevant dmesg:

[58169.423781] NVRM: RmInitAdapter failed! (0x26:0xffff:1123)
[58169.423808] NVRM: rm_init_adapter failed for device bearing minor number 0

Useful stuff:

$ pacman -Q bumblebee
bumblebee 3.2.1-16
$ pacman -Q nvidia
nvidia 390.48-3
$ lspci | grep -e "VGA"
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)
$ # wait where's my nvidia?
$ # if i am not mistaken, it should be there, no?

GPU: Nvidia GeForce 930MX

msh0001 commented 6 years ago

I had your exact same issue with the same error from optirun and the same dmesg and I fixed it using this https://wiki.archlinux.org/index.php/bumblebee#Failed_to_initialize_the_NVIDIA_GPU_at_PCI:1:0:0_.28Bumblebee_daemon_reported:_error:_.5BXORG.5D_.28EE.29_NVIDIA.28GPU-0.29.29 that worked for me and you can make a script easily if you want.

MicroDroid commented 6 years ago

@msh0001 YES! That did work. I wonder why I haven't seen that command before even though I read the wiki page like 3 times before.

I ended up with this service in /etc/systemd/system/gpu-fix.service:

[Unit]
Description=Fix GPU after waking up from suspension
After=suspend.target

[Service]
User=root
Type=oneshot
# Sleep is because we want to ensure fastest wake up
ExecStart=/usr/bin/bash -c "sleep 2 && echo 1 > /sys/bus/pci/rescan"
TimeoutSec=0

[Install]
WantedBy=suspend.target

I am keeping this open because this doesn't make it not a bumblebee bug.

Vortelf commented 6 years ago

Can't believe this. I had this issue for 2 years and it's finally fixed.

MicroDroid commented 6 years ago

@Vortelf I can't believe you had this problem for two years and you haven't even bothered to open an issue :P

Vortelf commented 6 years ago

@MicroDroid Indeed :D I gave up and continued onward with restarting my laptop whenever I needed the discrete GPU.

iNoSec commented 6 years ago

work on debian stretch too but thats a fucking issue and doing this or script this is boring, i dont understand why thats make that because i never did it, in the past bumblebee works well after sleep

for those who want the script thats on my github

kdstew commented 5 years ago

On ubuntu 18.10 I had what appeared to be a similar issue but after waking from sleep i was unable to login and @MicroDroid's service resolved the issue (Thank you!). Later while looking at some documentation for TLP I noticed https://wiki.archlinux.org/index.php/TLP#Bumblebee_with_NVIDIA_driver. After blacklisting my NVIDIA device in TLP's config and removing the previously mentioned fix the problem was also gone.