GRUB
GRUB is a multi-boot bootloader that is installed by default on most Linux distributions. Here's a quick breakdown on getting it working with Arch Linux.
Install the package
pacman -S grub
If you're on UEFI, install efibootmgr
as well.
pacman -S efibootmgr
Install the bootloader
UEFI
Create a partition in the first 2TB of your drive. This partition must be FAT and at least 100MB. The partition table of the disk must be GPT and the partition should be set as an EFI System Partition. Mount this partition under /boot/efi/. Install the bootloader to this EFI partition by executing the following command:
grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --bootloader-id=Arch
UEFI RAID
If using an mdadm RAID1 setup, GRUB will fail to install correctly on both drives unless you specify the removable flag. You'll lose the bootloader label but be able to move the array between machines.
grub-install --target=x86_64-efi --efi-directory=/boot/efi/ --removable
BIOS
Create a partition for /boot/ in the first 2TB of your disk (ext4 is fine). Set this partition to Active
so it will be used for booting.
Install GRUB to the disk by executing the following command, replacing /dev/sdX with your disk's location:
grub-install --target=i386-pc /dev/sdX
Microcode
With vulnerabilities like Spectre and Meltdown lingering, one should strive to stay up-to-date on their loaded microcode. Arch Linux provides the latest packages from both AMD and Intel, and GRUB will automatically load the required microcode before the Linux kernel.
AMD ucode
To install the latest AMD microcode, run the following:
pacman -S amd-ucode
Intel ucode
To install the latest Intel microcode, run the following:
pacman -S intel-ucode
Generate the config file
After the bootloader has been installed we need to generate the main configuration file /boot/grub/grub.cfg
.
grub-mkconfig -o /boot/grub/grub.cfg
This will need to be performed each time you manually switch kernels (not automatic updates - this is auto-performed). If you uninstall the previously configured kernel without generating a new config file you risk having a non-booting machine. To recover from this state, boot into an Arch Live installer and mount your disks like you did during Installing Arch, then run the above command in your arch-chroot
. This should generate a working configuration you can then reboot into.
Troubleshooting
Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds
If grub-mkconfig hangs and gives error: WARNING: Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds
You may need to provide /run/lvm/
access to the chroot environment using:
mkdir /mnt/hostlvm mount --bind /run/lvm /mnt/hostlvm arch-chroot /mnt ln -s /hostlvm /run/lvm
See FS#61040 and workaround.