grub-common recreates /etc/grub/grubenv

Bug #913336 reported by Richard Laager
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

/etc/init.d/grub-common and /etc/pm/sleep.d/10_grub-common call grub-editenv to clear the recordfail setting to indicate that the system booted or awoke successfully. They call grub-editenv, which creates the grubenv file if it doesn't exist.

If the admin has deleted the grubenv file intentionally because they don't want grub writing to the filesystem, this behavior is annoying. If the admin has deleted the file because grub does not have write support for the root filesystem, then this behavior breaks booting; someone has to hit a key on the console for the machine to boot.

The attached patch fixes this. However, I'm not sure what is supposed to create /boot/grub/grubenv originally. If it's the init script, then some further changes will be required.

Tags: patch
Revision history for this message
Richard Laager (rlaager) wrote :
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "grubenv.diff" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Richard Laager (rlaager) wrote :

This patch is not sufficient, as grub-install calls grub-editenv /boot/grub/grubenv create unconditionally. I've attached another patch which stops grub-install from creating grubenv when /boot/grub is on ZFS.

If we care about the possible use case of an admin who doesn't want grubenv, further work will be required; otherwise it'll come back on every GRUB package upgrade. However, this use case isn't covered now, so I'd hate to see the ZFS fix held up on that.

Revision history for this message
Richard Laager (rlaager) wrote :

Jordan_U in #grub suggested that GRUB should just not fail on boot when grubenv is read-only. That would sidestep the need for these changes. I'll pursue that option a bit. Ignore the patches for now.

Revision history for this message
Richard Laager (rlaager) wrote :

My original description was wrong. This does not stop the boot. GRUB does timeout and continue.

After more thought, I believe my two patches are the correct solution to this problem. If we were to simply suppress the error on boot, then an admin who wants the features provided by the grubenv file would be thinking, "This appears to be setup correctly. The grubenv file exists. I don't get any errors. Why doesn't this work?"

Revision history for this message
Richard Laager (rlaager) wrote :

I've attached "zfs-ubuntu-disable-recordfail.patch".

This supersedes my previous patches and takes a different approach. It disables the recordfail feature for filesystems to which GRUB cannot write (btrfs, zfs, etc.).

The changes from this patch are on top of (and should be folded into) debian/patches/ubuntu_failed_boot_menu.patch in the existing Ubuntu package.

This approach has the following benefits:
* On btrfs (and zfs, etc.), we don't show an error (and add delay) on every boot.
* We allow for the use of any and all features where GRUB only needs to *read* grubenv at boot.
* If the admin enables a different feature that uses save_env, it fails with an error rather than silently.

Revision history for this message
Richard Laager (rlaager) wrote :

Can I get a review on the most recent patch? It's been a year with no comment.

Revision history for this message
Colin Watson (cjwatson) wrote :

Applied, thanks; apologies for the long delay.

Changed in grub2 (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Fix Committed
Revision history for this message
Simplehuman (simplehuman) wrote :

After this update grub-pc failed to install

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

This bug was fixed in the package grub2 - 2.00-18ubuntu3

---------------
grub2 (2.00-18ubuntu3) saucy; urgency=low

  * Fix recordfail-disabling patch to take account of the GRUB_PREFIX
    variable no longer existing.
 -- Colin Watson <email address hidden> Wed, 11 Sep 2013 17:41:22 +0100

Changed in grub2 (Ubuntu):
status: Fix Committed → Fix Released
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.