Forgot to create an fstab. How did it still boot?
The grub menu displayed as if the system knew which partition contains the bootloader. The root partition mounted by itself. Neither dmesg nor my init/process manager threw any errors. The boot partition was not mounted, neither was swap.
I did manually create an fstab from within the installed system and all is fine, so my question is purely academic. Do modern systems not need an fstab in order to know which devices and partitions to mount where?
11 replies
If the initramfs is using systemd, it's actually able to look up the root (by label) and ESP partitions (by guid) automatically. GRUB can also detect the ESP and enumerate UKI images. There's still some assumptions being made, but it's cleaner than ever.
Cool! In my case, it must be GRUB, then, since I'm not on systemd. Thanks!
To be clear, grub itself doesn’t mount your root partition. Grub provides the root partition device path or id to the kernel via kernel command line. Then kernel mounts the root partition early in its boot sequence with a limited set of options (typically read only).
Logically, the root partition should be mountable without fstab because otherwise it would be a chicken and egg problem :)
Usually once the userspace starts, an init script will remount the root partition with its normal options from fstab.
(It’s a bit more complicated if initramfs is involved, but the principle is the same).
Thanks! I guess I need to read up on the boot process. 😅
Good thinking :)
The root partition ID is in the grub configuration, it's mounted when the system boots. Then fstab is read and the other partitions are mounted.
fstab is needed for root mount options and other partitions, but as you saw with your system if the only partitions other than root are not needed to boot your system will boot fine (I don't know which options grub uses when mounting root though)
I see. Well, normally, when I do make an fstab, I just give it
defaults,noatime, but I wonder what GRUB defaulted to without the fstab. Thanks!Grub typically stores the uuid of the root filesystem in the kernel command line arguments (I can't quite remember if that's the right name it not).
Have a look at the grub configuration when in the grub menu and you should see it there.
Thanks! That seems to be the case exactly!
Source: https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html
highly recommend setting up both grub and a second bootloader, it's ok to have multiple! really handy when shtf
Me doesn't follow anything you suggested. :D Never had a second bootloader in almost 20 years and never didn't encounter an issue where it would solve the problem. Although I just distro hopped once, or twice if you count same family of distro.
Recently (years ago) switched from grub to systemd-boot (note, it is badly named, as it is not a systemd component and just a different project taken over and renamed from gummiboot, so technically it should be usable without systemd), as it is much simpler and less prone to issues than grub (and because it is the default recommendation by EndeavourOS too). I have only one operating system installed and from day to day work, I never noticed a difference in the operation.