I have a custom, non-default Ubuntu installation, where I use my other Linux distro's boot manager (rEFInd). As such, I don't want Ubuntu to see my EFI partition, on the principle that it has no business to what's there (which has already saved my ass last night when I did an
rm -rf /*...). However, because I'm using btrfs as my file system, my
/boot directory has to be in a UEFI-readable partition—like the EFI partition. So my solution to this conundrum is to shadow bind mount a subdirectory of the EFI partition,
/boot through commands like these:
mount /dev/sdb2 /boot mount --bind /boot/EFI/ubuntu /boot
This works perfectly. Ubuntu has access to a /boot partition that it can freely drop its vmlinuz and initramfs into and my boot manager automatically detects the installation. Booting and updating works as expected. The only caveat is, so far, that I needed to use the commands to mount /boot. So like any responsible sysadmin, I made an fstab entry:
UUID=XXXX-XXXX /boot vfat rw,relatime 0 0 /boot/EFI/ubuntu /boot none bind 0 0
Despite being analogous to the commands above, on boot the entire EFI partition remains mounted. The second line, performing the shadow bind mount, does not seem to execute. Is there a way to make this work in fstab and if not, what would be a reliable way to perform the bind mount as quickly as possible after the initial mount?