Skip to contentSkip to conversation

Installing grub onto a system with XFS root fs

DISCUSSION Jason White 4 participants 8 messages Dec 17, 2007 – Dec 18, 2007

lore
Share & tools
lore
#0 lore raw

I am trying to install Grub onto a system with a single XFS partition serving as both / and /boot.

Distribution: Debian Unstable (Sid).
Architecture: x86_64

When I run grub-install I get:
Searching for GRUB installation directory ... found: /boot/grub Due to a bug in xfs_freeze, the following command might produce a segmentation fault when /boot/grub is not in an XFS filesystem. This error is harmless and can be ignored.

At this point the install script hangs and the only way to recover is to reboot the machine (with a hard reset). Needless to say, Grub isn't installed.

Any suggestions?

Note that the installation of grub failed during the Debian installation process for a reason that wasn't specified (no helpful error message).

I have an x86 "live CD" with grub available if that will help, but it isn't x86_64.

Thanks.

#1 lore raw
Quoted 11 lines · Jason White

I am trying to install Grub onto a system with a single XFS partition serving as both / and /boot.

Distribution: Debian Unstable (Sid).
Architecture: x86_64

When I run grub-install I get:
Searching for GRUB installation directory ... found: /boot/grub Due to a bug in xfs_freeze, the following command might produce a segmentation fault when /boot/grub is not in an XFS filesystem. This error is harmless and can be ignored.

Hrm, that's funky.

Quoted 8 lines

At this point the install script hangs and the only way to recover is to reboot the machine (with a hard reset). Needless to say, Grub isn't installed.

Any suggestions?

Note that the installation of grub failed during the Debian installation process for a reason that wasn't specified (no helpful error message).

Hard to say - in a nutshell, grub just sucks w.r.t. how it (ab)uses the filesystem it's trying to install on.

In some invocations, it actually writes directly to the block device *while it is mounted* - this leads to data corruption and/or filesystem corruption.

In other cases, in a "verification" phase, it tries to directly read filesystem structures off the disk *while it is mounted* after a couple of wishful sync; sync;'s - this often can lead to a grub hang when it goes off in the weeds on inconsistent disk data that it finds.

I think various distros have tried to hack around these problems in different ways; the freeze above is probably an effort to coalesce the filesystem before grub goes groveling around the disk to verify what it just wrote(!).

If you:

a) don't write to the bdev while mounted

and b) don't try to read the mounted filesystem via the bdev (skip verification steps)

it should all work ok.

(for fedora grub, a) means passing the path to the stage2 files on the commandline to grub-install, ymmv):

install --stage2=/boot/grub/stage2 (hd0,7)/grub/stage1 d (hd0) /grub/stage2 p
(hd0,7)/grub/grub.conf

for some reason this stops grub from writing to the mounted block device.

Otherwise, I'd bug debian - honestly, this isn't an xfs bug.

-Eric

#2 lore raw
Quoted 12 lines · Eric Sandeen

Hard to say - in a nutshell, grub just sucks w.r.t. how it (ab)uses the filesystem it's trying to install on.

In some invocations, it actually writes directly to the block device *while it is mounted* - this leads to data corruption and/or filesystem corruption.

In other cases, in a "verification" phase, it tries to directly read filesystem structures off the disk *while it is mounted* after a couple of wishful sync; sync;'s - this often can lead to a grub hang when it goes off in the weeds on inconsistent disk data that it finds.

Quoted 5 lines

I think various distros have tried to hack around these problems in different ways; the freeze above is probably an effort to coalesce the filesystem before grub goes groveling around the disk to verify what it just wrote(!).

Thanks for the background. The most up to date bug report and discussion I could find is here:
https://bugs.launchpad.net/debian/+source/grub/+bug/8058
(for Ubuntu).

There are also Debian bugs for this, such as
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111

Manually unfreezing the file system with xfs_freeze -u /
worked for me on one machine. (This was done while grub-install was executing, after it executed xfs_freeze).

#3 lore raw
Quoted 5 lines · Jason White

Manually unfreezing the file system with xfs_freeze -u /
worked for me on one machine. (This was done while grub-install was executing, after it executed xfs_freeze).

sounds like a bug in the scripts, then.

-Eric

#4 lore raw
In reply to Jason White

Hello Jason,

Am Montag 17 Dezember 2007 schrieb Jason White:

Quoted 12 lines

I am trying to install Grub onto a system with a single XFS partition serving as both / and /boot.

Distribution: Debian Unstable (Sid).
Architecture: x86_64

When I run grub-install I get:
Searching for GRUB installation directory ... found: /boot/grub Due to a bug in xfs_freeze, the following command might produce a segmentation fault when /boot/grub is not in an XFS filesystem. This error is harmless and can be ignored.

Quoted 5 lines

At this point the install script hangs and the only way to recover is to reboot the machine (with a hard reset). Needless to say, Grub isn't installed.

Any suggestions?

Using grub shell manually always worked for me:

- grub
- find /boot/grub/menu.lst
- root <result from above command>
- setup <place to install too> for example (hd0,0) for first harddisks MBR

Remember to copy over the contents of /usr/lib/grub/i386-pc to /boot before you do a manual installation.

Ciao,

Signature · 2 lines
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
#5 lore raw
Quoted 9 lines · Martin Steigerwald

Using grub shell manually always worked for me:

- grub
- find /boot/grub/menu.lst
- root <result from above command>
- setup <place to install too> for example (hd0,0) for first harddisks MBR

Remember to copy over the contents of /usr/lib/grub/i386-pc to /boot before you do a manual installation.

Thanks.

Apparently there is XFS support in Grub 2 as well, which is where all development is now taking place. I hope it receives adequate testing and attention before distributions start using Grub 2.

I'll gladly volunteer to be part of the beta testing once Grub 2 (and its XFS support) reaches the point of being available for general use and beta testing.

Also, I've added a note to the Debian bug report on this subject, referring to this thread.

#6 lore raw
Quoted 9 lines · Jason White
Quoted 7 lines · Martin Steigerwald

Using grub shell manually always worked for me:

- grub
- find /boot/grub/menu.lst
- root <result from above command>
- setup <place to install too> for example (hd0,0) for first harddisks MBR

Quoted 8 lines
Quoted 2 lines

Remember to copy over the contents of /usr/lib/grub/i386-pc to /boot before you do a manual installation.

Thanks.

Apparently there is XFS support in Grub 2 as well, which is where all development is now taking place. I hope it receives adequate testing and attention before distributions start using Grub 2.

I just looked at the XFS code in ithe grub 2 CVS repository and had a read of the wiki (http://grub.enbug.org/).

Quoted 1 line

From the code and the wiki, I note that there is no indication of grub 2

fixing the worst design mistakes in grub and is persisting with stuffing around with filesystem internals to find files and get block mappings for file data. Hence grub 2 will break just like grub if we ever change things on disk like the inode, directory or extent format. Lucky it doesn't support btree formats yet, so that won't break if we change them....

And there's plans on doing *journal replay* for filesystems! (#1 item on the todo list here: http://grub.enbug.org/TodoList). That's an insane layering violation and completely unsupportable by anyone. I certainly hope this part of the plan for grub 2 never gets implemented.

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group
#7 lore raw

Am Dienstag 18 Dezember 2007 schrieb David Chinner:

Quoted 2 lines · Jason White
Quoted 1 line · Martin Steigerwald

[...]

Quoted 15 lines
Quoted 3 lines

Apparently there is XFS support in Grub 2 as well, which is where all development is now taking place. I hope it receives adequate testing and attention before distributions start using Grub 2.

I just looked at the XFS code in ithe grub 2 CVS repository and had a read of the wiki (http://grub.enbug.org/).

From the code and the wiki, I note that there is no indication of grub 2 fixing the worst design mistakes in grub and is persisting with stuffing around with filesystem internals to find files and get block mappings for file data. Hence grub 2 will break just like grub if we ever change things on disk like the inode, directory or extent format. Lucky it doesn't support btree formats yet, so that won't break if we change them....

Quoted 4 lines

And there's plans on doing *journal replay* for filesystems! (#1 item on the todo list here: http://grub.enbug.org/TodoList). That's an insane layering violation and completely unsupportable by anyone. I certainly hope this part of the plan for grub 2 never gets implemented.

Hi David!

I think it may be a good idea to contact the GRUB development team about your concerns. I bet they won't read this mailing list.

But how do you think GRUB is supposed the kernel and initrd without knowing at least enough details of the filesystem in order to load the file. The only other alternative I see is LILO which uses map of the blocks to load and thus has to be rewritten on any change.

It might be just me, but I cannot recall having trouble with GRUB and XFS beside that grub-install didn't work. Well grub shell always worked for me so I didn't bother that much.

Ciao,

Signature · 2 lines
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7