In 2016 a lot has been changed in the development of the NVIDIA graphics driver. Xorg 1.19 has become available which supposedly removes the tearing on the NVIDIA nonfree proprietary graphics driver. I wanted to see if my GT555M was able to be configurated in DietPi X86_64.
In short, this isn’t a super easy job. Lot’s of information on the web is outdated or incomplete. Making both displays (HDMI and internal LVDS) work isn’t a matter of doing apt-get install nvidia as it may conflict with the NOUVEAU graphics driver. I purged that I had quite some trouble making the driver install properly.
First, install your X server as the driver looks for that while installing. Second, make sure you operate with the power adapter plugged in and third do not install BumbleBee or other software packages. Since DietPi doesn’t have a driver manager I installed the driver manually.
Start of by downloding the latest .run (driver file) from the NVIDIA download website. After you chmod + x the .run file you can run it by typing sh NVIDIA-Linux-x86_64-3XX.XX.run. Before you can do that you need the MAKE and GCC modules and the Linux kernel Headers. Install the kernel headers first by installing ‘apt-get module assistant’ and then type ‘m-a prepare’. These are removed afterwards after the installation. Make and GCC speak for themselves.
I install the NVIDIA driver manually from the latest .run as the apt-get is quite behind already. Game developers always use the newest stuff. Since NVIDIA 319.x Optimus cards are supported. Remember for Steam also to install these 32 bit compatibility files by saying YES in the install screen. It installs these files:
- libgl1-nvidia-glx-i386
- libgl1-fglrx-glx-i386
- libgl1-nvidia-glx:i386
It builds the kernel modules afterwards. Since the NVIDIA card is an Optimus one it renders all graphics onto the NVIDIA card and copies that to the Intel card which is attached to the LVDS display. The HDMI port is directly attached to my external display. This is called a muxless setup. I was not able to disable the Intel card in the BIOS as this is not allowed by ASUS.
What is important is that without a proper xorg.conf the system does not show any image. A black screen. Via SSH you can see that the X server crashed if no proper xorg.conf is used.
The NVIDIA installation will generate a file called XF86config but this won’t work. I attached my xorg.conf here. Without this file the Nvidia X-settings control panel (see screenshot) does not startup. You can do the nvidia-xconfig command in terminal but this almost never gives a good xorg.conf.
After installing the driver I got a lot of errors in the Xorg.0.log which indicated that the driver wasn’t installed properly. So I purged everything and started over. You need to make sure the xorg.conf is correct. A correct xorg.conf has two devices, two screens, a proper serverlayout and proper BusID for both the NVIDIA and the Intel card. Most of the time the BusID from my xorg.conf is correct for yours.
Next, edit etc/lightdm/lightdm.conf in the SEAL section where you type the startup script: display_setup.sh. Chmod +x that file. You need to build this sh file yourself i a tekst editor.
This display_setup.sh enables the internal laptop LVDS screen by setting the modesetting driver for the Intel card.
Used configuration is Debian 9. Kernel 4.9.0-3-amd64 x86. Xorg 1.19.2. Nvidia driver version 381.22.
Some side notes
- Blacklist Nouveau. I purged it but you can also disable it within the installation of NVIDIA.
- For tear free experience you might need to enable PRIME synchronization. I didn’t do this yet
- Install the NVIDIA driver running in command mode and not while X is running
- HDMI hotplug is not working (yet) so if you boot up without an external screen connected, connecting it will not work.
- HDMI Audio is a whole different story and is out of the scope of this blog.
- VGA is untested yet
- For kernels newer than 4.9 you might need a patch see below
Reference links
Complex setup with Nvidia Optimus / Nouveau Prime on Fedora 20
Archlinux Wiki: NVIDIA Optimus
VXLabs: solving the black screen with NVIDIA Prime
Gentoo Linux Wiki: NVIDIA Optimus
Switching between NVIDIA and Intel graphics drivers manually
PRIME Synchronization in the Xorg server
Kernels 4.11 and 4.12 NVIDIA driver patch