• Window10和Ubuntu 18.04双系统安装的引导问题解决


      作为码农

      首先,建议了解下grub2的启动顺序和逻辑。可以参考这篇文章,grub.cfg详解

      从执行顺序倒推,如下如果全部执行成功,则会进入grub的启动菜单;如果最后一步,没有找到grub.cfg或者执行grub.cfg出错,则进入grub普通模式;如果倒数第二步,家在normal.mod模块失败,则进入grub secure模式。

    GRUB2在BIOS平台上的常规启动步骤是这样的:BIOS --> boot.img[MBR] --> core.img[MBR gap/embedding area/BIOS Boot Partition] --> 设置"prefix root cmdpath"环境变量 --> 加载"normal.mod"模块[同时还包括它所依赖的 terminal crypto extcmd boot gettext 模块] --> 执行"normal $prefix/grub.cfg"命令
    
    GRUB2在UEFI平台上的常规启动步骤是这样的:UEFI --> core.img[BOOTX64.EFI/BOOTX86.EFI] --> 设置"prefix root cmdpath"环境变量 --> 加载"normal.mod"模块[同时还包括它所依赖的 terminal crypto extcmd boot gettext 模块] --> 执行"normal $prefix/grub.cfg"命令

      

      这里我们分别介绍两种模式下的解决方式:

    • Grub普通模式
      • 手动引导进入系统
        • ls 可以看到形如 (hd0, gpt2)之类的硬盘分区, ls (hd0,gpt2)/root/之类的可以看到文件系统结构;
        • 找到要启动的系统路径,主要是grub目录、vmlinux、initrd,如下图
          •   
            # ll /boot/
            总用量 135336
            drwxr-xr-x  4 root root     4096 7月  10 22:22 ./
            drwxr-xr-x 24 root root     4096 7月  10 22:20 ../
            -rw-r--r--  1 root root  1536934 4月  24 12:56 abi-4.15.0-20-generic
            -rw-r--r--  1 root root  1537050 5月  24 00:54 abi-4.15.0-23-generic
            -rw-r--r--  1 root root   216807 4月  24 12:56 config-4.15.0-20-generic
            -rw-r--r--  1 root root   216807 5月  24 00:54 config-4.15.0-23-generic
            drwxr-xr-x  3 root root     4096 1月   1  1970 efi/
            drwxr-xr-x  5 root root     4096 8月   5 07:38 grub/
            -rw-r--r--  1 root root 55988734 7月  10 22:20 initrd.img-4.15.0-20-generic
            -rw-r--r--  1 root root 53910349 7月  10 22:22 initrd.img-4.15.0-23-generic
            -rw-r--r--  1 root root   182704 1月  28  2016 memtest86+.bin
            -rw-r--r--  1 root root   184380 1月  28  2016 memtest86+.elf
            -rw-r--r--  1 root root   184840 1月  28  2016 memtest86+_multiboot.bin
            -rw-r--r--  1 root root        0 4月  24 12:56 retpoline-4.15.0-20-generic
            -rw-r--r--  1 root root        0 5月  24 00:54 retpoline-4.15.0-23-generic
            -rw-------  1 root root  4038188 4月  24 12:56 System.map-4.15.0-20-generic
            -rw-------  1 root root  4039393 5月  24 00:54 System.map-4.15.0-23-generic
            -rw-r--r--  1 root root  8249080 4月  27 10:40 vmlinuz-4.15.0-20-generic
            -rw-------  1 root root  8257272 5月  24 01:49 vmlinuz-4.15.0-23-generic
        • 设置grub boot环境,其中root的地址为要启动的linux系统(如Ubuntu)所在的硬盘分区节点名。hd0对应sda,hd1对应sdb,以此类推。。。(hd0,gpt1)对应sda1,(hd1, gpt2)对应sdb2以此类推。。。
          • grub> set boot=(hd0,gpt2)
            grub> linux /boot/vmlinuz-4.15.0-23-generic root=/dev/sda2
            grub> initrd /boot/initrd.img-4.15.0-23-generic
            grub> boot
      • 修复引导
        • 一般为了避免进入系统后,下次再进入还要输入以上命令,可以用如下方法
          • # sudo update-grub
            # sudo grub-install /dev/sda
        • 然而我发现,这个方式在我的case里不生效,尝试找下根本原因    
    • Grub Secure模式
      • 手动引导进入系统, LInk
      • 修复引导
  • 相关阅读:
    Java使用google开源工具Thumbnailator实现图片压缩
    nginx基本配置
    CopyPropertis
    微服务(Microservices )简介
    jQuery ajax()使用serialize()提交form数据
    $.getJSON( )的使用方法简介
    理解 CSS 的 z-index 属性
    JS中的call()和apply()方法
    CSS文字换行详细解说
    如何实现JS函数的重载
  • 原文地址:https://www.cnblogs.com/icxy/p/9420885.html
Copyright © 2020-2023  润新知