Ubuntu16.04 Modifying kernel Boot

Source: Internet
Author: User
Tags uuid

This article is written in order to provide a reference for those who meet the same problems, and secondly, for their own convenience to summarize and consult. I hope the great God does not spray.

Well, no more nonsense, turn to the point.

A few days ago to their own computer installed a ubuntu16.04lts, their own handy on the inside of the software what upgrade a bit. Do not know how to upgrade the kernel to 4.8.0-26-generic, and then the computer on the USB old trouble (in the boot before the flash drive can read out the USB stick, after the plug on it did not respond, but the USB can have electricity). The headset is not available, and the speaker has no sound. I do not know how to go about all kinds of Baidu, Google. Many people on the internet said that the kernel and hardware is incompatible, generally the graphics card driver uninstalled the good. I tried for a moment without success. Later notice the boot time prompt failed to start Load Kernel Modules. Then you go to the kernel direction.

See also has the Netizen encounters the similar question, and proposed the solution method (http://askubuntu.com/questions/809199/failed-to-start-load-kernel-modules-ubuntu-16-04). However, my question was not resolved. Then think about modifying the boot configuration file and changing the kernel that the system loads by default.

grep menuentry/boot/grub/grub.cfg

1. This command shows the boot order of the kernel, such as:

[Email protected]:~$ grep menuentry/boot/grub/grub.cfgif [x "${feature_menuentry_id}" = xy]; Thenmenuentry_id_option= "--id"Menuentry_id_option= ""Export menuentry_id_optionmenuentry ' ubuntu '--class ubuntu--class gnu-linux--class GNU--class os $menuentry _id_option ' Gnulinux-simple-5bce3795-da96-4c6f-bed2-67d37185a77d '{submenu ' Ubuntu advanced options ' $menuentry _id_option ' gnulinux-advanced-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' ubuntu,linux 4.8.0-26-lowlatency '--class Ubuntu--class gnu-linux--class GNU--class os $menuentry _id_optio N ' gnulinux-4.4.0-45-lowlatency-advanced-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' Ubuntu, with Linux 4.8.0-26-lowlatency (upstart) '--class Ubuntu--class gnu-linux--class GNU--class os $me Nuentry_id_option ' gnulinux-4.4.0-45-lowlatency-init-upstart-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' Ubuntu, with Linux 4.8.0-26-lowlatency (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--class Os $menuentry _id_option ' gnulinux-4.4.0-45-lowlatency-recovery-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' ubuntu,linux 4.8.0-26-generic '--class Ubuntu--class gnu-linux--class GNU--class os $menuentry _id_option ' Gnulinux-4.4.0-45-generic-advanced-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' Ubuntu, with Linux 4.8.0-26-generic (upstart) '--class Ubuntu--class gnu-linux--class GNU--class os $menue Ntry_id_option ' gnulinux-4.4.0-45-generic-init-upstart-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' Ubuntu, with Linux 4.8.0-26-generic (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--class os $menuentry _id_option ' gnulinux-4.4.0-45-generic-recovery-5bce3795-da96-4c6f-bed2-67d37185a77d '{menuentry ' ubuntu,linux 4.4.0-21-generic '--class Ubuntu--class gnu-linux--class GNU--class os $menuentry _id_opt Ion ' gnulinux-4.4.0-21-generic-advanced-5bce3795-da96-4c6f-bed2-67d37185a77d ' {menuentry ' Ubuntu, with Linux 4.4.0-21-generic (upstart) '--class ubuntu--class gnu-linux--class GNU--class os $menuentry _id_option ' gnulinux-4.4.0- 21-generic-init-upstart-5bce3795-da96-4c6f-bed2-67d37185a77d ' {menuentry ' Ubuntu, with Linux 4.4.0-21-generic ( Recovery mode) '--class ubuntu--class gnu-linux--class GNU--class os $menuentry _id_option ' gnulinux-4.4.0-21-generic-r Ecovery-5bce3795-da96-4c6f-bed2-67d37185a77d ' {menuentry ' memory test (memtest86+) ' {menuentry ' Memory test ( memtest86+, serial console 115200) ' {    

2. If you want to start with the 4.4.0-21 kernel version,/etc/default/grub the file in the

        

Switch

Grub_default=6

or instead

grub_default= "Ubuntu,linux 4.4.0-21-generic"

After saving

3. Then use the command sudo update-grub

4. After restarting, enter Uname-r to view, the kernel is the desired kernel.

   

However, I did not succeed, no way, can only uninstall the kernel ========= "see the method of cattle (http://www.linuxidc.com/Linux/2016-05/131143.htm), the way to use, and do not repeat.

After I entered the system with the low version kernel in recovery mode, I couldn't check the 4.8.0-26-generic kernel, and I didn't know what the reason was. The command is as follows:

Finally, there is no way to embrace the dead horse as a living horse doctor idea.

5. Remove all 4.8.0-26 related files and folders directly from the/boot/. The command is as follows:

sudo rm-rf *4.8.0-26*

6. Then modified the configuration file:/boot/grub/grub.cfg

sudo cp/etc/boot/grub/grub.cfg/etc/boot/grub/grub.cfg.bak.zgwsudo vim  /etc/boot/grub/grub.cfg

7. Locate the following code block (my Line is 148,149):

Linux    /vmlinuz-4.8.0-26-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro  Quiet Splash $vt _ Handoff    initrd    /initrd.img-4.8.0-26-generic

Change it to the kernel you want to use, my following:

Linux    /vmlinuz-4.4.0-45-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro  Quiet Splash $vt _ Handoff    initrd    /initrd.img-4.5.0-45-generic

8. Then restart the computer on it, if not, please find the following code block (my 151 lines).

9. Delete all 4.8.0-26-related code under this line of code (my 152~263 line) and restart it.

Menuentry ' Ubuntu,linux 4.8.0-26-generic '--class Ubuntu--class gnu-linux--class GNU--class os $menuentry _id_option ' gn Ulinux-4.8.0-26-generic-advanced-5bce3795-da96-4c6f-bed2-67d37185a77d '{recordfail load_video gfxmode $linux _gfx_mode insmodGzio if [x$grub_platform = Xxen]; Then Insmod Xzio; Insmod Lzopio; Fi insmodPart_msdos InsmodExt2 set root= ' hd0,msdos1 ' if [x$feature_platform_search_hint = xy]; ThenSearch--no-floppy--fs-uuid--set=root--hint-bios=hd0,msdos1--hint-efi=hd0,msdos1--hint-baremetal=ahci0,msdos1 88421677-a988-4ff9-bf29-6c56aa4a9027 ElseSearch--no-floppy--fs-uuid--set=root 88421677-a988-4ff9-bf29-6c56aa4a9027 fi echo ' Load Linux 4.8.0-26-generic ... 'Linux/vmlinuz-4.8.0-26-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro quiet Splash $vt _handoff echo ' Load Initialize memory disk ... 'initrd/initrd.img-4.8.0-26-Generic} menuentry ' Ubuntu, with Linux 4.8.0-26-generic (upstart) '--class Ubuntu--class gnu-linux--class GNU--class o s $menuentry _id_option ' gnulinux-4.8.0-26-generic-init-upstart-5bce3795-da96-4c6f-bed2-67d37185a77d '{recordfail load_video gfxmode $linux _gfx_mode insmodGzio if [x$grub_platform = Xxen]; Then Insmod Xzio; Insmod Lzopio; Fi insmodPart_msdos InsmodExt2 set root= ' hd0,msdos1 ' if [x$feature_platform_search_hint = xy]; ThenSearch--no-floppy--fs-uuid--set=root--hint-bios=hd0,msdos1--hint-efi=hd0,msdos1--hint-baremetal=ahci0,msdos1 88421677-a988-4ff9-bf29-6c56aa4a9027 ElseSearch--no-floppy--fs-uuid--set=root 88421677-a988-4ff9-bf29-6c56aa4a9027 fi echo ' Load Linux 4.8.0-26-generic ... 'Linux/vmlinuz-4.8.0-26-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro quiet splash $vt _handoff init=/sbin /Upstart echo ' Load Initialize memory disk ... 'initrd/initrd.img-4.8.0-26-Generic} menuentry ' Ubuntu, with Linux 4.8.0-26-generic (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--c Lass os $menuentry _id_option ' gnulinux-4.8.0-26-generic-recovery-5bce3795-da96-4c6f-bed2-67d37185a77d '{Recordfail Load_video InsmodGzio if [x$grub_platform = Xxen]; Then Insmod Xzio; Insmod Lzopio; Fi insmodPart_msdos InsmodExt2 set root= ' hd0,msdos1 ' if [x$feature_platform_search_hint = xy]; ThenSearch--no-floppy--fs-uuid--set=root--hint-bios=hd0,msdos1--hint-efi=hd0,msdos1--hint-baremetal=ahci0,msdos1 88421677-a988-4ff9-bf29-6c56aa4a9027 ElseSearch--no-floppy--fs-uuid--set=root 88421677-a988-4ff9-bf29-6c56aa4a9027 fi echo ' Load Linux 4.8.0-26-generic ... 'Linux/vmlinuz-4.8.0-26-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro recovery nomodeset echo ' Load Initialize memory disk ... 'initrd/initrd.img-4.8.0-26-Generic} menuentry ' Ubuntu,linux 4.8.0-22-generic '--class Ubuntu--class gnu-linux--class GNU--class os $menuentry _id_ Option ' gnulinux-4.8.0-22-generic-advanced-5bce3795-da96-4c6f-bed2-67d37185a77d '{recordfail load_video gfxmode $linux _gfx_mode insmodGzio if [x$grub_platform = Xxen]; Then Insmod Xzio; Insmod Lzopio; Fi insmodPart_msdos InsmodExt2 set root= ' hd0,msdos1 ' if [x$feature_platform_search_hint = xy]; ThenSearch--no-floppy--fs-uuid--set=root--hint-bios=hd0,msdos1--hint-efi=hd0,msdos1--hint-baremetal=ahci0,msdos1 88421677-a988-4ff9-bf29-6c56aa4a9027 ElseSearch--no-floppy--fs-uuid--set=root 88421677-a988-4ff9-bf29-6c56aa4a9027 fi echo ' Load Linux 4.8.0-22-generic ... 'Linux/vmlinuz-4.8.0-22-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro quiet Splash $vt _handoff echo ' Load Initialize memory disk ... 'initrd/initrd.img-4.8.0-22-Generic} menuentry ' Ubuntu, with Linux 4.8.0-22-generic (upstart) '--class Ubuntu--class gnu-linux--class GNU--class o s $menuentry _id_option ' gnulinux-4.8.0-22-generic-init-upstart-5bce3795-da96-4c6f-bed2-67d37185a77d '{recordfail load_video gfxmode $linux _gfx_mode insmodGzio if [x$grub_platform = Xxen]; Then Insmod Xzio; Insmod Lzopio; Fi insmodPart_msdos InsmodExt2 set root= ' hd0,msdos1 ' if [x$feature_platform_search_hint = xy]; ThenSearch--no-floppy--fs-uuid--set=root--hint-bios=hd0,msdos1--hint-efi=hd0,msdos1--hint-baremetal=ahci0,msdos1 88421677-a988-4ff9-bf29-6c56aa4a9027 ElseSearch--no-floppy--fs-uuid--set=root 88421677-a988-4ff9-bf29-6c56aa4a9027 fi echo ' Load Linux 4.8.0-22-generic ... 'Linux/vmlinuz-4.8.0-22-generic root=uuid=5bce3795-da96-4c6f-bed2-67d37185a77d ro quiet splash $vt _handoff init=/sbin /Upstart echo ' Load Initialize memory disk ... 'initrd/initrd.img-4.8.0-22-Generic} menuentry ' Ubuntu, with Linux 4.8.0-22-generic (recovery mode) '--class Ubuntu--class gnu-linux--class GNU--c Lass os $menuentry _id_option ' gnulinux-4.8.0-22-generic-recovery-5bce3795-da96-4c6f-bed2-67d37185a77d '{recordfail Load_video insmod Gzio if [x$grub_platform = Xxen]; then Insmod Xzio; insmod lzopio; Fi insmod  Part_msdos insmod ext2 set root= ' hd0,msdos1 ' if [x$feature_platform_search_hint = xy]; then search--no-floppy --fs-uuid--set=root--hint-bios=hd0,msdos1--hint-efi=hd0,msdos1--hint-baremetal=ahci0,msdos1 88421677- a988-4ff9-bf29-6c56aa4a9027 Else search--no-floppy--fs-uuid--set=root 88421677-a988-4ff9-bf29-  6c56aa4a9027 fi echo ' Load Linux 4.8.0-22-generic ... ' linux/vmlinuz-4.8.0-22-generic root=uuid= 5bce3795-da96-4c6f-bed2-67d37185a77d ro recovery nomodeset echo ' Load Initialize memory disk ... ' initrd/initrd.img-4.8.0-22- generic}           

10. Summing up, after most of the afternoon toss, finally can be normal use. I feel like I can do the 7th step directly. It's just a personal feeling, and it hasn't been tested in practice. The first time to write a blog, if you have insufficient please correct me. Cited two links, referring to the ideas of many netizens, such as the copyright issues related to the original, please contact, will be the first time to modify.

Ubuntu16.04 Modify Kernel boot

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.