Installing the proprietary Nvidia drivers along with a current Linux distribution in a Clevo M570RU-U laptop

Installing the proprietary Nvidia drivers along with a current Linux distribution in a Clevo M570RU-U laptop

INTRODUCTION

The Clevo M570RU-U was briefly considered the state of the art gaming laptop when first released in late 2007. I bough it, rebranded as a Nexoc, as a desktop replacement one year later for half the launching price. It has been distributed under different brand names, the most common one being Sager NP5793.

Initially with 4GB of RAM memory, an Nvidia Geforce 8800M GTX graphics card and Core 2 Duo Penryn processor, it was a extremely powerful machine four years ago and it remains quite good for current standards. Initial criticism focussed mainly in the too glossy 17″ panel and fan noise.

Yet, the firmware provided with this machine has always been buggy, from the first to the newest releases. Many hardware manufacturers do not care about quality or standards as far as their devices can run Windows. Even worse, manufactures need to introduce bugs on their firmware in order to workaround Windows bugs and free software developers need to introduce workarounds to deal with the bugs and workarounds in the firmware. On top of if, the arrival of Vista and later Windows 7 forced many manufacturers to modify their firmware after the many years of the peaceful XP reign. If this was a disaster for many Windows users, for the free software community this was a shock whose consequences we are still suffering today. Yes, because when those workarounds become deprecated our “old” machines become unsupported.

This was the case for this laptop. Linux kernels above 2.6.32 did not worked well with the sound card and the Nvidia proprietary drivers above 270.41.19 render the system unusable in Linux. I have tried absolutely everything to workaround these issues. To no avail. In order to solve the sound card problem, I ended up purchasing an external USB card. The issue with the proprietary drivers should not concern you if you do not need to exploit all the GPU features, such as full 3D and/or CUDA acceleration, for the free Nouveau drivers work quite well with this card. Unfortunately, that is not my case, I need both OpenGL and CUDA for my work.

Debian Squeeze (Stable at the time of this writing) and RHEL 6 (and its derivatives such as Scientific Linux and CentOS) still run a 2.6.32 kernel and a version of the Xorg Xserver which is compatible with the 270.41.19 driver. This is perfect, because that kernel also supports well my sound card. The driver allows one to use CUDA 4.0, which is all I need, and therefore I have been happily using Squeeze for years (I started when it was still Testing).

The problem is that, when Debian Stable nears the end of it release cycle, the libraries start to be a bit old for certain developer’s standards, which means that compiling new code increasingly becomes a pain. I starting pulling newer libraries from Testing (codenamed Wheezy) over a year ago until that last week I made a stupid mistake that broke my system.

Now I see three options:

1.- Giving away this buggy laptop and buying a new one. But no, I do not want to become so easily a victim of programmed obsolescence.

2.- Migrating to FreeBSD or OpenIndiana, both of which support well this laptop. In fact, I have been using FreeBSD for a week and I liked it. The problem is, in addition to the learning curve, that some of my peripherals such as my wireless printer are not supported and many of the software I need needs to be installed under Linux emulation.

3.- Building an operating system with a modern userland (except for the Xorg server which cannot be newer than 1.10, for that is the last version supported by the aforementioned Nvidia drivers) and an old kernel (2.6.32). Being a Linux-specific and model-specific issue, no one else was going to do it and so I have done it myself.

In the next sections I am going to explain how I created a Debian Stable/Testing hybrid distribution compatible with the Nvidia drivers 270.41.19. The usual disclaimer: These instructions are here mostly as a reminder for myself. I would be very glad if someone else finds some part of this description useful but it is not indented for being reproduced. First of all, I am not sure if the procedure is exhaustive and detailed enough and, second, even if my hybrid system was been running fine for a few days now it could break at any minute.

BIOS

I downloaded the latest BIOS and EC/KCB firmware from here:

http://forum.notebookreview.com/sager-clevo/556299-clevo-bios-older-models.html

The VBIOS flashing software from here:

ftp://ftp.clevo.com.tw/ALLBIOS/M57xRU/57RU_GTX.zip

and the latest VBIOS ROMs from here:

http://rapidshare.com/files/123389206/Clevo_8800M_GTX_BIOS_Archive.exe.html

(you can extract the roms with “7z e Clevo_8800M_GTX_BIOS_Archive.exe”)

The procedure of flashing the BIOS involved creating a FreeDOS USB pen drive with UNetbootin, copying the files to it, booting from it, going into the c: drive and then into the directories and running the update scripts. First the EC, then the BIOS and then the VBIOS. Just make sure that the update.bat scripts point to the ROMs you want to use.

However, this is not recommended if your current firmware is working fine. In any case, in my experience, the newer Nvidia drivers are not going to work in Linux with any of the different BIOS versions available. Furthermore, flashing the VBIOS with the ROM of a 9800M GT card does not solve the issues either. They say you gain HDMI capabilities (I have not tested it), but I lost the TwinView functionality of the driver and therefore reverted to the 8800M GTX VBIOS. I also tried a modified BIOS which permits some advanced configuration (advanced options are shadowed in the official releases of the firmware). I found no combination of options which alleviates the issues and therefore reverted to the official firmware.

Right now I am running with the default options except for the diagnostic booting screen (which is activated) and the Intel Robson capabilities (also activated). In my case, activating Robson makes no sense and it is not recommended. Be aware that if you activate this option after installing your OS you may not be able to boot and you may need to reinstall the system.

In summary, as far as I can tell, I have the latest versions of the BIOS firmware with the default options. This is most likely irrelevant, tough.

INSTALL DEBIAN SQUEEZE

I preferred a partial upgrade from a Stable base system to Testing (and from there building the whole system), rather than trying to downgrade xorg and the kernel in Testing.

1.- Download debian-6.0.4-amd64-netinst.iso from http://www.debian.org/releases/squeeze/debian-installer/
Burn a CD and boot from it.

2.- Install in expert mode. Follow the instructions.

3.- Software selection:

Uncheck “Desktop environment”
“Laptop” is already checked
“Standard system” is already checked
Optional: I also checked “SSH server”

4.- Reboot and login as root

UPGRADE TO WHEEZY

5.- Added the following (you can use for wheezy the same mirror you chose for squeeze) to /etc/apt/sources.list

deb http://ftp.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org wheezy/updates main contrib non-free
deb-src http://security.debian.org wheezy/updates main contrib non-free

6.- Added the following to /etc/apt/apt.conf.d/70debconf

APT::Default-Release “wheezy”

7.- Created a /etc/apt/preferences file with the following content (this assumes that the release is referred to as “squeeze” and not “stable” in /etc/apt/sources.list):

Package: xserver-*
Pin: release n=squeeze
Pin-Priority: 1001

8.- apt-get update; apt-get upgrade; apt-get dist-upgrade

INSTALL DESKTOP ENVIRONMENT

9.- apt-get install xorg

10.- apt-get update; apt-get upgrade; apt-get dist-upgrade

11.- apt-get install xfce4 xfce4-goodies menu

12.- apt-get install lightdm

13.- Reboot into your graphical desktop.

FIX DSDT (ACPI)

References:     http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems

http://www.lesswatts.org/projects/acpi/overridingDSDT.php

As I mentioned before, the BIOS is buggy. One can fix a couple of things in the DSDT (Differentiated System Description Table). Does this help? I do not know, but I did it anyway. After fixing the DSDT, I rebuilt the kernel instructing it to use the fixed filed I created.

1.- cat /sys/firmware/acpi/tables/DSDT > dsdt.dat
2.- su -
3.- apt-get install iasl
4.- exit
5.- iasl -d dsdt.dat
6.- iasl -tc dsdt.dsl

There I see 2 errors and one warning:

Intel ACPI Component Architecture
ASL Optimizing Compiler version 20100528 [Jul  2 2010]
Copyright (c) 2000 – 2010 Intel Corporation
Supports ACPI Specification Revision 4.0a

dsdt.dsl  1119:                     0x00000000,         // Length
Error    4122 –                              ^ Invalid combination of Length and Min/Max fixed flags

dsdt.dsl  1133:                     0x00000000,         // Length
Error    4122 –                              ^ Invalid combination of Length and Min/Max fixed flags

dsdt.dsl  6289:             Method (WMBB, 3, NotSerialized)
Warning  1088 –                        ^ Not all control paths return a value (WMBB)

ASL Input:  dsdt.dsl – 6335 lines, 222085 bytes, 2313 keywords
Compilation complete. 2 Errors, 1 Warnings, 0 Remarks, 47 Optimizations

7.- The errors come from the fact that the value of length is wrong in lines 1119 and 1133. You can use a text editor to replace the hexadecimal value “0x00000000″ with “0xE0000000″ and “0x00005000″, respectively. If you want to understand why:

http://ubuntuforums.org/showthread.php?t=1036051&page=52

NOTE: The warning can be prevented by adding a line with, for instance, a “Return (Zero)” between lines 6323 and 6324. This allows an error-free compilation, but, as I am not sure of the right value to put there and as it does not seem to have any noticeable effect, I decided not to care about the warning and leave it as it was original. In addition, I also tried to remove any reference to Linux in the table. The rationale being that the issues are Linux-specific and therefore it may be that the BIOS is providing the wrong information to Linux systems. This fixes some warnings in dmesg but also brought some new errors. I therefore restored the original dsdt.dsl and only made the 2 changes referred above (the lengths).

8.- su -

9.- cp /path/to/dsdt.hex /usr/src/dsdt_table.h

REBUILDING THE KERNEL (and instructing it to read new DSDT table)

References:     https://help.ubuntu.com/community/Kernel/Compile#Alternate_Build_Method:_The_Old-Fashioned_Debian_Way

http://en.gentoo-wiki.com/wiki/ACPI/Fix_common_problems

http://www.lesswatts.org/projects/acpi/overridingDSDT.php

10.- apt-get install linux-source-2.6.32 build-essential kernel-package ncurses-dev bzip2 module-init-tools initramfs-tools procps fakeroot

11.- cd /usr/src

12.- tar jxvf linux-source-2.6.32.tar.bz2

13.- cd linux-source-2.6.32

14.- cp /boot/config-$(uname -r) ./.config

15.- make menuconfig

Device Drivers —>
Generic Driver Options —>
[ ] Select only drivers that don’t need compile-time external firmware
[ ] Prevent firmware from being built

Power management options (ACPI, APM) —>
ACPI (Advanced Configuration and Power Interface) Support —>
(/usr/src/dsdt_table.h) Custom DSDT Table file to include

16.- Exit and edit the .config file with a text editor and save. Make sure that the following variables are defined as follows:

CONFIG_STANDALONE=n
CONFIG_ACPI_CUSTOM_DSDT=y
CONFIG_ACPI_CUSTOM_DSDT_FILE=”DSDT.hex”

The last two should be already OK. The first one needs to be defined.

17.- make-kpkg clean

18.- export CONCURRENCY_LEVEL=2

19.- fakeroot make-kpkg –initrd –append-to-version=-dsdt kernel_image kernel_headers

20.- cd ..; dpkg -i *.deb

ONE EXTRA STEP

21.- Edit /etc/default/grub and change

GRUB_CMDLINE_LINUX_DEFAULT=”quiet”

to

GRUB_CMDLINE_LINUX_DEFAULT=”acpi_apic_instance=2 quiet”

I do not know whether it is better 0 or 2. Certain people in the fora claim that 2 is better. Honestly, I see no difference so far.

22.- update-grub

23.- Reboot into the custom kernel (3rd entry in Grub menu)

NOTE: Now, if you have a look to dmesg, you should see no real errors. There is one “error” (about not finding the restore image) but it is irrelevant. There is one “conflict” which is also irrelevant. A few warnings, some are also irrelevant and the rest I do not know very well what to do with them.

24.- su -

25.- apt-get remove –purge linux-image-2.6.32-5-amd64

INSTALL NVIDIA PROPRIETARY DRIVERS

1.- apt-get install ia32-libs ia32-libs-dev

2.- Create a /etc/modprobe.d/disable-nouveau.conf file with the following contents:

blacklist nouveau
options nouveau modeset=0

3.- mkdir Downloads/nvidia; cd Downloads/nvidia

4.- wget -c http://developer.download.nvidia.com/compute/cuda/4_0/drivers/devdriver_4.0_linux_64_270.41.19.run

5.- chmod +x devdriver_4.0_linux_64_270.41.19.run

6.- Reboot, at the login screen press CTRL + ALT + F1, then login as root

7.- /etc/init.d/lightdm stop

8.- cd /home/USER/Downloads/nvidia

9.- ./devdriver_4.0_linux_64_270.41.19.run

Follow the instructions and say Yes to everything (it is not the default).

10.- Reboot

INSTALLING CUDA

I will not go into the details. You need to install CUDA Toolkit 4.0 for that is the most recent version supported by the 270.41.19 driver:

http://developer.nvidia.com/cuda-toolkit-40

You will run into some problems. First it seems that in Wheezy /tmp is a virtual drive with limited space and therefore the self-extracting archive will no be able to extract the temporary files. One solution is to define the variable TMPDIR before running the installer. Once the installation is done, we can create a file /etc/ld.so.conf.d/cuda.conf with the following contents:

/usr/local/cuda/lib64
/usr/local/cuda/lib

And then run ldconfig as root.

Finally, we can add /usr/local/cuda/bin to the normal user path in /etc/profile

You can also install the visual profiler patch, as explained here:

http://forums.nvidia.com/index.php?showtopic=210289

If you want to install the NVIDIA GPU Computing SDK in order to run some test, you will need to compile the tests. This involves installing:

sudo apt-get install freeglut3 libghc-glut-dev gcc-4.4 g++-4.4 cpp-4.4

Next, we need to set the 4.4 version of the compiler as the default as explained here:

http://askubuntu.com/questions/26498/choose-gcc-and-g-version/26518#26518

(replace 4.3 with 4.6 and do not use the script). We can revert to the original situation (gcc-4.6 as the default) when the compilation is done. Remember that you can compile both the C and the OpenCL tests (just type make in both directories). In my case the system passed all test.

CONFIGURING THE PACKAGE MANAGER

This is the tricky thing. We have a mixed stable/testing system with a user-compiled kernel. More specifically, we have a Debian Testing (Wheezy) system with and old Xorg (version 1.10) pulled from Stable (Squeeze). We have used apt pinning to make sure that the preferred versions of Xorg and Xserver come from Squeeze. However, this may not be enough. We also need to make sure that those packages will never be upgraded or removed. As root:

echo “xorg hold” | dpkg –set-selections
echo “xserver-xorg hold” | dpkg –set-selections

You can check  it that worked:

sudo dpkg –get-selections | grep hold

This is explained here:

http://www.debianadmin.com/how-to-prevent-a-package-from-being-updated-in-debian.html

I have also added some extra lines to /etc/apt/apt.conf.d/01autoremove in order to make sure that certain packages will never become candidates for auto-removal:

NeverAutoRemove
{
“^firmware-linux.*”;
“^linux-firmware$”;
“^linux-image.*”;
“^linux-.*”;
“^libuuid-.*”;
“^xorg$”;
“^libdrm-nouveau1a$”;
“^kfreebsd-image.*”;
“^linux-restricted-modules.*”;
“^linux-ubuntu-modules-.*”;
“^gnumach$”;
“^gnumach-image.*”;
};

Alternatively, you can entirely disable the autoremove function.

Is this enough? Probably not. Each time that you use the package manager you need to check carefully the list of packages to be upgraded or removed and do not commit any changes until making sure that no essential system package or essential xserver package is included. If you see a suspicious one, keep it on hold as explained above.

RESULTS

I have been running this system for a few days now and it works just fine.

I have not been able to install OpenShot, but this appears to be a Wheezy bug and it is not therefore specific to my hybrid system. In addition, VLC segfaults. This is more likely a problem with my system, for VLC tends to be more dependent on up-to-date xorg packages. Happily enough there are other video players such as SMPlayer which function perfectly well. Other than that, I have experienced no problems at all.

3D acceleration works and CUDA-enabled applications run.

sopranix

About these ads