How to add modules to initramfs

How can I add ‘nvidia’ , ‘nvidia_modset’ , ‘nvidia_uvm’ , ‘nvidia_drm’ to initramfs?

Why do you need to do this manually?

1 Like

The problem is when I execute the command “optimus-manager --switch nvidia” , the laptop screen just turns off. I know I’m at the login page, because I can login using terminal(Ctrl+Alt+F1/F2), and when I execute (glxinfo | egrep “OpenGL renderer”) it shows “unable to open display”.

indeed without any strong reason i would not like to have these builded inside the kernel images… better to have them in kernel line for grub to be loaded.

and the only parameter needed is

nvidia-drm.modeset=1

you can add this into grub kernel line:

sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1 resume=UUID=...

and regenerate grub.cfg:
sudo grub-mkconfig -o /boot/grub/grub.cfg

2 Likes