Archlinux installation, partition, EFI
This is not easy. Mostly followed Installation guide, on a Hyper-V v2 VM. Hyper-V v2 has EFI enabled, so follow corresponding instructions.
Disk partitioning and mounting
Requires two partitions, an EFI partition and a main partition. EFI partiion
is a FAT32 partition. Used parted.
Follow UEFI/GPT example for parted:
(parted) mkpart ESP fat32 1MiB 513MiB
(parted) set 1 boot on
(parted) mkpart primary ext4 513MiB 100%
(parted) quit
See parted tips.
From console:
mkfs.ext4 /dev/sdxY
mkfs.fat -F32 /dev/sdxY
Then mount them:
mount /dev/sdxY /mnt # this is the primary root
mkdir /mnt/boot
mount /dev/sdxY /mnt/boot # this is the EFI partition
Install the base packages
pacstrap /mnt base
Note this must be done after mounting /mnt and /mnt/boot, as it installs
essentials like vmlinux, initramfs, etc. into /mnt/boot.
Boot Loader
This is hard. I tried GRUB with EFI first, it failed on me
1. I then used systemd-boot which worked
eventually.
Note: do all these before chroot to /mnt, otherwise you don't have
the necessary executables.
First install binaries into EFI partition (/mnt/boot folder):
bootctl --path=esp install
Then add an entries to /mnt/boot/loader/entries, and configure
/mnt/boot/loader/loader.conf to point to the new entry.
Add a new entry at /mnt/boot/loader/entries/arch.conf with content:
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw
Replace the PARTUUID with the primary partition's GPT partition UUID. You
can find it with blkid:
# blkid
/dev/sda1: UUID="xxxx-xxxx" TYPE="vfat" PARTUUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxx..."
/dev/sda2: UUID="333db32c-b91e-41da-86c7-801c88059660" TYPE="ext4" PARTUUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxx..."
Note: use PARTUUID, NOT UUID.
parted tips
Run parted with -a optimal so misalignment are warned. But I cannot get
partitions to properly aligned and used "Ignore" when creating partitions 2.
-
at command line use
fdisk -lto see all disks and partitions -
use
h <command>for help -
use
porp allto list partitions and disks -
use
mklabelto make a new partition table for a disk - this destroyes old table. E.g.,mklabel gptto create a GPT partition table.mklabel msdosto create a msdos or (maybe) MBR partition table. -
use
mkpartto make new partition on a disk with partition table.- the start/end supports unit postfix, like
MiB,MB, etc. A negative number counts from the end (-120MiB). Also percentage can be used (100%).
- the start/end supports unit postfix, like
-
use
resizepartto resize a partition
Note After running parted, you'll need to run mkfs.xxx to format the
newly created partitions.
1: grub-install failed with: "error: failed to get canonical path of 'airootfs'"
2: per doc, use percentage notation so it auto-align for you