Recovering your system after a dodgy package upgrade (PClinuxOS flavoured) - [Readme]
Okay, so you decided to upgrade or install some package (LinCity) using Synaptic, and some other package caught your eye (HAL daemon). Good stuff, you think, that looks like it is way behind, so let's upgrade it aswell. Cool.
So you select the packages, download and install them. All good. You then shutdown for the night and the next day you switch your PC back on, to discover, OMG some issue about HAL module not loading owing to an incompatible install (kernel etc.) and as a result, something is seriously broken (eg. your keyboard and mouse do not work, if it was hal... or your system is flaky because /proc won't mount, whatever!). So no fixing it on the fly, as you can't type (!) things without major errors.
1. Reboot using another distro, like your PClinuxOS CD, or Knoppix DVD.
2. Mount your root drive as say, "/mnt/root",
3. and then run the magical command "chroot /mnt/root"
4. This will give you a "virtual" root system within your buggered distro, with a working keyboard thanks to your live distro.
5. The chroot command without any extra options will automatically try to run your default SHELL, in my case /bin/bash... or /bin/sh failing that.
6. Now, you have a shell, and you have root... but you cannot start running commands just yet.
7. First, check out your /etc/fstab using less or more or whatever. "less /etc/fstab"
8. See the lines...
9. You need some of these if things are going to work.
none /proc proc defaults 0 0
none /dev/pts devpts mode=0620 0 0
none /proc/bus/usb usbfs defaults 0 0
/dev/sdb7 swap swap defaults 0 0
none /dev/shm tmpfs defaults 0 0
10. So, type "mount /dev/sdb7" to get swap drive, "mount /proc" to get your kernel paramters in their virtual filesystem, "mount /dev/pts" for pseudo-terminal master and slave instances, "mount /dev/shm" to get your shared memory going - not really required, but what the hell, and lastly "mount /proc/bus/usb" to get your usb devices.
11. Now the master stroke... Synaptic installed , for example, hal, which buggered up your install, because the kernel wasn't upgraded at the same time. Trying to uninstall hal will not work owing to convoluted dependencies, and since you are now using apt-get at the command line, you cannot ignore errors.
12. So run a "apt-get update".
13. Then run "apt-get dist-upgrade".
14. This is a BFG approach, I know, but I'm working on the case where you wanted to upgrade some things anyway. After everything has downloaded and installed, you'll likely have a new kernel to contend with. Edit your grub conf (or lilo) if you want, or else just reboot and select the new kernel.
May the Force be with you. BTW, yes I really did bugger my hal up, and as a result my mouse and keyboard were dead. LOL
[Comments, errors and other suggestions?]