Guide on how to install Arch Linux on UEFI computers, using systemd-boot and f2fs, targeting USB drives. The reason for making this was that I always forgot something during an installation, so I wrote down my steps, so I could copy & paste a list of commands so I can have an installation in just a few minutes.
If you use a computer with Intel Skylake graphics or later, you can use everything listed here. If your hardware is slightly different, you can still look at it to see what's useful to you.
What&Why F2FS? F2FS is designed for flash storage, as a result a tiny USB flash drive can perform terrific for many tasks. Another good option would be btrfs with its transparent compression. What&Why systemd-boot? systemd-boot is a boot loader that is required to boot into your OS, it is small and simple, which is great for slow storage, and can boot any kind of root system. An alternative would be GRUB, though when I wrote this it couldn't boot f2fs yet, and also no zstd compressed btrfs.
This is text that you enter directly into a terminal window.
This is text that you enter directly into a text editor.
This is text that provides explanations as to what is being done. Skippable.
This is text that is completely unimportant and there's no need to read it.
I've run into websites so many times where I had no clue what I was looking at, that I know that I shouldn't make one myself.
Basically, Linux is a computer operating system, like Windows or iOS or Android, and it has a bunch of variations. Android is one, Ubuntu is one, Arch Linux is one, and there are many others. This website basically outlines and explains how to put software on a USB flash drive.
sudo su. Use
lsblkto confirm target partitions again.
mkfs.f2fs /dev/sdxyon the large partition.
mount -o noatime,nobarrier,discard /dev/sdxy /mnt
mkdir -p /mnt/boot /mnt/var/cache/pacman/pkg /mnt/var/log /mnt/var/tmp
mount -t tmpfs tmpfs /mnt/var/cache/pacman/pkg
mount -t tmpfs tmpfs /mnt/var/log
mount -t tmpfs tmpfs /mnt/var/tmp
mount -o noatime /dev/sdxz /mnt/boot
The main reason to use a virtual machine is so you always have full access to the host machine still, for resources that you might like, or just to play music in the background, or play solitaire while packages are downloading. ESP is a partition used for every UEFI installation, which is a FAT partition, which always writes changes to files whenever you access them and reducing writes is key for a USB key, so we specify the "noatime" option which stops that from happening. We use the same thing for the main partition alongside nobarrier, which disables write barriers which makes us have more throughput at the cost of increased risk of losing data during a sudden power failure. If you're opting for btrfs instead, then use
mkfs.btrfs instead of f2fs, and specify ",compress=zstd" after the discard option. The three "tmpfs" mounts are making Linux use RAM to store log files and some temporary files, which again greatly reduces writes to the flash storage.
Just in case you're using the standard Arch installation image, where you only have a command line, in order to partition, you'll need to use
lsblk to identify your target disk. Then
gdisk /dev/sdx to create a GPT layout.
cgdisk /dev/sdx to create the partitions using
EF00 for the ESP, and
8200 for the swap partition.
If you're using an existing Arch installation to install from, run
pacman -Sy arch-install-scripts gparted f2fs-tools --needed
curl -o /etc/pacman.d/mirrorlist "https://www.archlinux.org/mirrorlist/?country=JP&protocol=https&ip_version=6"
sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist
gedit /etc/pacman.confand comment out the Antergos repo, and add:
sed -i 's/#en/en/g' /mnt/etc/locale.gen
sed -i 's/#WaylandEnable/WaylandEnable/g' /mnt/etc/gdm/custom.conf
echo computer > /mnt/etc/hostname
echo hwdec=auto > /mnt/etc/mpv/mpv.conf
genfstab -U -p /mnt >> /mnt/etc/fstab
gedit /mnt/etc/fstaband add the following lines to the bottom of the file:
rm -rf /mnt/boot/initramfs-linux-zen-fallback.img
sed -i 's/HOOKS/#HOOKS/g' /mnt/etc/mkinitcpio.conf
sed -i "s/ 'fallback'//g" /mnt/etc/mkinitcpio.d/linux-zen.preset
gedit /mnt/etc/mkinitcpio.confand add the following lines to the bottom of the file:
gedit /mnt/etc/pacman.confand add:
curl -o /mnt/etc/fonts/local.conf "https://pastebin.com/raw/t1Uu6Z4R"
curl -o /mnt/etc/X11/xorg.conf.d/50-mouse-acceleration.conf "https://pastebin.com/raw/L24zjurp"
systemctl enable gdm NetworkManager tlp tlp-sleep
useradd -m -G wheel computer
echo "console-mode max" >> /mnt/boot/loader/loader.conf
blkidand find the partuuid of your target root.
gedit /mnt/boot/loader/entries/linux-zen.conf, add the following and replace the x with the partuuid found before:
Those are a lot of boot options. If you're using kernel 5.2, you can replace everything after i915 with just "mitigations=off". They're settings to reduce the impact of some theoretical security impacts, if you're reading this by the time there are real viruses which can affect you which make use of spectre/meltdown, then I highly recommend you do remove those mitigation disablers. The i915 ones help increase battery life.
sudo pacman -Syuto update and install,
sudo pacman -Systo search,
sudo pacman -Rto remove, and
sudo pacman -R $(pacman -Qdtq)to autoremove
sudo cp libwidevinecdm.so /usr/lib/chromium/libwidevinecdm.so
curl -o ~/.config/chromium-flags.conf "https://pastebin.com/raw/naLpJD0y"to disable the smooth scrolling and enable more GPU acceleration in Chromium.