First of all I would like to say that by no means I am any expert of MX. I've already had tried a few times to install the nvidia drivers without bumblebee in the past to no avail, which always made me walk away from this distro. Last night I decided to give it another try on one my laptops, and after a few hours of back-and-forth tinkering I finally did it. So in hope to ease this process to others wanting to do the same, I decided to write this guide. If any of the admins or mods feel this is not the appropriate place to put it , feel free to move the topic elsewhere, as well as correct anything you deem necessary.
But first, a small explanation:
Why not use Bumblebee?
Bumblebee, as stated in https://github.com/Bumblebee-Project/Bumblebee/wiki/FAQ, is an "effort to make Nvidia Optimus enabled laptops work in GNU/Linux systems. Such feature involves two graphics cards with two different power consumption profiles plugged in a layered way sharing a single framebuffer." In simple words, it 'mimics' the behaviour you see in Optimus Laptops with Windows, where you have the integrated GPU doing the work most of the time, but when more intensive applications such as games or video editors are started, it 'switches' to the dedicated GPU to do the heavy work. This is done to save power, as dedicated GPUs are hungry bois and will decrease your battery life significantly.
AFAIK, the only way the MX team officially provides non-free drivers is with Bumblebee. However, IME the nvidia's driver performance with Bumblebee is...mediocre. And I'm being soft. Giving an example, with the NVidia drivers only I am able to run CS:GO at 60 fps +/- stable with low settings, whereas with the Bumblebee it is hard to pass over 25 fps. And sometimes, on certain hardware, installing Bumblebee itself can reveal to be very tricky. It's developers have the best intentions I'm sure, but with no access to the drivers source code being closed (I think? Nvidia likes to be nasty) it is definitely a challenge.
And sometimes, users (such as myself) prefer to have a better performance than better power saving, simply because power consumption is not a problem. You can take a look at the table that shows at the begining of https://forum.manjaro.org/t/howto-set-u ... iver/40225 to understand better the options you may follow. However, you must be warned : although it's getting better, Nvidia support for Optimus is still very, very messy. The following guide may not work in all hardware configurations.
In my case I used an ASUS X555LD (Intel i3 quad-core at 1,60 Ghz with iGPU , 4 GB Ram and an 2G Nvidia 820m dGPU) to install the drivers. Kernel is 4.19.0.6-amd64.
I will also assume that you the user have a minimal knowledge of terminal and system usage.
Important Note: There are some Optimus laptops with a setting in the BIOS which allows you to disable the integrated GPU. Before following this guide, you should check your laptop BIOS for that option, because if you do have it and enable it, the laptop will not be recognized as an Optimus one. This way you can install the nvidia drivers without bumblebee through the MX Nvidia Installer, and you don't need to follow this tutorial. If you don't have that option in your BIOS, feel free to continue reading. I'd like to thank to @Stevo for reminding me this.
1. Detect the nvidia driver you need for your card
Fortunately some folks have made a binary called nvidia-detect which makes this part very easy. Just run it in the terminal ( use apt-get to get it if you don't have it) and it will display the name of the non-free driver you are after. In my case it showed me this:
Code: Select all
Your card is on supported up to the 390 legacy drivers series
It is recommended to install the
nvidia-legacy-390xx-driver
package.
2. Installing the nvidia driver and required packages
So now that you know the driver you need to install let's take a look at the other packages that are recommended to install.
https://packages.debian.org/sid/nvidia- ... 0xx-driver
https://packages.debian.org/sid/nvidia-driver (430 version)
You can do this by choosing the link that matches your driver. For full integration I advise you to install the recommended (rec) packages as well.
So in my case I did:
Code: Select all
sudo apt-get install nvidia-legacy-390xx-driver libnvidia-legacy-390xx-cfg1 nvidia-settings-legacy-390xx nvidia-legacy-390xx-kernel-dkms nvidia-persistenced nvidia-legacy-390xx-driver-libs-i386 libgles-nvidia-legacy-390xx1 libgles-nvidia-legacy-390xx2 nvidia-legacy-390xx-vulcan-icd
3. Configure the Nvidia persistence daemon
There may be a case where during the install , the persistence daemon may be installed first than the kernel module, and started without it(so I think): this will make it fail and you might see a message like this:
Code: Select all
nvidia-persistenced failed to initialize. Check syslog for more details.
Code: Select all
sudo dpkg --configure nvidia-persistenced
4. Configure X.Org server
The X server needs to recognize the nvidia card before we can use it
4.1 Know the BusID of your dGPU card
To proceed to the next step you need to know what is the BusID of your dedicated GPU. You can do this by running in the terminal:
Code: Select all
lspci -nn | egrep -i "3d"
Code: Select all
04:00.0 3D controller [0302]: NVIDIA Corporation GM108M [GeForce 920MX] [10de:134f] (rev a2)
4.2 Create/Modify xorg.conf
Create a file (or modify it if you already have it) /etc/X11/xorg.conf. I'm using nano as the text editor
Code: Select all
sudo nano /etc/X11/xorg.conf
Code: Select all
Section "Module"
Load "modesetting"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:X:Y:Z"
Option "AllowEmptyInitialConfiguration"
EndSection
5. Configure Display Setup Script
The last step is basically to tell the display manager that want to use the Nvidia card. In my example I will use lightdm but the idea is always the same: the display manager needs a script to set the output source to the Nvidia card before starting. Others can find useful info at https://wiki.debian.org/NvidiaGraphicsDrivers/Optimus
5.1 Search for display setup scripts
If you examine the lightdm.conf file (in /etc/lightdm/lightdm.conf) you may discover that a display-setup-script is already assigned in the [SeatDefaults] tab. In my case I had display-setup-script=/usr/local/bin/early-bg , so in this case there is no need to create a new script; we will just add the information to this one. I honestly don't know If this is a hacky solution, but AFAIK lightdm only allows to have one script assigned to each system hook (correct me if I'm wrong please) so that'll have to do.
5.2 Create/Modify display setup script
If you did not find any script assigned, you can proceed to create one in /usr/local/bin
Code: Select all
sudo nano /usr/local/bin/nvidia.sh
Code: Select all
sudo nano /usr/local/bin/early-bg
Code: Select all
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
If all went well, you should be ready to reboot your system. If it reboots successfully, try to open nvidia-settings through the terminal. If it opens successfully ( you 'll see many tabs, opengl settings, info on your card , performance settings and so on) , that's it! You know have a Nvidia card running at full performance!
A. Something went wrong.
If any of the described steps didn't work for your, or if you simply wish to use another option you can always rollback to the open source drivers with sudo ddm-mx -p nvidia
B. Alternatives to Bumblebee?.
Directly? No, but there are other ways to achieve the GPU switch. One of them is PRIME, but as of the time of this writing I still didn't tried anything. If I discover how to do it I'll update this guide.
One last thing, if you eventually are able to follow these steps sucessfully at the end, you can be a friend and state on what hardware did you achieved it...that way more and more people will get a definite yes instead of a maybe :)
Cheers.
EDIT 1 It seems that in my pc the plymouth service would fail after following this guide. If someone comes across the same error, please comment down below. In any way, since I like to see the whole boot process I removed plymouth. Using kernel parameter "nosplash" also does the trick. System now runs smoothly, and I've tried some games with sucess!