Saturday, January 15, 2011

Debian - Bad Module, Apt, Rescue Mode

v0.2
I spent a rather frustrating hour today fixing a self-inflicted non-X-booting Debian system.  On the good side, I learnt some more and gained an appreciation for being able to use the command line.

In a flash of irresponsibility, I thought I'd install the nvidia 3d module the Debian Way - without doing the research but just using a "she'll be right" approach.  The module compiled and installed.  I rebooted.  When X started, all I got was a blank screen with a flashing underline cursor at the top left.

Bother!

Ctl-Alt-Backspace would not kill X
Ctl-Alt-Del gave me a reboot.


Rescue Mode

When you boot a Debian system, at the Grub screen, each Kernel choice has two entries - the normal boot entry, and under that a "Rescue Mode" kernel choice which allows you to boot (eventually) to a root prompt.  The boot process finishes with an invitation for you to enter the root password, or to press Ctl-D.  Entering the root password drops you to a root prompt # .


Modules

Drivers are called "modules" in Linux and are loaded for the Kernel to get access to them.  Once I was in the root prompt above, I checked to see if the nvidia module was indeed causing the trouble.

# lsmod

The list streamed up above the page, so pipe the output of lsmod to a pager, like "more"

# lsmod | more

Better - and there was the nvidia driver in the list.  now to remove the module

# rmmod nvidia

Check the module list, and it is not there.  So reboot.  The system was as before, so the module commands only do a temporary job.

To cut a long story short, I did the brute force approach.  I found the module in
" /lib/modules/ (kernel-name) /nvidia/nvidia.ko"
and renamed it to nvidia.ko.bak.  When I rebooted, the system worked as before.


Xorg

In the past, when I've been confronted with something like this, I've simply edited the xorg.conf file to change the video driver back to the default "vesa" or "nv".  When I looked at doing this, there WAS no xorg.conf any more.  I'd heard a little about this, but not paid too much attention.  Another project - update my knowledge of Xorg.


Apt / Aptitude

Now the bit that would have saved me a lot of trouble.  Debian has a wonderful package management system.  I have only been really worried about using the graphical tool "synaptic", because it is easy to pick up the basics with.

However in the case I was faced with, there was no graphical interface and I hadn't learnt very much of Aptitude either.  It would have been easy to just search for the nvidia packages and then remove them.  Two minutes work.

So the lesson is - learn the command line and learn the command line Apt tools.  They will save you an awful lot of frustration and time.


Later .....

No comments:

Post a Comment