Installing Arch Linux with Grub on LVM
I spent the better part of a day trying to get Arch Linux installed on a System76 Galago UltraPro laptop. I can honestly say it was a bit of a march slogging through endless websites and the Arch wiki itself before triumphantly conquering the aging hardware issue I was having.
It all stems from discovering this piece of hardware I came upon (how is not important) that allowed me the opportunity to nearly memorize the tedious, yet rewarding, steps of installing Arch Linux. Anyone who has trudged through the laundry list of steps it takes to install Arch more than say… twice, I am sure can understand the frustrations it can pose. Not to mention the hair pulling, the exhaustion, the urge to break numerous inanimate objects, and so on.
I first started out installing Arch by using bootctl as the boot loader fully expecting no problem at all. I soon realized on my first reboot there was definitely a problem. So, take two. Figuring I had missed some important configuration for the boot loading I went and tried again from scratch. Of course, I did review my setup first, I am not a dummy just launching myself into the abyss of installing Arch without double checking.
After no fewer than 4 times of pounding my proverbial “melon” off the ol’ keyboard I realized that I was not making the mistakes I thought I might be and I started investigating believing it to be more of a hardware issue. Hardware, not configuration was the exact problem.
You see, there is an outdated technology I am certain you are aware of. This obsolete awfulness called BIOS. It turns out my mistake was in assuming that this piece of hardware was new enough that the motherboard complied with the UEFI standard of booting up. I was laughably wrong, and also very frustrated to say the least. It was ever so slight a victory realizing that I had not been doing it wrong all along, well okay, yes, I was; however it was the outdated hardware that was causing the issue. My configuration was correct, if and only if, it were ran on newer hardware.
Due to this there was the realization that I would need to dig into the annals of the World Wide Web to find information of how to setup Grub as the boot loader instead of having it use systemd.
Now, it was not as bad as say… eating a bowl of Carolina Reapers and then sitting idly by waiting for the inevitable crying to begin once nature calls. It was not easy though, and took a considerable amount of trial and error until finally I found a guide and patched the holes in that guide with my own knowledge and passed mistakes. Well, and also some new mistakes too; even when I thought I was out of the woods BAM, another roadblock. Typically these roadblocks were gotchas I either didn’t know was needed, or was something I knew but overlooked.
Anyways, without going on and on and on with some long boring tale of how I finally achieved success in accomplishing this frustrating task… I’ll get to the point.
How to install Arch Linux on an ancient BIOS system requiring you to use Grub, and just for niceness utilizing LVM as your partition of choice:
Boot up to your favorite Arch ISO via USB or other means and begin the journey.
connect to Wi-fi:
find your drive:
setup your partitions:
$> fdisk /dev/sdX ## replace the X with your drives designation letter
n (to add a new partition)
1 (default partition number)
(accept default start)
+1M (yes, 1 mebibyte is the size you need)
t (to change the partition)
4 (for BIOS file system)
n (for another new partition)
2 (default partition number)
(accept default start)
(accept default end)
t (to change file system)
31 (for Linux LVM)
i (to verify the partition map before saving it)
w (to write the partition map to disk)
- The BIOS partition is not actually used ( I mean, come one, its 1Mebibyte). Without it though Grub cannot embed the bootloader onto the front of your drive in the first 446 bytes. If you want to know more about this old way of the pc world, check here. Yeah, I know, it’s wikipedia, Google if you don’t like the info.
create an LVM physical volume on the new partition:
$> pvcreate /dev/sdX2
create a volume group:
$> vgcreate vg1 /dev/sdX2
create logical volumes for boot, root, swap:
$> lvcreate -L 500M -n boot vg1
$> lvcreate -L 8G -n swap vg1
$> lvcreate -l +100%FREE -n root vg1
note: you can choose to separate root and home if you like here
format logical volumes:
$> mkfs.ext4 /dev/vg1/boot
$> mkfs.ext4 /dev/vg1/root
$> mkswap /dev/vg1/swap
$> swapon /dev/vg1/swap
mount the volumes:
$> mount /dev/vg1/root /mnt
$> mkdir /mnt/boot
$> mount /dev/vg1/boot /mnt/boot
do something that makes grub-install work:
this will make more sense below when we install the boot loader.
$> mkdir /mnt/hostrun
$> mount --bind /run /mnt/hostrun
install Linux Kernel and base packages:
$> pacstrap /mnt base base-devel vim git dialog wpa_supplicant
$> genfstab -pU /mnt >> /mnt/etc/fstab
boot into new system:
$> arch-chroot /mnt /bin/bash
$> vim /etc/locale.genuncomment the en_US.UTF-8 UTF-8 line far down the list
$> vim /etc/locale.conf
$> ln -sf /usr/share/zoneinfo/[Zone]/[SubZone] /etc/localtime
$> hwclock --systohc --utc
This is one of those small road blocks I mentioned. Thanks to finding the answer to the issue I was facing… here. (We prepped for this above)
$> mkdir /run/lvm
$> mount --bind /hostrun/lvm /run/lvm
$> pacman -S grub
# Install the bootloader to the drive Arch was installed to
$> grub-install --target=i386-pc /dev/sdX ## NOTE: you cannot install this on a partition!
# In order for Grub to access the LVM partitions you must edit the default config prior to
# generating your Grub config
$> vim /etc/defaults/grub
# add lvm to GRUB_PRELOAD_MODULES=' '
$> grub-mkconfig -o /boot/grub/grub.cfg
create your hostname:
$> echo myhostname > /etc/hostname
install needed packages for GUI:
$> pacman -S networkmanager xorg-server wget acpid
set root password:
create your user:
$> useradd -m -g users -G wheel,storage,power [username]
$> passwd [username]
add your user to the sudoers file:
# uncomment the line below
%wheel ALL=(ALL) ALL
reboot to the new system:
$> umount -R /mnt
$> swapoff -a
Congratulations! You have now installed Arch Linux using the Grub boot loader in order to utilize the inferior BIOS loading of your ancient motherboard!
From here you are on your own. Now you can enable the networkmanager service, run
nmtui to connect to Wi-Fi and install your favorite GUI. The sky is the limit with Arch, make it the system you want it to be. Above all else, never forget… BIOS is a piece of trash leftover from the beginning days of the Personal Computer back in the mid 1980s. Side note, thanks to George Ilyes and his post that helped me 90% of the way. No other post I found helped as much with using Grub on top of LVM. If I missed anything, please feel free to let me know.