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.

1 Answer 1


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

Update: apparently the initial implementation of efivarfs could cause some computers to be bricked if someone ran rm -rf /sys/firmware/efi/efivarfs.

Protection against that was added in new kernels by having all but the known-safe variable items in efivarfs be immutable (similar to chattr +i) by default, and having legitimate UEFI variable manipulation tools like efibootmgr change the file attributes before making modifications.

In a rolling-release system, it is possible to have the kernel update that makes the efivarfs change land on your system before the userspace tools like grub-install have received the necessary modification to deal with it. This might have happened in this case.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .