xfs
[Top] [All Lists]

Re: grub disaster with FC4 & XFS

To: linux-xfs@xxxxxxxxxxx
Subject: Re: grub disaster with FC4 & XFS
From: James Pearson <james-p@xxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Sep 2005 11:23:50 +0100
Cc: netllama@xxxxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040524
On 07/04/2005 01:22 PM, Ethan Benson wrote:
On Mon, Jul 04, 2005 at 01:54:40PM +0100, James Pearson wrote:
>Not sure if anyone is aware of this mess of a bug:
>https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=160444
>
>Basically grub pukes all over itself when trying to interact with XFS >filesystems, resulting in an unbootable, or barely bootable FC4 >installation.
>
>Any gurus here know of a solution?
>
>Yes, i know, this is really a FC/grub issue, but since its specific to >XFS, i thought someone might have run into it and found a workaround >and/or fix.

Not sure if this is connected, but the FC installer (anaconda) uses the code in 'booty' to install the bootloader - this has a work around for grub on XFS which uses xfs_freeze - see the thread that starts with:

http://marc.theaimsgroup.com/?l=linux-xfs&m=108009684613605&w=2

which is a kludge, and an unecessary one at that.

if you install grub as followes it does not modify XFS filesystems via
raw devices, but instead through the standard unix interfaces:

embed /boot/grub/xfs_stage1_5 (hd0)

xx sectors embedded.

install --stage2=/boot/grub/stage2 /boot/grub/stage1 (hd0) (hd0)1+xx p 
(hd0,1)/boot/grub/stage2 /etc/grub.conf

note the xx in the first message is the value you need to use in the
(hd0)1+xx part above.  the last argument is the path to the config
file you can have that where you like.

what should be done is rewrite the setup command in grub to perform
the above, instead of the broken method it currently uses.


Actually, the command you noted above is what the FC4 installer was trying to do when grub went south.

I did finally manage to fix this mess by booting with knoppix, purging everything in /boot/grub, repopulating with the templates that ship with grub, and running 'setup (hd0)' again. I have no clue why all of that was neccesary.

To follow up on this - I think I might have a work round for this XFS/grub/RedHat installer problem -

Based on a comment in another thread:

http://marc.theaimsgroup.com/?l=linux-xfs&m=112096901910385&w=2

remounting the file system that contains /boot read-only and then read-write before running the grub install command appears to work fine.

I've attached a patch below to RedHat's 'booty' package if anyone is interested

James Pearson




Patch to make grub install on an XFS filesystem when using the RedHat
anaconda installer

Patch works by remounting the XFS file system containing /boot read-only
and then read-write based on an idea from:

http://marc.theaimsgroup.com/?l=linux-xfs&m=112096901910385&w=2

The patch should work with most recent versions of booty i.e. Fedora Core
2, 3 and 4, RHEL4, CentOS4  etc.

This patch can either be used to patch the booty SRPM, rebuild the RPM and
then rebuild the installer, or just used to create an 'update' for the
installer - to do this:

Install the booty RPM

cd /usr/lib/booty
patch -p1 < this_file

This will patch 'bootloaderInfo.py'

If you install over NFS, then create a directory at the top level of
the install tree called 'RHupdates' and copy in bootloaderInfo.py to
this directory. The anaconda installer will look here by default when
doing NFS installs.

If installing via other methods, then you need to create an updates floppy,
CD or USB drive - for a floppy disk, do something like:

mkfs -t ext2 /dev/fd0
mount /media/floppy (or /mnt/floppy or whatever)
cp /usr/lib/booty/bootloaderInfo.py /media/floppy
umount /media/floppy

Then, at the installer 'boot:' prompt, type:

boot: linux updates

This will prompt you to insert the update floppy and the installer will use
the new bootloaderInfo.py

The CD and USB disk update disks (probably) work in a similar way (not tested)

James Pearson <james-p@xxxxxxxxxxxxxxxxxx>


*** ./bootloaderInfo.py.dist    2005-05-11 16:41:51.000000000 +0100
--- ./bootloaderInfo.py 2005-09-29 12:16:11.117385013 +0100
***************
*** 49,71 ****
  # there's no guarantee that data is written to the disk and grub
  # reads both the filesystem and the disk.  suck.
  def syncDataToDisk(dev, mntpt, instRoot = "/"):
!     import isys, fsset
      isys.sync()
      isys.sync()
      isys.sync()
  
!     # and xfs is even more "special" (#117968)
      if fsset.isValidXFS(dev):
!         rhpl.executil.execWithRedirect( "/usr/sbin/xfs_freeze",
!                                         ["/usr/sbin/xfs_freeze", "-f", mntpt],
!                                         stdout = "/dev/tty5",
!                                         stderr = "/dev/tty5",
!                                         root = instRoot)
!         rhpl.executil.execWithRedirect( "/usr/sbin/xfs_freeze",
!                                         ["/usr/sbin/xfs_freeze", "-u", mntpt],
!                                         stdout = "/dev/tty5",
!                                         stderr = "/dev/tty5",
!                                         root = instRoot)    
  
  class BootyNoKernelWarning:
      def __init__ (self, value=""):
--- 49,84 ----
  # there's no guarantee that data is written to the disk and grub
  # reads both the filesystem and the disk.  suck.
  def syncDataToDisk(dev, mntpt, instRoot = "/"):
!     import isys, fsset, _isys
      isys.sync()
      isys.sync()
      isys.sync()
  
!     # for XFS make sure the data is _really_ sync'd to disk by remounting
!     # /boot first read-only and then read-write - idea from:
!     # http://marc.theaimsgroup.com/?l=linux-xfs&m=112096901910385&w=2
!     # James Pearson MPC 29-sep-2005
      if fsset.isValidXFS(dev):
!         fstype = "xfs"
!         device = "/tmp/%s" % dev
!         location = "%s%s" % (instRoot, mntpt)
!         readOnly = 1
!         bindMount = 0
!         remount = 1
!         log("remounting %s on %s read-only" % (device, location))
!         # remount the boot partition as read-only
!         rc = _isys.mount(fstype, device, location, readOnly, bindMount, 
remount)
! 
!         # if the remount fails, then we should really do something else e.g.
!         # sleep for a few minutes? - for the time being we'll just log the
!         # return
!         log("remount return: %s (None == OK)" % rc)
! 
!         # now remount as read-write
!         readOnly = 0
!         log("remounting %s on %s read-write" % (device, location))
!         rc = _isys.mount(fstype, device, location, readOnly, bindMount, 
remount)
!         log("remount return: %s (None == OK)" % rc)
  
  class BootyNoKernelWarning:
      def __init__ (self, value=""):
<Prev in Thread] Current Thread [Next in Thread>