How to fix Ubuntu after deleting the current kernel by mistake

Source: Internet
Author: User
Yesterday, I tried to delete unnecessary old kernel after Ubuntu kernel upgrade, but I accidentally deleted it together with the currently used kernel. Now the system has no kernel, and the updated grub boot list does not have Ubuntu. The problem seems serious. In this case, the best solution is to immediately install a new kernel without shutting down the system. But at that moment I suddenly thought that I would shut down to see what would happen. So shut down and restart, and then found that there is no way to enter Ubuntu. Completely silly. I found that some people on the internet encountered the same problems as me, and some people directly

Yesterday, I tried to delete unnecessary old kernel after Ubuntu kernel upgrade, but I accidentally deleted it together with the currently used kernel. Now the system has no kernel, and the updated grub boot list does not have Ubuntu. The problem seems serious. In this case, the best solution is to immediately install a new kernel without shutting down the system. But at that moment I suddenly thought that I would shut down to see what would happen. So shut down and restart, and then found that there is no way to enter Ubuntu. Completely silly.

I found that some people encountered the same problems on the Internet, and some directly reinstalled the system calmly. In fact, there are still moderate solutions.

First, enter liveCD and copy the vmlinuz and initrd files in the installation media to the original system. I used kubuntu 11.10, which was originally installed on a USB flash drive. The required file is in the casper folder where the USB flash drive is installed. Its names are vmlinuz and initrd. lz. I copied two files to the/boot of the original system.

Then restart and enter the grub command line. Run the following command to guide the system

Set root = (hd0, msdos9)

Linux/vmlinuz root = UUID = xxx ro locale = zh_CN quiet splash

Initrd/initrd. lz

Boot

(Hd0, msdos9) is the partition mounted to/boot. The serial number varies from person to person. The uuid of the/partition indicated by xxx. You can run ls-l to view all the partitions and their corresponding uuid.

Now you can access the system normally. Then install the new kernel and replace the copied copy. Because the kernel version copied from the installation package is low, some drivers are missing (my audio/video driver is faulty), and the upgrade may fail in the future. There are two ways to install the kernel: one is to install the kernel directly from the source

Apt-get install linux-headers-x.x.x-xx # x represents the version number

Apt-get install linux-image

Download the kernel's deb package from the official website for installation. However, after I use this method for installation, it cannot be started normally. It may be because the downloaded version is incorrect. The specific cause is unknown.

After the new kernel is installed, the system is restored to its original state.

Finally, I spoke about it. I heard that the kernel currently used by the system cannot be deleted, and the system reports an error when deleting the kernel. Now we find that the system will indeed issue a warning, but the kernel file will not be deleted after the warning. This warning is meaningless.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.