Friday, November 8, 2019

How to restore a system after accidentally removing all kernels?




I was trying to delete old kernels, but I must have deleted all of the kernels on my Ubuntu 11.04 laptop. Is there any way to fix this via USB boot or mounting hard drive on another system?



Boot into a live CD (or live USB), mount some systems, chroot into it and install the kernel. After a successful installation of the kernel, unmount the filesystems.




  1. Open Terminal

  2. Mount the Ubuntu partition: sudo mount /dev/sdXY /mnt

  3. Mount some special partitions:




    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys

  4. (optional) When you are connected to a network, use the DNS servers from your Live environment (otherwise host names can possibly not be resolved):



    cp /etc/resolv.conf /mnt/etc/resolv.conf

  5. Chroot into the /mnt: sudo chroot /mnt

  6. Install the Linux kernel: apt-get install linux-image-generic (no sudo required as you are root after a chroot)


  7. After a successful installation of the kernel, get out the chroot and unmount some filesystems:



    exit
    sudo umount /mnt/sys
    sudo umount /mnt/proc
    sudo umount /mnt/dev
    sudo umount /mnt

  8. Reboot and remove CD or USB: sudo reboot



No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...