Hi, I'm making this post today because I've been having some problems with Nvidia drivers with wayland. Looks like nvidia driver 535 was having some issues with Godot (flatpak), the error was something about Vulkan, anyway, it's not important now.
The versions 535 and 545 of the nvidia driver have been causing some problems on my machine while using wayland, so I'm making this tutorial for the folks that are encountering problems and wish to change their driver version to (hopefully) solve their bugs while waiting for the latest driver to be updated.
Let's get started.
DISCLAIMER: I am not responsible if you break your installation or if you damage your machine in any way.
1st step
First of all, I highly advise to install Timeshift. It's a neat program that will make a snapshot of your system configuration (depending on how you configure it) so you can roll back in time if something goes wrong. It saved my linux installation many times.
2nd step
If you wish to see your current driver version, open a terminal and type:
$ nvidia-smi
I advise to write the version down, or at least remember it.
3rd step
To view all the nvidia drivers you can install, open a terminal and execute:
$ ubuntu-drivers list
or
$ ubuntu-drivers devices
These 2 commands (you can use whatever you prefer) will tell you all the nvidia drivers that are available for installation.
To delete your current nvidia driver, open a terminal and execute:
$ sudo apt purge ~nnvidia
Then, you can install one of the nvidia drivers we have seen before, for example:
$ sudo apt install nvidia-driver-535-server
(If I understand correctly, the server drivers are no different from the normal drivers, other than the fact that they are supported for longer and they should in teory be more stable).
4th step
After your new driver is installed, you can reboot your machine, using the UI or the terminal by executing:
$ sudo reboot
5th step
If you want to use X11, you're done. If you want to use Wayland, you have to do some additional steps.
To enable wayland in pop-os, you first have to enable nvidia modeset if it's not already enabled.
To check if it's enabled, you can go inside /etc/modprobe.d/
and check if any of the files contains options nvidia_drm modeset=1
. If you find nothing, you have to create the file yourself.
To do this, execute:
$ sudo nano /etc/modprobe.d/zz-nvidia-modeset.conf
The content of this file should be:
options nvidia_drm modeset=1
Then execute:
$ sudo update-initramfs -u
6th step
To be sure that there is nothing else blocking your machine from enabling wayland, execute:
sudo nano /usr/lib/udev/rules.d/61-gdm.rules
Inside this file there are some rules, some of which may stop your system from displaying the wayland option inside the little gear in the login screen.
Specifically, you have to check these lines:
LABEL="gdm_prefer_xorg"
#RUN+="/usr/libexec/gdm-runtime-config set daemon PreferredDisplayServer xorg"
GOTO="gdm_end"
LABEL="gdm_disable_wayland"
#RUN+="/usr/libexec/gdm-runtime-config set daemon WaylandEnable false"
GOTO="gdm_end"
LABEL="gdm_end"
Check that the lines starting with "run" are commented out.
7th step
We are almost done.
Execute in the terminal
$ sudo nano /etc/gdm3/custom.conf
Here you will find a line like this
# Uncoment the line below to force the login screen to use Xorg
# WaylandEnable=false
You can leave it as is, but if you can't see the wayland option in the login screen, you can come back and edit it like this:
# Uncoment the line below to force the login screen to use Xorg
WaylandEnable=true
8th step
You can reboot your machine, and when it boots back up, you should hopefully see the wayland option in the bottom-right gear in the login screen.
9th step
Don't forget to run:
$ flatpak update
To allow flatpak to install the new version of the nvidia driver for your flatpak software.
Final
I hope you found this tutorial useful. If you want you can suggest improvements, or edit and share it on other platforms if you want more people to see it.
Resources
https://askubuntu.com/questions/1428525/how-to-permanetely-disable-wayland
https://lemmy.world/post/2155783
https://unix.stackexchange.com/questions/700938/enable-wayland-in-popos-22-04