GPU disappeard from hardware device list

Please see the helpful answer by generix here: https://forums.developer.nvidia.com/t/no-matter-which-drivers-i-install-i-cannot-boot-my-ubuntu-20-04-lts-beyond-a-black-screen/127510/9

  1. switch to nvidia (again): sudo prime-select nvidia
  2. delete /lib/udev/rules.d/50-pm-nvidia.rules (and delete /lib/udev/rules.d/80-pm-nvidia.rules too)
  3. remove stray blacklist files: sudo rm /lib/modprobe.d/blacklist-nvidia.conf /etc/modprobe.d/blacklist-nvidia.conf
  4. update the initrd: sudo update-initramfs -u
  5. reboot

See also this Nvidia Forums post where generix noted:

Ok, it’s this:

/lib/udev/rules.d/80-pm-nvidia.rules:

ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", ATTR{remove}="1"

it’s removing the nvidia gpu from the bus. The rest of the file are rules to prepare for render offload. This looks like something changed in Ubuntu’s prime-select/nvidia-prime again, don’t really know what’s the point of doing this…

For me, sudo prime-select nvidia usually does the trick, but if not, manually deleting /lib/udev/rules.d/50-pm-nvidia.rules and /lib/udev/rules.d/80-pm-nvidia.rules and a reboot should do it.

Thankfully, these udev rules are going away in 20.10 (groovy) (see changelog of nvidia-prime 0.8.15), so such "Nvidia GPU disappearing" problems will soon become a thing of the past.