grub-install hangs

Bug #20509 reported by John Moser on 2005-08-28
This bug report is a duplicate of:  Bug #8058: grub-install hangs with xfs root/boot. Edit Remove
6
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Medium
Colin Watson

Bug Description

Rewrite grub-install from scratch so it works. There's something wrong with it,
I can't imagine what.

When installing to XFS, grub-install tends to hang the ubuntu install process.
We know this. Even on hoary and breezy the freeze_xfs command that's run by the
installer doesn't help, and trying to chroot into the install path freezes the
system (Oops!).

However, there's a simple task that can be done here:

 - Do NOT run freeze_xfs
 - grub-install to set up the files in /boot/grub/
 - KILL grub-install because it's going to hang now. System will still be alive
 - grub
 - grub> root (hd0,0)
 - grub> setup (hd0)
 - grub> quit

Assuming that (hd0,0) contains /boot, this works every time. You can always
manually run grub if /boot/grub has the proper needed files in it.

This presents some confusion. All grub-install HAS to do is copy files to
/boot/grub, symlink . /boot/boot (in case its' its own partition, which is
pointless on post-1995 hardware), detect what device /boot is on, figure out
what the boot device is (passed), and run grub with the above commands. This
shouldn't involve low level filesystem calls or anything; hell I can do all that
with cp, ln, and mount (and of course grub itself), but I can't make decisions
about what string /dev/hda translates to for grub (my /dev/sda is (hd0)).

Short version, there's no real reason why grub-install shouldn't work. Somebody
is doing something stupid.

Matthew Garrett (mjg59) wrote :

Without freeze_xfs, installs to xfs filesystems simply won't work reliably. Grub
needs to know the blocks that the stage1.5 loader are on, and due to the way
it's designed it can't know that until the xfs journal has been written out.
Which requires an xfs_freeze to be certain.

Matt Zimmerman (mdz) wrote :

(In reply to comment #0)
> Rewrite grub-install from scratch so it works. There's something wrong with it,
> I can't imagine what.

The only part of your comment which seems to indicate a genuine bug is your
report that grub-install hangs. Please provide us with more details of that
problem.

>
> When installing to XFS, grub-install tends to hang the ubuntu install process.
> We know this. Even on hoary and breezy the freeze_xfs command that's run by the
> installer doesn't help, and trying to chroot into the install path freezes the
> system (Oops!).
>
> However, there's a simple task that can be done here:
>
> - Do NOT run freeze_xfs
> - grub-install to set up the files in /boot/grub/
> - KILL grub-install because it's going to hang now. System will still be alive
> - grub
> - grub> root (hd0,0)
> - grub> setup (hd0)
> - grub> quit
>
> Assuming that (hd0,0) contains /boot, this works every time. You can always
> manually run grub if /boot/grub has the proper needed files in it.
>
> This presents some confusion. All grub-install HAS to do is copy files to
> /boot/grub, symlink . /boot/boot (in case its' its own partition, which is
> pointless on post-1995 hardware), detect what device /boot is on, figure out
> what the boot device is (passed), and run grub with the above commands. This
> shouldn't involve low level filesystem calls or anything; hell I can do all that
> with cp, ln, and mount (and of course grub itself), but I can't make decisions
> about what string /dev/hda translates to for grub (my /dev/sda is (hd0)).
>
> Short version, there's no real reason why grub-install shouldn't work. Somebody
> is doing something stupid.

Colin Watson (cjwatson) wrote :

It's a race condition. I've tried everything you suggest in the past, to no
avail; it still would not work reliably (even if it works 100% of the time on
your hardware).

The only thing that seems at all useful is "wait a bit after copying the
stage1.5 loader in"; but how long should I wait? Five seconds? Ten? Thirty?
Sixty? As far as I've been able to make out, not even xfs_freeze is a reliable
way to tell XFS to actually write the blocks out to disk.

This bug has been marked as a duplicate of bug 8058.

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

Other bug subscribers

Remote bug watches

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