Pro*_*kup 40 grub2 uefi boot-repair system-installation 14.04
我有带 UEFI 设置实用程序的 Intel 64 位硬件。Ubuntu 14.04.1 LTS 安装为唯一连接的驱动器上的唯一操作系统。Ubuntu 意外安装在 BIOS/CSM/legacy 模式下。
在稍后学习 UEFI 时,目标是将这个现有的 Ubuntu 安装更改为(更快)通过 EFI/UEFI 启动。我仍然希望有某种 - 显示 2 秒 - 引导菜单,允许我进入 UEFI 设置实用程序。因此,我认为我确实需要使用 Grub(不能使用 EFI 引导存根)并且GOP 支持需要 Grub 版本 1.99 或更高版本。我已经使用 Live CD 对驱动器进行了重新分区,并在驱动器的开头插入了一个 200 MiB 的 EFI 分区,并将该 fat16 格式的分区标记为类型 id 0xEF。
前:
# fdisk -l /dev/sda
...
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 108478463 54238208 83 Linux
/dev/sda2 108480510 125044735 8282113 5 Extended
/dev/sda5 108480512 125044735 8282112 82 Linux swap / Solaris
Run Code Online (Sandbox Code Playgroud)
后:
Device Boot Start End Blocks Id System
/dev/sda1 * 411648 108478463 54033408 83 Linux
/dev/sda2 108480510 125044735 8282113 5 Extended
/dev/sda3 2048 411647 204800 ef EFI (FAT-12/16/32)
/dev/sda5 108480512 125044735 8282112 82 Linux swap / Solaris
Partition table entries are not in disk order
Run Code Online (Sandbox Code Playgroud)
Ubuntu 社区 wiki 建议使用 boot-repair 来将 Ubuntu 转换为 EFI 模式。我不想使用 GUI,也不想安装任何额外的软件包,也不想将任何数据意外发送到 pastebin.com,因为我确实想知道将要更改的内容,我不想使用引导修复。
试图弄清楚引导修复实际上做了什么,我发现了这个片段:
如果 gpt 分区,引导修复将通过卸载 grub-pc 和安装 grub-efi 将 BIOS 安装转换为 UEFI。
来源:http : //ubuntuforums.org/showthread.php?t=2147295&p=12657352#post12657352
UEFI 模式下干净的 Ubuntu 14.04.1 安装会创建一个 512 MiB Fat32 格式的 EFI 分区。该分区包含一个目录/EFI/ubuntu,包含4个文件:grub.cfg,grubx64.efi,MokManager.efi和shimx64.efi。grub.cfg 包含:
search.fs_uuid 7d843e47-3917-4114-8725-55dfa1fbe002 root hd0,gpt2
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
Run Code Online (Sandbox Code Playgroud)
search.fs_uuid 指向Linux安装分区的UUID,本次对比UEFI安装Linux是安装分区/dev/sda2 (对比BIOS模式安装sda1)。
在固件中仍然禁用 CSM 并使用干净的 UEFI 模式 Ubuntu 安装。使用 Live CD 将 512 MiB EFI 分区的大小调整为 200 MiB,并gparted导致其格式从 FAT32 更改为 FAT16。华擎固件 P1.50 (AMI 在启动消息“BIOS 日期”中错误地调用 BIOS)仍然能够启动到 UEFI 模式 Ubuntu: UEFI + FAT16 = ok。使用相同的 Live CD 终端命令及其命令
将分区表从 GPT 转换为 MBR (msdos)也会在 MBR 分区驱动器上生成 UEFI 可引导的 Ubuntu:UEFI + MBR = ok。gdiskr g p w
这是否意味着我需要执行的唯一命令 - 从旧版 Ubuntu 安装开始 - 是:
# apt-get install grub-efi
# apt-get remove grub-pc
Run Code Online (Sandbox Code Playgroud)
? 还是需要做更多的工作?
Pro*_*kup 41
在 UEFI 模式下启动 Ubuntu Linux (14.04) Live CD。如果是 USB 启动设备,请在 UEFI 中禁用“快速启动”。
打开一个终端窗口(Ctrl+ Alt+ T)
要验证您实际上是在 UEFI 模式下运行,请使用以下 bash 命令:
$ [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
Run Code Online (Sandbox Code Playgroud)
结果输出应该是:
UEFI
Run Code Online (Sandbox Code Playgroud)
如果它说BIOS,请重新启动到您的固件并更正启动设备首选项。
要进行 BIOS 到 EFI/UEFI 的转换,请输入以下命令:
$ sudo mount /dev/sda1 /mnt
$ sudo mkdir -p /mnt/boot/efi
$ sudo mount /dev/sda3 /mnt/boot/efi
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo mount --bind /run /mnt/run
$ modprobe efivars
$ sudo chroot /mnt
# apt-get install grub-efi-amd64
Run Code Online (Sandbox Code Playgroud)
# rm /etc/resolv.conf
# ln -s ../run/systemd/resolve/stub-resolv.conf resolv.conf
# apt-get install grub-efi-amd64
Run Code Online (Sandbox Code Playgroud)
The following extra packages will be installed:
efibootmgr grub-efi-amd64-bin
The following packages will be removed:
grub-gfxpayload-lists grub-pc
...
After this operation, 2,399 kB of additional disk space will be used.
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck --no-floppy --debug
Run Code Online (Sandbox Code Playgroud)
尽管以错误消息结尾:
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
Run Code Online (Sandbox Code Playgroud)
下次重新启动时,固件的启动选项菜单中已经显示“ ubuntu ”,并像以前一样启动到控制台,除了现在以 efi 模式启动:
$ dmesg | grep EFI
efi: EFI v2.31 by American Megatrends
fb0: EFI VGA frame buffer device
EFI Variables Facility v0.08 2004-May-17
fb: switching to inteldrmfb from EFI VGA
Run Code Online (Sandbox Code Playgroud)
如果出现问题,https://superuser.com/questions/376470/how-to-reinstall-grub2-efi可能会有所帮助。
| 归档时间: |
|
| 查看次数: |
59720 次 |
| 最近记录: |