I was having the same problem.  The grub command save_env gives no error
messages, but it doesn't actually make any changes to the environment
block (/boot/grub/grubenv) as it should.  I download the source package
(grub-pc-1.98-1ubuntu7) and poked around a bit.

>From disk/raid.c:

grub_raid_write (grub_disk_t disk __attribute ((unused)),
                 grub_disk_addr_t sector __attribute ((unused)),
                 grub_size_t size __attribute ((unused)),
                 const char *buf __attribute ((unused)))
{
  return GRUB_ERR_NOT_IMPLEMENTED_YET;
}

And from disk/lvm.c:

grub_lvm_write (grub_disk_t disk __attribute ((unused)),
                 grub_disk_addr_t sector __attribute ((unused)),
                 grub_size_t size __attribute ((unused)),
                 const char *buf __attribute ((unused)))
{
  return GRUB_ERR_NOT_IMPLEMENTED_YET;
}

I had my /boot on a LVM2 volume and it looks like the original reporter
(emteeyou) is using MD RAID (pure software RAID).  I'm pretty sure this
is the cause of the problem.  According to <a href="http://www.mail-
archive.com/[email protected]/msg13749.html">this message</a> there is
a good reason why GRUB2 won't write to LVM volumes and presumably the
same arguments apply to MD RAID.

Surprisingly, it DOES work with a BIOS-assisted software RAID (aka
"Fake" RAID).  I created a 100MB non-LVM partition on my Fake RAID,
stuck /boot on it, and save_env now works correctly (grub-reboot does
too).  I didn't read enough code to figure out why, but GRUB does not
load the "raid" module when I boot this configuration, so the above
function grub_raid_write could never be called.

So to sum things up:  if you are having this problem, put /boot on a
normal partition that is not a MD RAID or LVM volume.

To close the bug, the documentation should be updated so users are
warned of GRUB's limited support for LVM and MD RAID.  Basically,
GRUB_DEFAULT=saved will not work as expected with LVM or MD RAID.

Because this bug could have serious consequences for someone trying to
reboot a remote machine, grub-reboot should detect the problem and
refuse to work or at least print a warning   I might try my hand at a
patch, but I can't think of a way to check if /boot is on LVM or MD RAID
using a bash script.  Any hints?

-- 
grub-reboot doesn't work – prev_saved_entry doesn't get reset
https://bugs.launchpad.net/bugs/625475
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to