Skip to main content

Installing Nvidia drivers on W530 with Ubuntu 12.04

I'm not sure if it's the particular laptop model (Lenovo W530) or the particular Ubuntu version (12.04 LTS) or perhaps the fact I'm a complete and utter Linux newbie, but getting this show on the road has been quite a bumpy ride, to say the least (just shoot me would probably describe it more accurately, all I wanted was to set up a dual monitor environment).

  1. Remove existing Nvidia drivers: "sudo apt-get purge nvidia*".
  2. If you have a Nouveau xserver installed, you will probably need to remove it, or at least disable it in order to prevent conflicts with the nvidia drivers. I purged the hell out of it: "sudo apt-get purge xserver-xorg-video-nouveau". 
  3. Install the latest nvidia drivers: "sudo apt-get install nvidia-experimental-310".
  4. vi /etc/default/grub and add the "nox2apic" flag to the GRUB_CMDLINE_LINUX option.
  5. Update the grub: "sudo update-grub".
  6. Reboot.
  7. Enter the bios and change the display configuration to "Discrete".

Worth noting:
  • I'm not sure that the brutal "apt-get purge nvidia*" command is really necessary, but since it was a long journey, at some stage I wanted to make sure I was not being trolled by some driver/version conflicts and removed it all.
  • "nvidia-experimental-310" states that it's "...an unstable beta driver... intended for testers and early adopters, but since I've come to realize every Linux user is in fact a tester (knowingly or not), I've come to terms with using it. Should any problems arise, I'll make sure to upadte this post.
  • I had not been able to boot until I added the "nox2apic" thingy to the grub loader. It might be related to the bios virtualization I have enabled, along with the discrete display mode. I've seen some complaints about these two messing up boots left and right when combined.
  • Drivers prior to "nvidia-experimental-310" (even nvidia-current, which is equivalent to nvidia-experimental-304 as far as I could make out) did not seem to cut it,  I kept getting this error when trying to interact with nvidia drivers.
Btw, in Windows this whole thing would have been sorted out by pressing "Fn"+"F-something". Just saying.

Edit: 
Due to a recent system upgrade I've had the dubious pleasure of testing the whole routine under Ubuntu 13.10 with Cinnamon 2.0.14 and nvidia-319. Still works!

Also, if you're running a dual monitor setting and wish to set a primary monitor but run into the infamous "nvidia settings are lost upon logout" issue, add the following line to your xorg.conf (which you might need to generate first,  by bringing up "nvidia-settings"  and clicking the "Save to X configuration file" button).
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-3"
    Option         "TwinViewXineramaInfoOrder" "DFP-3"
    Option         "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-3: nvidia-auto-select +1920+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Make sure to use the correct monitor id, which you can pick up from the neighboring "metamodes" option. In my case it was "DFP-3".

Unlike the previous one, it "only" took like half a day to figure this out. Someone there in NVIDIA must be getting sloppy.

I'm still looking for a more elegant and generic solution to the infamous "nvidia settings are lost upon logout" issue, if you happen to have that one figured out, you're more than welcome to share your secret!

Comments

  1. Hey Stas,

    Thanks so much for this. I was looking for the parameter (nox2apic) to get things working right. had the experimental driver, but it's always that little switch that I'm forgetting.

    Much appreciated for the post!
    Andrew

    ReplyDelete
  2. Hi Andrew,

    Thanks for the comment, glad you found this post useful :)

    -Stas

    ReplyDelete
  3. These instructions fix the suspend AND dual external monitor on 13.04 as well.

    Thank you Stas! you've saved my day...

    ReplyDelete
  4. Thanks very much for the info. I found that purging Nouveau was not necessary. Here are the steps I followed to disable the Nouveau driver and install NVIDIA driver:

    1. Edited: /boot/grub/menu.lst
    Added the following options to my current kernel (kernel /vmlinuz-2.6.32-358.18.1.el6.x86_64): nox2apic nomodeset modeset.nouveau=0

    2. After the edits I ran:
    sudo mkinitrd /boot/initramfs-2.6.32-358.el6.x86_64.img 2.6.32-358.el6.x86_64 --force

    3. Added file: /etc/modprobe.d/nvidia-graphics-drivers.conf
    Content of the file:
    # This file was installed by nvidia-current-updates
    # Do not edit this file manually

    blacklist nouveau
    blacklist lbm-nouveau
    blacklist nvidia-173
    blacklist nvidia-96
    blacklist nvidia-current
    blacklist nvidia-173-updates
    blacklist nvidia-96-updates
    alias nvidia nvidia_current_updates
    alias nouveau off
    alias lbm-nouveau off

    4. Restarted OS

    5. Entered in Boot menue and changed Config -> Graphics -> Graphics Device: Discrete Graphics

    6. After loging in, I ran:
    sudo init 3
    This brought a text terminal.

    7. In the text terminal, I run:
    sudo NVIDIA-Linux-x86_64-319.49.run

    8. Restarted OS and NVIDIA driver worked! This allowed me to use Dual Monitors.


    * Some References:
    http://askubuntu.com/questions/112302/how-do-i-disable-the-nouveau-kernel-driver
    http://en.opensuse.org/SDB:NVIDIA_the_hard_way
    http://twocentsonsoftware.blogspot.com/2013/02/installing-nvidia-drivers-on-w530-with.html

    ReplyDelete
  5. Thanks, this worked nicely for my W520, I'll definitely try it on my w530 next weekend :)

    Btw, if you have problems adjusting brightness checkout:
    http://www.thinkwiki.org/wiki/LCD_Brightness#Nvidia_driver

    ReplyDelete
  6. Hi, I run:
    sudo apt-get install nvidia-experimental-310
    yet somehow version 319 got installed and in Additional Drivers there is nvidia_319_updates with this nice message "This driver is activated but not currently in use"
    I set up "Discrete" in BIOS and added the "nox2apic" flag in grub (tried in GRUB_CMDLINE_LINUX_DEFAULT and in GRUB_CMDLINE_LINUX) and when I pick Ubuntu from Grub screen on reboot I get blank screen :( I could only use my Ubuntu after switching back to "NVIDIA Optimus" in BIOS, but then I got my "favourite" message that stays the same even after running nvidia-xconfig thus generating xorg.conf file (the screen is then 600x340 or something, but I still get the same warning).
    Has any of you had a problem with starting Ubuntu even after setting this in grub:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nox2apic"? I don't even try with second screen yet (though this is my final goal).
    Thank you for your help so far!

    ReplyDelete
    Replies
    1. Ah, interesting

      Sorry for the dumb question, but you've also updated the grub ("sudo update-grub"), right?

      Delete
    2. Sure. I don't understand much of grub.cfg, but there is a few of "nox2apic" alongside "quiet splash" there...

      Delete
    3. And there is a nox2apic argument when I press "e" having selected Ubuntu in Grub menu.

      Delete
    4. How about you take a look at "lspci | grep -i vga"? What does it say?

      Delete
    5. It says:
      00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)

      Delete
    6. yeah, that's no good, it should say nvidia.

      Just to make sure, mind repeating the whole procedure from scratch, purging it all (including the experimental-319), and re-installing step by step?

      I'm kinda puzzled by the fact it (a) got you experimental-319 instead of 310 and (b) didn't actually activate it as evident by your output. Something feels wrong about it.

      Delete
    7. Well, curiouser and curiouser ;)

      The driver was activated at some point, but I've repeated your steps like 10 times yesterday to double-check and in one moment I switched to Integrated Graphics in BIOS which was kind of desperate and utterly stupid. But this is why NVIDIA couldn't get activated. So now with NVIDIA Optimus activated in BIOS and driver "activated but not used" there is:

      00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
      01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K2000M] (rev a1)

      + It turns out that nvidia-experimental-310 latest version is 319...

      And I still cannot boot after switching to Discrete (having nox2acpi flag) :(

      Delete
    8. Status update: It works! :) I am not sure which step helped, though...
      I disabled Virtualization in BIOS. I purged NVIDIA again + I removed ~/.nv, ~/.nvidia-settings-rc and /etc/X11/xorg.conf. I also updated initframes by with update-initramfs -u. And I blacklisted nouveau in /etc/default/grub.
      Finally I installed drivers not by apt-get but directly from http://us.download.nvidia.com/XFree86/Linux-x86_64/331.20/NVIDIA-Linux-x86_64-331.20.run
      Now I could boot Ubuntu with Graphics in Discrete mode having nox2apic flag. Second monitor worked out of the box! :D Thanks for your help!

      Delete
  7. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

Sending out Storm metrics

There are a few posts talking about Storm's metrics mechanism, among which you can find Michael Noll's postJason Trost's post and the storm-metrics-statsd github project, and last but not least (or is it?)  Storm's documentation.

While all of the above provide a decent amount of information, and one is definitely encouraged to read them all before proceeding, it feels like in order to get the full picture one needs to combine them all, and even then a few bits and pieces are left missing. It is these missing bits I'll be rambling about in this post.

Dependency Injection - The good, the bad and the ugly

The Good
Dependency injection (DI, a.k.a IoC - inversion of control) is a well known technique to increase software modularity by reducing coupling between modules. To provide the benefits of DI, numerous DI frameworks have arisen (Spring, Guice, Castle Windsor, etc.) all of which essentially give you "DI capabilities" right out of the box (these frameworks tend to provide a whole lot more than just "DI capabilities", but that's not really relevant to the point I'm about to make). Now, to remove the quotes around "DI capabilities", let's define it as a DI container - a sack of objects you can manipulate using a provided API in order to wire these objects together into an object graph that makes up your application.

I've worked on quite a few projects employing Spring, so it will be my framework of reference throughout the rest of the post, but the principles and morals apply just the same.