grub-efi cannot install on locked ESP (read-only error)

Bug #1091477 reported by YannUbuntu
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Some Windows8 computers come with a locked ESP that prevents writing outside the /EFI/Boot and /EFI/Microsoft folders, thus preventing the creation of a /EFI/ubuntu folder.

This leads to a "Read-only" error when trying to install grub-efi.

Example: http://ubuntuforums.org/showthread.php?p=12409846#post12409846

Remark: this is similar but not duplicate of Bug #1090829

**************** WORKAROUND:
1) via Gparted create another EFI partition (FAT32, 200MB, located in the first 100GB of the disk)
2) move the 'boot' flag on it
3) make Ubuntu use this new ESP (eg via Boot-Repair --> Recommended Repair).

Revision history for this message
Phillip Susi (psusi) wrote :

How is this any different?

Changed in grub2 (Ubuntu):
status: New → Incomplete
Revision history for this message
YannUbuntu (yannubuntu) wrote :

Here grub-install returns a "read-only" error.

# grub-install --efi-directory=/boot/efi --target=x86_64-efi
cp: cannot create regular file `/boot/efi/EFI/ubuntu/shimx64.efi': Read-only file system
cp: cannot create regular file `/boot/efi/EFI/ubuntu/grubx64.efi': Read-only file system
cp: cannot create regular file `/boot/efi/EFI/ubuntu/grub.cfg': Read-only file system
/usr/sbin/grub-install: 851: /usr/sbin/grub-install: cannot create /boot/efi/EFI/ubuntu/grub.cfg: Read-only file system
Installation finished. No error reported.

While the other bug returns an "Input/Output" error:

# grub-install --efi-directory=/boot/efi --target=x86_64-efi
mkdir: cannot create directory `/boot/efi/EFI/ubuntu': Input/output error

Changed in grub2 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

An IO error will lead to the fs being mounted read-only. Check /var/log/syslog for errors.

Changed in grub2 (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
YannUbuntu (yannubuntu) wrote :

Please read http://ubuntuforums.org/showthread.php?p=12409846#post12409846 : the partition is not entirely read-only.

Revision history for this message
Phillip Susi (psusi) wrote :

Barring some rootkit like setup that is actually running Ubuntu under virtualization, it is not possible to write protect part of the disk like this, so I'm looking for some kernel log messages that might shed some more light on the situation.

Revision history for this message
YannUbuntu (yannubuntu) wrote :

fyi, I updated Boot-Repair so that it will show dmesg and syslog next time a user meets one of these 2 bugs.

Revision history for this message
YannUbuntu (yannubuntu) wrote :
Revision history for this message
Phillip Susi (psusi) wrote :

More anecdotes or "me too"s aren't helpful. What we need is for someone to fsck the fs to a known good state and then try again. If you can do that, and then installing causes the error to come back, that would point to a bug in the kernel that someone could try to reproduce and track down, possibly with the help of an image of the fs in the before state.

Revision history for this message
YannUbuntu (yannubuntu) wrote :

ok, i'll try to provide that.

Revision history for this message
TimMadden (timmadden) wrote :

Hi, I seem to have this one. I am willing to try to what you ask in comment #8, but I want to be sure that I have the procedure down. When I tried to install Ubuntu, it took a couple tries and I did not record notes about what happened when. I do recall that I may have seen an I/O error at one point. Also, after it would not boot I did try to reset the machine back to factory default from the windows recovery partition.

Anyway, from what I understand you want me to run fsck on the ESP to fix the file system. Then run boot-repair again to see if it can install EFI properly??
Thanks,

Revision history for this message
YannUbuntu (yannubuntu) wrote :

Phillip, here is what you asked:

http://paste.ubuntu.com/1562554/
Line 1088 shows the bug.
Then lines 1111 and 1112 show a fsck on the ESP with no error.
Then line 1113 shows the bug is still here.

Revision history for this message
Phillip Susi (psusi) wrote :

dosfsck was not run there. The -M switch to fsck tells it to skip mounted filesystems.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for grub2 (Ubuntu) because there has been no activity for 60 days.]

Changed in grub2 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Filian (pynolo) wrote :

I solved my case today, thanks to your comments too.
On my HP Sleekbook 15, the EFI partition was read only because there were errors on it. Therefore it was impossible to make any change to it.

I found out the files under the "EFI/ubuntu" directory were totally garbled, the names themselves were random characters.

"EFI/ubuntu" was the only directory with errors, so it looks like the grub instance made the mess during the setup! That's why after the first install tentative the EFI partition can only be mounted as read only. No need to format it or make another one, just fsck!

This is how I solved the issue running Ubuntu from DVD or USB:

dosfsck -a /dev/"efipartition" #to fix the efipartition, remove ubuntu dir if necessary
sudo mkdir /boot/efi
sudo mount /dev/"efipartition" /boot/efi
cd /boot/efi/EFI/
rm -R ubuntu #if it's still there you must remove it
boot-repair #must be installed first

After that, Ubuntu started to be available as a EFI option, even though it was not the default one. But that's a different problem...
I hope this helps!

Revision history for this message
Eric (paralis) wrote :

Same bug here on Asus N550JV. Tried to use Boot-repair. Had the same 'Locked-ESP detected' message.

My post on Ubuntu forum: http://ubuntuforums.org/showthread.php?t=2184383
More info: http://paste.ubuntu.com/6332633/

Pressing ESC at start, I can see ubuntu (which was automatically added to that menu with no intervention from me whatsoever). Trying to boot it: black screen then it boots up W8.

YannUbuntu (yannubuntu)
Changed in grub2 (Ubuntu):
status: Expired → Confirmed
Revision history for this message
YannUbuntu (yannubuntu) wrote :

@Eric: thanks for your feedback. I attach your Boot-Info in text file just in case the pastebin expires.
Your Read-Only error is:
cp: cannot create regular file '/boot/efi/EFI/ubuntu/grubx64.efi': Read-only file system
(eg line 1979)

@Phillip:
his dosfsck is from line 1262
his dmesg is from line 1993
his syslog is from line 3510
Hope this helps.

Revision history for this message
Phillip Susi (psusi) wrote :

It is read only because it is corrupted, the question is why?

Revision history for this message
Felix Offor (foffor) wrote :

I solved this by disabling secure boot. I have an HP Spectre 360. You have to disable secure boot and clear all secure boot keys in the BIOS SETUP UTILITY.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.