Me and U(buntu)

My Ubuntu Experience!

Install NVIDIA 177.13 drivers on realtime kernel

Posted by ushimitsudoki on July 17, 2008

Alright! As I posted in an earlier blog post, there is some problem with the installer for the 177.13 (and 173.14.09) NVIDIA drivers. It seems that these recent installers will NOT work on a realtime kernel.

There is a post on the nvidia forums that describes the problem, but leaves out some of the details on how to actually fix it. At least, I didn’t immediately see the answer.

This is what I did to install the 177.13 drivers:
1. Download the drivers

2. Reboot into “recovery mode”, or use CTRL-ALT-F1 to drop to a terminal and kill X.

3. Run the driver script with the “-x” (extract-only) option:
sudo sh NVIDIA-Linux-x86_64-177.13-pkg2.run -x
(This is for the amd64 drivers, so make appropriate changes if needed, of course.)

4. Make the replacements mentioned in the nvidia linux forums post in nano:
sudo nano usr/src/nc/nv-linux.h
(You can use CTRL-\ for search and replace in nano.)

Replace “__SEMAPHORE_INITIALIZER” with “__COMPAT_SEMAPHORE_INITIALIZER”
Replace “struct semaphore” with “struct compat_semaphore”

5. Run the installer:
sudo ./nvidia-installer

From here on out it should work just like normal!

And the lovely end result:

177.13 Drivers Installed!

177.13 Drivers Installed!

14 Responses to “Install NVIDIA 177.13 drivers on realtime kernel”

  1. Oli said

    Hi,

    Thanks for providing this guide. It’s a big help for me, but I still have a few (newb) questions. Any additional help would be greatly appreciated.

    - Do you completely remove all nvidia related packages prior to running nvidia-installer?

    -Do you use the nvidia kernel modules from the Ubuntu repositories? (this didn’t work for me, as nvidia-installer didn’t recognise the module)

    - nvidia-installer gives a couple of options regarding the kernel module, either for it to look for a binary on nvidia.com, or for it to attempt to build the module from source; which would you recommend?

    - Does the nvidia-installer just replace the nvidia-glx package?

    Cheers mate,

    Oli

  2. Oli,

    >>> Do you completely remove all nvidia related packages prior to running nvidia-installer?

    Yes. If the drivers you currently have installed you manually installed, then you can just install one over the other. However, if the drivers you currently have installed are from Ubuntu, you need to completely remove them.

    You have 2 basic options when it comes to NVIDIA drivers:
    1. Stick with the ones Ubuntu offers, either in the repository or using something like EnvyNG. This is easier, but the drivers are always behind current releases.
    2. Totally get rid of any NVIDIA-related stuff, and install the drivers yourself. This is a bit harder, but you have a lot more flexibility in what drivers you want to run.

    The hardest thing I ran into was the very first time I tried to install the drivers myself. It took several attempts before I had all the “normal” Ubuntu stuff out of the way. There is a sticky post on the NVIDIA forums that tells you what to do if you want to manually install the drivers: http://www.nvnews.net/vbulletin/showthread.php?t=72490

    If you install the drivers, but X comes up in some funky video mode it usually means the installation failed and X fell back to the default vesa driver. This probably means some of the Ubuntu stuff is still in there.

    >>> -Do you use the nvidia kernel modules from the Ubuntu repositories? (this didn’t work for me, as nvidia-installer didn’t recognise the module)

    No. Once you start installing the drivers yourself stay far away from the stuff in the repos. Download them directly from NVIDIA.

    >>> – nvidia-installer gives a couple of options regarding the kernel module, either for it to look for a binary on nvidia.com, or for it to attempt to build the module from source; which would you recommend?

    You will always have to build them. The NVIDIA site never has the pre-compiled stuff. This means:
    - You need the linux-headers package for your kernel.
    - You must re-install the driver EVERY TIME the kernel is updated. (Some minor kernel bug fixes might not require this, but I usually do anyway as a matter of practice.)

    - Does the nvidia-installer just replace the nvidia-glx package?
    Sort of. nvidia-installer is NOT a package, though. It is an application that installs the driver. It “replaces” nivida-glx in the sense that if you are using one, you won’t be using the other.

    Once you get the downloaded-from-NVIDIA drivers installed once, it’s easy as pie to install new downloaded-from-NVIDIA drivers, and move back and forth between versions if you have problems.

    As I mentioned earlier, though, that first changeover can be a bit of a pain.

  3. Oli said

    Hi ushimitsudoki,

    Thanks for your prompt and thorough reply. Much appreciated.

    Your directions have given me some ideas for trouble-shooting.

    Cheers,

    Oli

  4. Oli said

    Hi ushimitsudoki,

    Hope you don’t mind me posting back with more questions…

    I think the main problem I was having, was that I thought I would be able to install the nvidia drivers to work with both the real time and standard kernels.

    What I was aiming to do, was boot with the non-real time kernel for most of my daily computing, and only boot into the real-time kernel when I wanted to use my Linux based music production software.

    I was hoping that if I installed the nvidia drivers with the alterations to nv-linux.h, then I would be able to use this driver for both kernels.

    Originally, I was trying to install the dirver with the altered header file, compiling the nvidia kernel module against the non-real time kernel; this failed to build. I did manage to install the driver unmodified, though.

    Installing the nvidia driver with the modified header file, compiling the nvidia kernel module against the real time kernel also works.

    Unfortunately the nvidia real time kernel module fails to load when booting with the non-real time kernel. That is a real pity, but it makes sense.

    I didn’t really think this one through very well.

    The main reason I wanted to still use the non-real time kernel was that I have heard of some compatibility issues with the real time kernel, and also that overall throughput is sacrificed for guaranteed performance for real time tasks. Most of what I do doesn’t require this, and I can imagine cases where compatibility could be a pain.

    Anyway, just thought I would post this for oher people to read. I’m guessing this is also written up in various other places.

    So, for now, I will test drive my installation with the real time kernel.

    I will also have a quick look into whether I could set up some kind of kernel sensitive switch (perhaps an ifdef in the xorg.comf?) to load graphics drivers appropriately. For now I guess the best I could possibly achieve is to revert to “nv” drivers if not running the real time kernel.

    Have you any thoughts on this?

    Thanks again for all your help mate. Your wirte up was definitely beneficial to me, as it was easier to find in the Google search results than the original thread where this was discussed.

    Cheers,

    Oli

  5. Oli,

    Yes, if you switch back and forth between -rt and -generic kernels, you will have to re-install the drivers each time.

    The easiest way that I know of if you want to switch between kernels is just boot into the appropriate recovery mode for the kernel version you want to use, re-install the driver (it will give you a warning that you are installing it as root, but it works fine), and then init 3.

    There may be some sort of scripting switch that can do the same thing or swap the appropriate files, but I have not looked into that. I do use switchconf to change some settings based on my GRUB menu, but not the video drivers.

    This is because I usedd to run the -rt exclusively and never ran into performance or compatibility problems (present issue excepted, of course). However, the last I read on the new kernel with Intrepid was that the -rt kernel does not support SMP, so currently I am running -generic.

    I expect this SMP issue will be resolved soon (if it isn’t already), and then I will move back to -rt as my regular kernel.

  6. Oli said

    Hi ushimitsudoki,

    With regards to the current Intrepid real time kernel, 2.6.27-3.8-rt, I believe it has a few bugs.

    I have read that it still does not support SMP. I only have a single 1.8GHz PIV, so this is not really an issue for me at the moment.

    Some people have reported that it will not run USB MIDI interfaces, which is what I am currently having trouble with. It seems that all the relavent modules are included, though problems persist.

    Using this kernel also results in some issues with ACPI control. My machines will not self power off, and others have reported that machines will not resume from suspension (I don’t do this, as I have had bad experiences in the past).

    I’ll have a look into the driver switching issue. I’m pretty sure there could be something done to achieve the result I am looking for, though I doubt there is a clean and simple solution. i really don’t want to re0install for each switch in kernel – too long a boot time, and too inelegant for my liking.

    Thanks again for provding this page.

    Cheers,

    Oli

  7. johnt said

    -yes, if you switch back and forth between -rt and -generic kernels, you will have to re-install the drivers each time.

    This is not the case. All you need to do is build and install the patched kernel module code in each of the kernels that you use. Once you have done this once, you can switch between your own kernels or stock kernels as much as you like. This is how I run all the time: a stock kernel for day to day stuff and an rt kernel for music recording – all with the nvidia drivers installed.

    John T.

  8. switcher said

    Johnt,

    That sounds great (switching between stock kernels) – but as a newbie, could you elaborate on how to do this? Thanks!

  9. Simon Valentiny said

    hi,

    i have exactly the same problem, dual-boot system with default and realtime kernel. and i’m a newbie too. when i install nvidia driver in realtime kernel manually, it works fine in this kernel, but x-server fails to start in default kernel and vice versa.

    how can i install nvidia driver in both kernels separately?

    simon

  10. Simon,

    In the past, I have always re-installed the drivers each time I changed kernels.

    However, John T’s comment indicates this is not needed, and once you have installed the drivers once under each kernel it will work. I haven’t tried that yet.

  11. switcher said

    I have the same issue as Valentiny: the only way I can switch between rt and stock kernel is to rebuild the drivers – you get the chance to do that once the drivers fail to load.

    It really would help if johnt can elaborate on how he overcomes this problem.

    Very tantalising!!

    As of this post, the bugs in the rt still haven’t been fixed, making it necessary to switch between the rt and stock kernels.

  12. switcher said

    Finally here’s the solution having with different nvidia drivers in different kernels.

    The problem is that when running the nvidia installer, it wipes out the driver from other kernels and just installs for the current one.

    The installer builds a nvidia.ko kernel object and places it in
    /lib/modules/CURRENT-KERNEL-NAME/kernel/drivers/video/nvidia.ko
    where CURRENT-KERNEL-NAME is that returned by ‘uname -r’

    The trick is to force the installer to just build for a user-specified kernel and do nothing else.
    The following worked for me. I was running the rt-kernel with the modified nvidia driver as described in this thread. I wanted to install the standard (unmodified) driver into my latest generic kernel (2.6.27-11-generic). This is what I did:

    stop x server:
    sudo /etc/init.d/gdm stop
    (sometimes this hangs using the rt kernel – hitting crtl-alt-F1 afterwards can help – else reboot & try again)

    Install nvidia using:
    sudo ./nvidia-installer –kernel-name=2.6.27-11-generic -K

    Note the two options here:

    –kernel-name=2.6.27-11-generic
    will install to the named kernel (as obtained from ‘uname -r’)

    -K
    will install the nvidia.ko object without un-installing existing drivers / kernel objects.

    I found you need to use both options together!

    After the install completes, you will have a new nvidia.ko in:
    /lib/modules/2.6.27-11-generic/kernel/drivers/video/nvidia.ko
    while the one in:
    /lib/modules/2.6.27-3-rt/kernel/drivers/video/nvidia.ko
    is untouched.

    Restart X with:
    sudo /etc/init.d/gdm start
    (or simply re-boot if that fails)

    Use grub to select 2.6.27-11-generic
    The nvidia drivers you just compiled will load.

    You can now switch between kernels as normal (using grub) without having to re-build the drivers!

  13. Simon Valentiny said

    That’s it! The -K option = –kernel-module-only, thanks a lot, switcher!

    Simple way:

    #boot default kernel and switch to runlevel 3
    init 3
    ./nvidia-installer
    reboot

    #boot kernel-rt
    init 3
    ./nvidia-installer -K

  14. [...] [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>