Generate the fstab
The new system needs to know how to mount its own filesystems at
boot. Right now that knowledge exists only in the live system’s
mount table – which is exactly what genfstab reads:
genfstab -U /mnt >> /mnt/etc/fstab
-U writes UUIDs rather than device paths. This matters more than
it looks: /dev/sda is assigned in whatever order the kernel
happens to find disks, so adding a second drive later can rename the
first one and leave a machine that no longer boots. A UUID belongs
to the filesystem and never moves.
Note the >>. pacstrap already created /mnt/etc/fstab with a
header comment in it, and a single > would replace it.
More importantly, running this command twice appends a second copy of every entry. Duplicate mounts are a confusing failure at boot. If you are unsure whether you already ran it, read the file before running it again – not after.
Read what it wrote
This file is worth actually reading, because a mistake here is a machine that does not come up:
cat /mnt/etc/fstab
# /dev/nvme0n1p2 LABEL=arch UUID=e1445380-51a2-449d-ad82-8ac3286cbfb6 / btrfs rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvol=/@ 0 0 # /dev/nvme0n1p2 LABEL=arch UUID=e1445380-51a2-449d-ad82-8ac3286cbfb6 /home btrfs rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvol=/@home 0 0 # /dev/nvme0n1p2 LABEL=arch UUID=e1445380-51a2-449d-ad82-8ac3286cbfb6 /.snapshots btrfs rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvol=/@snapshots 0 0 # /dev/nvme0n1p2 LABEL=arch UUID=e1445380-51a2-449d-ad82-8ac3286cbfb6 /var/log btrfs rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvol=/@log 0 0 # /dev/nvme0n1p2 LABEL=arch UUID=e1445380-51a2-449d-ad82-8ac3286cbfb6 /var/cache/pacman/pkg btrfs rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvol=/@pkg 0 0 # /dev/nvme0n1p2 LABEL=arch UUID=e1445380-51a2-449d-ad82-8ac3286cbfb6 /swap btrfs rw,noatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvol=/@swap 0 0 # /dev/nvme0n1p1 LABEL=ESP UUID=4B65-AADD /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 2 /swap/swapfile none swap defaults 0 0
Three things to check:
- Every btrfs line carries the same UUID, and they differ only
by
subvol. That is one filesystem mounted six times, which is what subvolumes are. - The boot partition has its own UUID and is
vfat. Its UUID is short – FAT volume IDs are 32-bit, so they look likeA1B2-C3D4rather than the long form used by btrfs. - The swapfile has a line if you created one.
genfstab records the mount options the kernel is actually using,
not the ones you typed, so you will see extras like ssd and
space_cache=v2 that btrfs selected for itself. That is correct and
should be left alone.
genfstab finds swap by looking at what is currently active, not
at what exists on disk. If you created a swapfile but never ran
swapon, there will be no swap line here and the installed system
will come up without swap, silently.
Fix it by running swapon /mnt/swap/swapfile and generating the
file again – after deleting the entries you already wrote.