Saturday, October 8, 2011

Ubuntu 11.04 Freeze On Startup using Current Nvidia Drivers

Yesterday coming home from a night of dining and board games I decided to update my Nvidia drivers. The reason I wanted to do this was because I just bought the Humble Frozen Synapse bundle and it was running slow on my machine, I thought that updating the Drivers would give me some sweet Hardware acceleration and kung fu graphics.

But instead of Gaming Heaven I entered Linux Hell.

After selecting "NVIDIA accelerated graphics driver (version current) Recommended" and rebooting I couldn't use my computer any more. Ubuntu and Unity would start. I was able to move the mouse but rest of the desktop was frozen. It was like it had frozen in mid launching.

I figured that changing back to the old driver would fix it. Likely by entering some kind of Graphics Safe Mode. But how to do this without a GUI was a not obvious to me.

This is the long version of how I fixed it. I have included some, but not all, of my trial and error. I am writing this both for my sake, otherwise I am likely to forget how it was fixed, and for your sake, hoping to help someone with similar problems.

Part 1: Grub
Since I only have one OS on my computer Grub was configured to not show a menu on start up. So first I needed to figure out how to enter Grub on boot. Holding down SHIFT like it said in the documentation didn't work so I after I while I figured out that if I pressed "Ctrl+Alt+Del" and held for a few seconds it would reboot and Grub menu would show up. Doing this all the time was annoying so I decided to enable Grub on boot.

Step by Step instructions:
* Reboot and hold "Ctrl+Alt+Del" to enter Grub.
* Select Recovery mode of latest kernel
* Select "Drop To Root Shell Prompt"
(Root shell did not ask for password which was kind of scary)
* Edit file /etc/default/grub

I changed "GRUB_HIDDEN_TIMEOUT=0" to "GRUB_HIDDEN_TIMEOUT="
This, according to Grub Documentation, means
- The menu will be displayed for the number of seconds designated by GRUB_TIMEOUT.

I changed "GRUB_HIDDEN_TIMEOUT_QUIET=true" to "GRUB_HIDDEN_TIMEOUT_QUIET=false"
This, according to Grub Documentation, means
- A counter will display on a blank screen for the duration of the GRUB_HIDDEN_TIMEOUT value.

* Restarting Computer
Now Grub menu is shown by default. Yay!

Part 2: Disable auto-login
Since I'm the only user on the system Ubuntu has been set up to Auto-Login with my User. I needed to turn this off since I figured I could select Safe Mode from login screen. I couldn't enter the system since it freezes so I needed to do this from the command prompt.

Step by Step instructions:
* Reboot to enter Grub.
* Select Recovery mode of latest kernel
* Select "Drop To Root Shell Prompt"
* Edit file /etc/gdm/custom.conf

I changed "AutomaticLoginEnable=false" to "AutomaticLoginEnable=true"

* Restart Computer, select latest Linux in Grub
Now I have a login screen instead of a Unity that hangs. Yay!

Part 3: Login Safe Mode
When login screen appears I stopped the timed login and selected my user.
At the bottom of the screen there is bar where you can choose window manager.
I selected "Ubuntu Classic" which means Gnome, and enter Ubuntu.
Won't Start! Same as in Unity, freezes Desktop but I can move the mouse. Damn!

* Restart and try again
This time I select "Ubuntu Safe Mode" and enter Ubuntu.
It starts and I can use my computer again!
I'm so close to victory that I can taste it.

Part 4: Disable nvidia-current
* From Gnome menu I select "System" -> "Administration" -> "Additional Drivers" and try to enable the old Nvidia drivers but is informed that I do not have permissions to do such a thing.
* Using "System" -> "Preferences" -> "Main Menu" I find out the command to start "Additional Drivers" which is "/usr/bin/jockey-gtk".
* Start terminal and enter "sudo /usr/bin/jockey-gtk"
* Dialogue opens and I can enable the old Nvidia drivers.
* Restart Computer and Select "Ubuntu" on login screen.
Now Unity starts without freezing!

After a few hours of fighting with Linux I am finally back to where I started.
Frozen Synapse still has bad FPS and lagging but I so much better than a Computer that freezes.

Have a great weekend!