Installing Archlinux on removable media

this is actually…a log of how i fucked up.

so, the other day i picked up a cheap usb stick when shopping, and i thought it would be cool to have a fully functional and bootable system image on it.

Since I already have archlinux as my daily os, i installed arch-install-scripts and started installing archlinux to the usb stick from my existing os.

I consider myself quite experienced in setting up archlinux, so i followed my instinct without reading an instruction. I partitioned the drive, made filesystem, mounted the partitions, install the base packages with pacstrap. Then chroot into it, made some basic configs to the system e.g. locale, timedate, users etc.

It was not until i ran grub-install and rebooted that i realized, i fucked up.

The command i ran was:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck
grub-mkconfig -o /boot/grub/grub.cfg

exactly the same as what i did for my previous fresh install.

But this broke my hosting machines’s EFI. (Arch wiki said this would happen, but i was too confident to read it)

So, the correct ways of doing this is to add --removable argument to the grub-install command. This keeps grub-install within the new installed system and it’s media, so that it won’t consider the media as “part of the hosting machine” and mess with existing efi system of the hosting machine.

This is a reminder: always RTFM.