2

I currently have my ESP partition at /boot/efi (actually, it's not even mounted there, no entry in /etc/fstab at all; I installed my system years ago and can't remember why it's setup that way but it's worked OK til now), and would like to have it at /boot instead. I'm currently using GRUB 2 as my boot loader but I don't really know how it works (again, I installed it years ago and never had to touch it since then). And this is Arch Linux.

What would I have to do to make this happen?

Copy everything from /boot to the ESP then add an entry to /etc/fstab to mount the ESP as /boot, but I suspect there might be paths to change in some config files now that EFI would be at /boot/EFI rather than /boot/efi/EFI.

Content of /boot currently:

  • grub/
  • initramfs-linux.img
  • initramfs-linx-fallback.img
  • intel-ucode.img
  • vmlinuz-linux

Content of the ESP:

  • EFI
    • arch
      • grubx64.efi
      • fwupdx64.efi
      • fw/
    • Dell/Bios/Recovery/

Context: I want to move to full disk encryption (using LVM on LUKS 2; currently, I have no encryption at all, neither / nor /home), and for that I need to have the kernel and initramfs on an unencrypted partition for GRUB to load (correct me if I'm wrong). I thought the easiest would be to simply have it on the ESP and thus make the ESP /boot rather than /boot/efi.

Suggestions for alternatives are welcome (please provide pros and cons).

2
  • You may have to reinstall Grub since the boot loader will have to open a FAT partition and no more an ext2. The --efi-directory option can specify the /boot directory as an EFI partition. I have not try such a configuration but I guess it should work. Normally, grub-install determines the needed modules (here fat.mo) and make an EFI loader abled to open your the boot partition. Oct 11 '21 at 11:45
  • You probably have a BIOS/MBR configuration which does not use ESP. To see details: Please copy & paste the pastebin link to the Boot-info summary report ( do not post report), do not run the auto fix till reviewed. help.ubuntu.com/community/Boot-Repair LVM is logical volumes and is totally contained in one physical partition. With Ubuntu newest grub2 can boot without a /boot partition outside LVM, but ESP still must be in a FAT32 partition not in LVM. LVM install to Arch gist.github.com/mattiaslundberg/8620837 & ubuntuforums.org/showthread.php?t=2370388
    – oldfred
    Oct 11 '21 at 16:03
1

TL;DR:

  1. copy everything from /boot to the ESP
  2. mount the ESP to /boot
  3. regenerate the /boot/grub/grub.conf through grub-mkconfig
  4. run grub-install (mostly to update the EFI Boot)
  5. reboot to the new boot
  6. cleanup the old boot (/boot, EFI/arch, efibootmgr)

What I ended up doing, with success:

  1. mount ESP to… anywhere (I used /boot/efi)
  2. copy everything (particularly the initramfs, microcode, kernel, and grub/ folder, though that last one might have not been necessary) from /boot to the ESP
  3. unmount the ESP, and remount it to /boot
  4. run grub-mkconfig to generate a new /boot/grub/grub.conf

At that point, I wanted to check that all would be running OK, so I:

  1. unmounted the ESP and remounted it to /boot/efi
  2. diffed the /boot/grub/grub.conf and /boot/efi/grub/grub.conf
  3. copied menuentry blocks from one to the other so I could (hopefully) boot both options
  4. rebooted and tried the new option to boot from the ESP: it worked (meaning, IIUC, that the files copied to the ESP were OK to boot the system)

I then jumped the gap and made the switch:

  1. mount the ESP to /boot
  2. edit the /etc/fstab to mount it on boot (I actually used genfstab to generate the appropriate fstab line)
  3. run grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB (previous one was named arch, so no conflict)
  4. reboot (note that I have a menuentry from my old grub.conf to, hopefully, boot on the old "system" just in case)

And finally, do some cleanup:

  1. unmount ESP and remove everything from the old /boot (as ESP is mounted here anyway, shadowing those files)
  2. remove the menuentry I added to my grub.conf
  3. remove the old GRUB entry in EFI using efibootmgr
  4. remove the old GRUB entry from the ESP (/boot/EFI/arch/)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.