如何在 Arch Linux(UEFI)上安装 GRUB
前段时间,我写了一篇在安装 Windows 后在 Arch Linux 上如何重新安装 Grub的教程。
几周前,我不得不在我的笔记本上从头开始重新安装 Arch Linux,同时我发现安装 Grub 并不像我想的那么简单。
出于这个原因,由于在新安装 Arch Linux 时在 UEFI bios 中安装 Grub 并不容易,所以我要写这篇教程。
定位 EFI 分区
在 Arch Linux 上安装 Grub 的第一件重要事情是定位 EFI 分区。让我们运行以下命令以找到此分区:
<span class="com">#</span><span class="kwd">fdisk</span><span class="pun">-</span><span class="pln">l</span>
我们需要检查标记为 EFI System 的分区,我这里是 /dev/sda2
。
之后,我们需要在例如 /boot/efi
上挂载这个分区:
<span class="com">#</span><span class="kwd">mkdir</span><span class="pun">/</span><span class="pln">boot</span><span class="pun">/</span><span class="pln">efi</span>
<span class="com">#</span><span class="kwd">mount</span><span class="pun">/</span><span class="pln">dev</span><span class="pun">/</span><span class="pln">sdb2 </span><span class="pun">/</span><span class="pln">boot</span><span class="pun">/</span><span class="pln">efi</span>
另一件重要的事情是将此分区添加到 /etc/fstab
中。
安装 Grub
现在我们可以在我们的系统中安装 Grub:
<span class="com">#</span><span class="pln"> grub</span><span class="pun">-</span><span class="pln">mkconfig </span><span class="pun">-</span><span class="pln">o </span><span class="pun">/</span><span class="pln">boot</span><span class="pun">/</span><span class="pln">grub</span><span class="pun">/</span><span class="pln">grub</span><span class="pun">.</span><span class="pln">cfg</span>
<span class="com">#</span><span class="pln"> grub</span><span class="pun">-</span><span class="pln">install </span><span class="pun">--</span><span class="pln">target</span><span class="pun">=</span><span class="pln">x86_64</span><span class="pun">-</span><span class="pln">efi </span><span class="pun">--</span><span class="pln">efi</span><span class="pun">-</span><span class="pln">directory</span><span class="pun">=</span><span class="str">/boot/</span><span class="pln">efi </span><span class="pun">--</span><span class="pln">bootloader</span><span class="pun">-</span><span class="kwd">id</span><span class="pun">=</span><span class="pln">GRUB</span>
自动将 Windows 添加到 Grub 菜单中
为了自动将 Windows 条目添加到 Grub 菜单,我们需要安装 os-prober:
<span class="com">#</span><span class="pln"> pacman </span><span class="pun">-</span><span class="typ">Sy</span><span class="pln"> os</span><span class="pun">-</span><span class="pln">prober</span>
要添加它,让我们运行以下命令:
<span class="com">#</span><span class="pln"> os</span><span class="pun">-</span><span class="pln">prober</span>
<span class="com">#</span><span class="pln"> grub</span><span class="pun">-</span><span class="pln">mkconfig </span><span class="pun">-</span><span class="pln">o </span><span class="pun">/</span><span class="pln">boot</span><span class="pun">/</span><span class="pln">grub</span><span class="pun">/</span><span class="pln">grub</span><span class="pun">.</span><span class="pln">cfg</span>
<span class="com">#</span><span class="pln"> grub</span><span class="pun">-</span><span class="pln">install </span><span class="pun">--</span><span class="pln">target</span><span class="pun">=</span><span class="pln">x86_64</span><span class="pun">-</span><span class="pln">efi </span><span class="pun">--</span><span class="pln">efi</span><span class="pun">-</span><span class="pln">directory</span><span class="pun">=</span><span class="str">/boot/</span><span class="pln">efi </span><span class="pun">--</span><span class="pln">bootloader</span><span class="pun">-</span><span class="kwd">id</span><span class="pun">=</span><span class="pln">GRUB</span>
你可以在这里找到更多关于在 Arch Linux 上 Grub 的信息。
via: http://fasterland.net/how-to-install-grub-on-arch-linux-uefi.html
作者:Francesco Mondello 选题:lujun9972 译者:geekpi 校对:wxy
相关推荐
kevinli 2019-12-01
yczgh 2020-05-28
zhangpan 2020-02-04
guan000 2020-01-11
英文字体主编 2019-12-06
linuxisperfect 2010-08-15
kvikon 2010-02-15
陈伟堂 2011-02-09
futurezone 2011-01-25
思维的世界 2019-10-30
lucklytd 2010-08-02
Tonywei0 2008-10-14
studylinux 2013-02-25
summerinsist 2012-02-04
cuixingwudi 2011-04-27
昭君出塞 2010-05-27
pointfish 2010-01-07
zhujuyu 2019-06-28
ITlover00 2019-06-28