Categories
Computing

Nvidia, Intel and Ubuntu: Fail? [SOLVED (again)]

Installing Ubuntu with an NVidia card would be easy, I thought. I was very very wrong. Still, after many attempts, I believe I finally have an answer.

Share

Let me start by saying that I am a fan of Ubuntu. I think the project is a huge success in making Linux digestable for the masses and taking away the oodles of nonsense that sucked time away just getting a machine up and running. Issues that I had with a built-in graphics chip lead me to buy a new video card. And that's when the headaches started. Luckily, I think I finally solved it…

I recently received an old desktop machine from work. It is an HP Compaq d220mt. A solidly built box with a built-in graphics card from the Intel i845 chipset. I wanted the machine primarily to be used by my 4 year-old son for games online. Again, Ubuntu was simple enough for a 4 year-old to use (more of a success for Xfce!). Still, whenever he would play one of the Flash-based games on PBSkids.org, the machine would suddenly hang. Not a great experience. Upgrading Ubuntu did nothing to improve the situation.

Looking to avoid more time waste I decided to try and get an alternative video card for the machine. NVidia supposedly has decent Linux support so I bought the PNY GeFirce 5200 graphics card that uses the PCI slots available on the machine. Not AGP, not PCIe; old-school PCI. Cool card with dual monitor capability and all and a whopping (for me at least) 256MB. $30 before rebate.

To be sure the machine is ready, I did a clean install of Ubuntu 10.04 using the built-in Intel graphics chip. I then installed the new NVidia card. Restarting the machine after switching to the PCI graphics card in BIOS lead to a crash, and the machine failed to boot. I then switched back to the built-in Intel graphics and the machine booted. I installed the proprietary drivers from NVidia using Ubuntu's special tool. Restarted the machine, switching BIOS back to PCI graphics. Again, a crash on startup. Switched back the BIOS to the built-in chip and Ubuntu intelligently noticed the crash and told me that the X Windows configuration was off. It let me review it, modify it (I added the specific PCI address for the NVidia-based card after checking the boot log), but there was no clear way to save the configuration file. Restarting the machine with the NVidia card (PCI graphics) back on (again switching the BIOS), lead to a crash.

I tried another tack: saw some posts talking about a startup setting through the GRUB boot loader of 'nomodeset' that will force Ubuntu to startup with failsafe graphics. That did not work.

Tried reinstalling Ubuntu 10.04, with or without the 'nomodeset' setting. Crashes early, leaving the Ubuntu startup screen dots flashing. Tried installing Ubuntu 8.04 LTS. Here Ubuntu crashed again before getting me to any of the option screens. Live CD fails as well on either version.

Disappointed, I tried Fedora 13; crashed virtually on startup. Centos 5.5 – crashed virtually on startup. Tried PC-BSD and guess what – it installed SEAMLESSLY. "Excuse me, WHO?" you would ask. PC-BSD, that's who. It detected the NVidia card, installed itself and restarted, asking me to adjust its display settings.

I assume that Ubuntu leaves the proprietary NVidia drivers out, but failing to even get to the initial install screens is truly disheartening. Ubuntu spoiled us with seamless installs that 'just get it done' (sorta like what PC-BSD did). As a result, I expect better from Ubuntu. It could very well be that my configuration is cursed, but PC-BSD got so far as to offer me the option of enabling dual-monitor setup, available on my graphics card.

I am still trying to reinstall Ubuntu, mostly because I really dislike the KDE desktop that is the only option with PC-BSD. If I find an answer, I will post it here. Stay tuned.

SOLUTION

I think I have it working fine now with Ubuntu 8.04 LTS. Amazing!

Refusing to let go of the issue, I decided to try another tack from a post I read somewhere and sadly cannot remember. The idea was to go an adjust the xorg.conf configuration file manually. Anyway, this is what I did:

  1. Reinstalled Ubuntu 8.04 from scratch using the built-in Intel graphics card (turned it on in the BIOS).
  2. Once installed, I booted into it and logged in.
  3. Installed the NVidia graphics drivers: From the top bar – System -> Administration -> Hardware Drivers. Accepted the warnings about proprietary drivers and installed the new driver. Did not reboot yet.
  4. Ran the package manager to install all security and software updates.
  5. Opened a shell window and made a backup copy of the X Windows configuration file, /etc/X11/xorg.conf – for example naming it /etc/X11/xorg.conf.bak-yz. (Please look at the "Avoiding the mess" section below on how to avoid the mess that happened to me)
  6. Rebooted.
  7. Changed the BIOS to use the PCI graphics card instead of the built-in Intel chip.

Now this is where I had a minor pickle.

When restarting, the system managed to boot but instead of starting, the system started a failsafe graphics mode alerting me that the X Windows setup was weird. The configuration still showed (despite the BIOS disabling it) the built-in Intel chip. There was no way to remove it. Ubuntu also thought I was using two monitors with two cards. I tried changing the configuration using the tool but when I told Ubuntu to continue to boot, it failed and got into console mode again. This was actually a good thing. I was able to log into the system from the command line (and you can also use Alt+F1/Alt+F2/Alt+F3 to switch to other consoles (Unix, FTW).

On the command line, I looked at the /etc/X11/xorg.conf that was generated for me (vi /etc/X11/xorg.conf will do it). It indeed reflected the two graphics card – the built-in Intel one (that was now disabled) and the NVidia one. It also assumed two monitors, and well – it was incorrect. Running the dpkg tool, as mentioned in the body of the xorg.conf file to regenrate a new configuration only. resulted in a very bland non-configured xorg.conf file. This is where the backup of xorg.conf file came into play. So how do we finally fix it?

Part of the issue stems from the fact that Linux can still see the original Intel graphics chip on the motherboard when it prods the PCI bus. It sees the NVidia card too but it gets confused. You need to manually tell xorg.conf which PCI device to use for the graphics card you want. To do so, we need to add a BusID parameter to the Device section of the xorg.conf file – telling it which device on the PCI bus to use for graphics. To find the PCI bus ID I ran the following command:

sudo X :1 -scanpci

On my machine I found the NVidia card on the last line:

(3:13:0) unknown card (0x196e/0x01ad) using a nVidia Corporation NV34 [GeForce FX 5200]

The crucial number here is the first one: 3:13:0 is the PCI bus ID for the nVidia card. Note that the id MAY look different on your machine.

The next step is to use backup xorg.conf file, opening it using the command:

sudo vi /etc/X11/xorg.conf.bak-yz

This file had the correct configuration for a single video card, single screen X Windows setup with the NVidia card. I now scrolled down to the device section which looked like this:

Section "Device"
    Identifier    "Configured Video Device"
    Driver        "nvidia"
    Option        "NoLogo"    "True"
EndSection

We now need to add the BusID parameter to this section. In my case, it ended up looking like:

Section "Device"
    Identifier    "Configured Video Device"
    Driver        "nvidia"
    Option        "NoLogo"    "True"
    BusID        "PCI:3:13:0"
EndSection

I now overwrote the xorg.conf file by clicking ESC and entering the vi command

:w! /etc/X11/xorg.conf

Update: There is one more step necessary here. Apparently Ubuntu resurrects the Intel driver. On Ubuntu 8.04 you can add the Intel driver to the machine's module blacklist. To do so, open the file /etc/modprobe.d/blacklist using

sudo vi /etc/modprobe.d/blacklist

and add the line

blacklist intel_agp

to the end of the file. Then save it and exit vi.

On Ubuntu 10.04 things are a bit more complicated.

Finally, I rebooted the machine using

sudo reboot

Amazingly enough, the machine rebooted successfully using the nVidia card!

Quite the hack, isn't it. Hope it is of help to anyone. It was not fun.

Avoiding the Mess

What I would recommend to you to do once Ubuntu generates the new xorg.conf file after installing the proprietary drivers is to open xorg.conf and to add the BusID section to its device section. Again, to do so:

  1. Find the nVidia video card's PCI bus ID

    sudo X :1 -scanpci

    On my machine I found the NVidia card on the last line:

    (3:13:0) unknown card (0x196e/0x01ad) using a nVidia Corporation NV34 [GeForce FX 5200]

    The crucial number here is the first one: 3:13:0 is the PCI bus ID for the nVidia card. Note that the id MAY look different on your machine.

  2. Open xorg.conf
    sudo vi /etc/X11/xorg.conf

  3. Add the BusID line to the device section, so it looks like

    Section "Device"
        Identifier    "Configured Video Device"
        Driver        "nvidia"
        Option        "NoLogo"    "True"
        BusID        "PCI:3:13:0"
    EndSection
    (REMEMBER TO USE THE PCI ID FROM STEP 1)

  4. Save the file.
  5. Blacklist the Intel driver: On Ubuntu 8.04 you can add the Intel driver to the machine's module blacklist. To do so, open the file /etc/modprobe.d/blacklist using

    sudo vi /etc/modprobe.d/blacklist

    and add the line

    blacklist intel_agp

    Now save and exit vi.

  6. Restart.

Hopefully – not promising anything – this will help you avoid the problem I encountered.

Crossing fingers.

Share

2 replies on “Nvidia, Intel and Ubuntu: Fail? [SOLVED (again)]”

Leave a Reply

Your email address will not be published.

 

Share