0

I have a EFI partition, /dev/sda1, that I was once able to install GRUB to and change the boot order with efibootmgr without issue, unfortunately now, however, I cannot I receive 'Read-only file system' errors from grub-install (specifically, when mounted to /boot/efi, grub-install --target=x86_64-efi --efi-directory=/boot/efi /dev/sda and efibootmgr. I have tried wiping it with:

sudo mkfs.vfat /dev/sda1

but I still get this error. Specifically grub-install --target=x86_64-efi --efi-directory=/boot/efi /dev/sda gives:

Installing for x86_64-efi platform.
Could not delete variable: Read-only file system
efibootmgr: ** Warning ** : Boot0002 has same label gentoo
Could not prepare Boot variable: Read-only file system
Installation finished. No error reported.

I saw Fix read only file system usb, but I can't wipe this disk with wipefs I have several distros installed and set up and it'd take a while to recover from such a wipe. Oddly grub-install does still add files to /dev/sda1, it's just the boot order that cannot seem to be changed.

3

Note that the error message is "Could not delete variable: Read-only file system". It is actually trying to manipulate the UEFI boot variables, and failing there.

The errors are actually referring to efivarfs filesystem that is used to access the UEFI boot variables, which should normally be mounted at /sys/firmware/efi/efivars. There may also be an older version of the UEFI variable access mechanism, located at /sys/firmware/efi/vars.

If you have missed the CONFIG_EFIVAR_FS kernel configuration option, the driver for this virtual filesystem may not exist in your kernel (if compiled as a module, it is named efivarfs). If the driver is available, make sure this filesystem is listed in /etc/fstab: if your system's boot scripts don't handle it specially, you may need a line like this in your /etc/fstab file:

efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0

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.