viernes, 6 de marzo de 2009

Oops! Removed all kernels!

Hi!

My last post on this blog was about how to switch from intrepid to jaunty without having much room on hard drive. One accident I had while doing this was that I removed all my linux kernels and so I ended up with a box that could do mem tests all day long or boot into windows (god forbid). So, here's how I got it back. I did it on kubuntu jaunty, but it could work almost the same if you tried on debian or any other distribution that has a package manager (or even without it, though the steps will change, of course).

First thing, I booted the box with a Kubuntu LiveCD. After having booted, I mounted the root partition of my busted GNU/Linux:

$ sudo su
# mkdir /mnt/tmp
# mount /dev/sda5 /mnt/tmp

After having mounted, let's get into a chroot cage so I can manage packages from that mounted partition as if it were root:

# chroot /mnt/tmp

Well... it's basically like being on a terminal on the GNU/Linux that has no kernel. I'm at the root of that box, I have a working internet link..... so, let's just install the missing kernel package:

# apt-get update

# apt-get install linux-image-generic

We let it do its stuff and reboot and tadaaaaaaaaaaaaaaaa, we're back on track. See? It wasn't that difficult, was it?

PS If you have separate boot partitions or perhaps a separate /usr, perhaps you'll have to do more mounting before you do the chroot, but the concept remains the same.

PS2 One reader left a comment where he said that he hated the terminal and wanted a GUI based application to get it done. I was going to post a picture of such an application: konsole. :-D I don't know if such application really exists. I think the situation I described is 1 fairly uncommon, 2 rather easy to fix (if you know where to look). But if you feel really lost, then email me. I'm always available to help. As a matter of fact, back in december I got a box of 9 bottles of italian wine for helping an italian guy recover some data from a broken RAID5 (I wish all people thanked that way... thanks, Marco!).

2 comentarios:

  1. Este comentario ha sido eliminado por el autor.

    ResponderEliminar
  2. but...is not a good thing to remove the kernel!!! :))
    so...I tryed this...it is a very good recovery for kernel :)) my compliments :)

    ResponderEliminar