HowTo: Uninstall software that makes Ubuntu’s boot process fail
Whilst rebuilding a friend’s Medion laptop, in my attempt to get the Wireless LAN adapter working, I set about trying to use ndiswrapper and the Windows drivers. Unfortunately upon rebooting, the system failed to boot, always locking up when the boot process tried to load the Windows driver. It was so bad that I wasn’t even able to boot to a recovery prompt because it still attempts to load the hardware drivers before dropping you into a root shell.
The solution was simple – get rid of ndiswrapper and that will prevent the offending Windows driver loading which I can then delete afterwards, but how do you do this when you can’t even boot to a terminal?
With the assistance of an Ubuntu LiveCD (on USB stick in this case), I was able to remove ndiswrapper without needing to do a complete re-install of the system. Here’s how to do it.
- Shutdown your system, insert your Ubuntu LiveCD and turn on your system.
- Allow the system to boot to the LiveCD desktop and then open a terminal.
- Determine what your system’s root partition is called by getting a list of available drives and partitions with:
$ sudo fdisk -l
- In my case, this Medion lappy had Windows installed and a couple of other partitions too. The root Linux partition ultimately resided on sda8, so I need to mount this somewhere. First I need a mountpoint:
$ mkdir /dev/shm/medion
…this creates a directory in the RAM disk called “medion” (but you can call it whatever you want). - Now mount the partition to the mountpoint with:
$ sudo mount /dev/sda8 /dev/shm/medion
- Check that we can access the mounted drive with:
$ ls -l /dev/shm/medion
- If it contains the root filesystem of your lappy’s Ubuntu install, then you’ve done well so far. Now we need to change the system’s root filesystem from the LiveCD over to the hard-drive’s root filesystem so we can work on it. Type in:
$ sudo chroot /dev/shm/medion
- This will temporarily make the current session’s root filesystem the one that is on your hard-drive, as though we’d actually booted from it. From here, it’s now a simple case of removing the ndiswrapper application that was causing all my problems (notice that we are at a root prompt designated by the hash symbol):
# apt-get remove ndiswrapper-common
- A few warning messages popped up advising that it couldn’t find the log to write to, but that’s OK – the software still gets removed, and thus will prevent the Windows driver from killing the boot process. Once Apt had finished doing its thing, just type in:
# exit
…and the root filesystem will revert back to the LiveCD’s root filesystem. - Shutdown and reboot as normal without the LiveCD, and viola – the system boots without hanging this time!
As you can see, the ability to change root filesystem can be very useful in trouble-shooting a non-booting installation but also has other uses too, one of the most common being creating custom LiveCD’s by modifying the squashfs filesystem on the LiveCD and burning to a new disc – thus allowing you to add or remove components from the default Ubuntu LiveCD environment.
Leave a Reply