Debian Bug report logs - #239111
Freeze when installing GRUB on XFS boot partition

version graph

Package: grub; Maintainer for grub is GRUB Maintainers <pkg-grub-devel@lists.alioth.debian.org>;

Reported by: asjo@koldfront.dk (Adam Sjøgren)

Date: Sat, 20 Mar 2004 23:18:02 UTC

Severity: grave

Tags: d-i, lenny-ignore, patch, upstream

Merged with 243835, 246111, 309218, 425367

Found in versions 0.93+cvs20031021-8, 0.95+cvs20040624-17, grub/0.97-20, grub/0.97-27, grub/0.97-47

Fixed in version grub/0.97-47lenny2

Done: Robert Millan <rmh@aybabtu.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Install Team <debian-boot@lists.debian.org>:
Bug#239111; Package installation-reports. Full text and rfc822 format available.

Acknowledgement sent to asjo@koldfront.dk (Adam Sjøgren):
New Bug report received and forwarded. Copy sent to Debian Install Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: asjo@koldfront.dk (Adam Sjøgren)
To: submit@bugs.debian.org
Subject: Install report: Successful install
Date: Sun, 21 Mar 2004 00:08:48 +0100
Package: installation-reports

INSTALL REPORT

Debian-installer-version: Beta 3, downloaded on 2004-03-19 from http://www.debian.org/devel/debian-installer/
uname -a: Linux topper 2.4.25-1-386 #1 Tue Feb 24 08:11:13 EST 2004 i686 GNU/Linux
Date: 2004-03-20 18:00
Method: 100 MB CD Image.

Machine: Shuttle mini PC
Processor: Intel(R) Pentium(R) 4 CPU 2.40GHz
Memory: 512 MB
Root Device: IDE, hda
Root Size/partition table:
 /dev/hda1              59M  9.1M   47M  17% /boot  - ext3
 /dev/hda2              56G  438M   56G   1% /      - XFS
(I was surprised that the installer asked me not to have /boot on an
XFS-partition; that has never been a problem before (with lilo)).
Output of lspci:
00:00.0 Host bridge: Silicon Integrated Systems [SiS] SiS651 Host (rev 01)
00:01.0 PCI bridge: Silicon Integrated Systems [SiS] SiS 530 Virtual PCI-to-PCI bridge (AGP)
00:02.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 (rev 04)
00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE]
00:02.7 Multimedia audio controller: Silicon Integrated Systems [SiS] Sound Controller (rev a0)
00:03.0 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 0f)
00:03.1 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 0f)
00:03.2 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 0f)
00:0f.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:10.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 46)
01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] SiS650/651/M650/740 PCI/AGP VGA Display Adapter

Base System Installation Checklist:
[O] = OK, [E] = Error (please elaborate below), [ ] = didn't try it

Initial boot worked:    [O]
Configure network HW:   [O]
Config network:         [O]
Detect CD:              [O]
Load installer modules: [O]
Detect hard drives:     [O]
Partition hard drives:  [O]
Create file systems:    [O]
Mount partitions:       [O]
Install base system:    [O]
Install boot loader:    [O]
Reboot:                 [O]

Comments/Problems:

I think the installer automatically used DHCP, which wasn't what I
wanted. If I was asked, I must've hit enter too quickly. I think it
ought to ask.

I was surprised to see grub being installed - especially if it has
problems with /boot on XFS.

When grub was installing itself, the progress bar sat at 40% for quite
a while. I was beginning to think that the machine might have frozen,
but gave it some more time and it continued without problem.

Other than that; nice!


  Best regards,

-- 
 "Mr. Cotton's... parrot. Same question."                     Adam Sjøgren
                                                         asjo@koldfront.dk



Bug reassigned from package `installation-reports' to `grub'. Request was from David Härdeman <david@2gen.com> to control@bugs.debian.org. Full text and rfc822 format available.

Changed Bug title. Request was from David Härdeman <david@2gen.com> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: d-i Request was from David Härdeman <david@2gen.com> to control@bugs.debian.org. Full text and rfc822 format available.

Merged 239111 243835. Request was from David Härdeman <david@2gen.com> to control@bugs.debian.org. Full text and rfc822 format available.

Merged 239111 243835 246111. Request was from Joey Hess <joeyh@debian.org> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to martin f krafft <madduck@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #20 received at 239111@bugs.debian.org (full text, mbox):

From: martin f krafft <madduck@debian.org>
To: 254919@bugs.debian.org
Cc: 239111@bugs.debian.org, 246111-quiet@bugs.debian.org, 243835-quiet@bugs.debian.org
Subject: Re: your mail
Date: Thu, 17 Jun 2004 23:11:45 +0200
[Message part 1 (text/plain, inline)]
tags 239111 + patch
tags 246111 + patch
tags 243835 + patch
thanks

> 4. When grub installs, it displays a notice that it may take a long
>    time in text mode. I think this should also be displayed by d-i
>    so as to not confuse users.
> 
> 5. Grub actually doesn't install. It hangs at 50% of 'grub-install
>    (hd0)'. The console says it's probing BIOS drives. And it has
>    been for 20 minutes...
> 
>    NOTE: This seems to be related to XFS and is a known bug in Grub.
>    Killing grub-install from the console and restarting it from the
>    menu does the trick.

The following patch seems to fix this by calling sync just before
invoking the grub shell:

--- grub-install.orig   2004-06-17 23:05:52.000000000 +0200
+++ grub-install        2004-06-17 23:11:20.000000000 +0200
@@ -446,6 +446,10 @@
 # Create a safe temporary file.
 test -n "$mklog" && log_file=`$mklog`
 
+# Sync the filesystem to help XFS (and possibly others) to find the
+# stageX files (see Debian bugs #239111, #246111, #243835)
+/bin/sync
+
 # Now perform the installation.
 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
 root $root_drive

Cheers,

-- 
Please do not CC me when replying to lists; I read them!
 
 .''`.     martin f. krafft <madduck@debian.org>
: :'  :    proud Debian developer, admin, and user
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP subkeys? Use subkeys.pgp.net as keyserver!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Bastian Blank <waldi@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #25 received at 239111@bugs.debian.org (full text, mbox):

From: Bastian Blank <waldi@debian.org>
To: martin f krafft <madduck@debian.org>, 254919@bugs.debian.org
Cc: 239111@bugs.debian.org, 246111-quiet@bugs.debian.org, 243835-quiet@bugs.debian.org
Subject: Re: Bug#254919: your mail
Date: Fri, 18 Jun 2004 11:10:38 +0200
[Message part 1 (text/plain, inline)]
On Thu, Jun 17, 2004 at 11:11:45PM +0200, martin f krafft wrote:
> +# Sync the filesystem to help XFS (and possibly others) to find the
> +# stageX files (see Debian bugs #239111, #246111, #243835)
> +/bin/sync

Never use absolute paths.

Bastian

-- 
Live long and prosper.
		-- Spock, "Amok Time", stardate 3372.7
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #30 received at 239111@bugs.debian.org (full text, mbox):

From: Steve Langasek <vorlon@debian.org>
To: Bastian Blank <waldi@debian.org>, 254919@bugs.debian.org
Cc: 239111@bugs.debian.org, 246111-quiet@bugs.debian.org, 243835-quiet@bugs.debian.org
Subject: Re: Bug#254919: your mail
Date: Fri, 18 Jun 2004 10:36:26 -0500
[Message part 1 (text/plain, inline)]
On Fri, Jun 18, 2004 at 11:10:38AM +0200, Bastian Blank wrote:
> On Thu, Jun 17, 2004 at 11:11:45PM +0200, martin f krafft wrote:
> > +# Sync the filesystem to help XFS (and possibly others) to find the
> > +# stageX files (see Debian bugs #239111, #246111, #243835)
> > +/bin/sync

> Never use absolute paths.

It is also questionable whether sync is sufficient to get the data on
disk into a state where grub can make use of it.  The necessary command
seems to be xfs_freeze, as previously discussed on-list.

-- 
Steve Langasek
postmodern programmer
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <zeratul2@wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #35 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <zeratul2@wanadoo.es>
To: Steve Langasek <vorlon@debian.org>, 239111@bugs.debian.org
Subject: Re: Bug#239111: Bug#254919: your mail
Date: Wed, 23 Jun 2004 20:33:56 +0200
tags 239111 confirmed
thanks

On Fri, Jun 18, 2004 at 10:36:26AM -0500, Steve Langasek wrote:
> On Fri, Jun 18, 2004 at 11:10:38AM +0200, Bastian Blank wrote:
> > On Thu, Jun 17, 2004 at 11:11:45PM +0200, martin f krafft wrote:
> > > +# Sync the filesystem to help XFS (and possibly others) to find the
> > > +# stageX files (see Debian bugs #239111, #246111, #243835)
> > > +/bin/sync
> 
> > Never use absolute paths.
> 
> It is also questionable whether sync is sufficient to get the data on
> disk into a state where grub can make use of it.  The necessary command
> seems to be xfs_freeze, as previously discussed on-list.

That means we should call "sync" and then call "xfs_freeze" if it is found
in path, right?

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T., Ainulindale (Silmarillion)



Tags added: confirmed Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <zeratul2@wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #42 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <zeratul2@wanadoo.es>
To: 239111@bugs.debian.org
Subject: upstream
Date: Thu, 24 Jun 2004 08:51:45 +0200
tags 239111 - confirmed
tags 239111 moreinfo
tags 239111 upstream
thanks

Btw, I'll commit this upstream when confirmed.

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T., Ainulindale (Silmarillion)



Tags added: moreinfo Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Tags removed: confirmed Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: upstream Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #53 received at 239111@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Robert Millan <zeratul2@wanadoo.es>, 239111@bugs.debian.org
Subject: Re: Bug#239111: Bug#254919: your mail
Date: Thu, 24 Jun 2004 01:37:04 -0400
[Message part 1 (text/plain, inline)]
Robert Millan wrote:
> tags 239111 confirmed
> thanks
> 
> On Fri, Jun 18, 2004 at 10:36:26AM -0500, Steve Langasek wrote:
> > On Fri, Jun 18, 2004 at 11:10:38AM +0200, Bastian Blank wrote:
> > > On Thu, Jun 17, 2004 at 11:11:45PM +0200, martin f krafft wrote:
> > > > +# Sync the filesystem to help XFS (and possibly others) to find the
> > > > +# stageX files (see Debian bugs #239111, #246111, #243835)
> > > > +/bin/sync
> > 
> > > Never use absolute paths.
> > 
> > It is also questionable whether sync is sufficient to get the data on
> > disk into a state where grub can make use of it.  The necessary command
> > seems to be xfs_freeze, as previously discussed on-list.
> 
> That means we should call "sync" and then call "xfs_freeze" if it is found
> in path, right?

You should check to see if the filesystem containing boot/grub is an
XFS filesystem. If so, run xfs_freeze -f on the mount point of that
filesystem before running grub, and then xfs_freeze -u afterwards. A
sync before the freeze will not solve the problem (in my testing) but
can't hurt.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <zeratul2@wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #58 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <zeratul2@wanadoo.es>
To: Joey Hess <joeyh@debian.org>
Cc: 239111@bugs.debian.org
Subject: Re: Bug#239111: Bug#254919: your mail
Date: Thu, 24 Jun 2004 16:20:19 +0200
tags 239111 - moreinfo
thanks

On Thu, Jun 24, 2004 at 01:37:04AM -0400, Joey Hess wrote:
> > 
> > That means we should call "sync" and then call "xfs_freeze" if it is found
> > in path, right?
> 
> You should check to see if the filesystem containing boot/grub is an
> XFS filesystem. If so, run xfs_freeze -f on the mount point of that
> filesystem before running grub, and then xfs_freeze -u afterwards. A
> sync before the freeze will not solve the problem (in my testing) but
> can't hurt.

Ok. Thanks Joey.

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T., Ainulindale (Silmarillion)



Tags removed: moreinfo Request was from Robert Millan <zeratul2@wanadoo.es> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub-Devel <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #65 received at 239111@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Robert Millan <zeratul2@wanadoo.es>
Cc: 239111@bugs.debian.org
Subject: Re: Bug#239111: Bug#254919: your mail
Date: Thu, 24 Jun 2004 12:16:27 -0400
[Message part 1 (text/plain, inline)]
Robert Millan wrote:
> tags 239111 - moreinfo
> thanks
> 
> On Thu, Jun 24, 2004 at 01:37:04AM -0400, Joey Hess wrote:
> > > 
> > > That means we should call "sync" and then call "xfs_freeze" if it is found
> > > in path, right?
> > 
> > You should check to see if the filesystem containing boot/grub is an
> > XFS filesystem. If so, run xfs_freeze -f on the mount point of that
> > filesystem before running grub, and then xfs_freeze -u afterwards. A
> > sync before the freeze will not solve the problem (in my testing) but
> > can't hurt.
> 
> Ok. Thanks Joey.

Also, if you need anything tested, I can fairly easily test a new
grub-install script with XFS in a d-i install.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <zeratul2@wanadoo.es>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #70 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <zeratul2@wanadoo.es>
To: 239111@bugs.debian.org
Cc: joeyh@debian.org
Subject: Patch for xfs_freeze
Date: Tue, 20 Jul 2004 22:06:20 +0200
[Message part 1 (text/plain, inline)]
Hi!

I think this should do it. Joey, could you test the attached patch?

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T., Ainulindale (Silmarillion)
[xfs.diff (text/plain, attachment)]

Reply sent to Robert Millan <rmh@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to asjo@koldfront.dk (Adam Sjøgren):
Bug acknowledged by developer. Full text and rfc822 format available.

Message #75 received at 239111-close@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@debian.org>
To: 239111-close@bugs.debian.org
Subject: Bug#239111: fixed in grub 0.95+cvs20040624-7
Date: Mon, 26 Jul 2004 18:02:12 -0400
Source: grub
Source-Version: 0.95+cvs20040624-7

We believe that the bug you reported is fixed in the latest version of
grub, which is due to be installed in the Debian FTP archive:

grub-disk_0.95+cvs20040624-7_all.deb
  to pool/main/g/grub/grub-disk_0.95+cvs20040624-7_all.deb
grub-doc_0.95+cvs20040624-7_all.deb
  to pool/main/g/grub/grub-doc_0.95+cvs20040624-7_all.deb
grub_0.95+cvs20040624-7.diff.gz
  to pool/main/g/grub/grub_0.95+cvs20040624-7.diff.gz
grub_0.95+cvs20040624-7.dsc
  to pool/main/g/grub/grub_0.95+cvs20040624-7.dsc
grub_0.95+cvs20040624-7_i386.deb
  to pool/main/g/grub/grub_0.95+cvs20040624-7_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 239111@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Robert Millan <rmh@debian.org> (supplier of updated grub package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon, 26 Jul 2004 23:39:43 +0200
Source: grub
Binary: grub-disk grub grub-doc
Architecture: source i386 all
Version: 0.95+cvs20040624-7
Distribution: unstable
Urgency: low
Maintainer: Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>
Changed-By: Robert Millan <rmh@debian.org>
Description: 
 grub       - GRand Unified Bootloader
 grub-disk  - GRUB bootable disk image
 grub-doc   - Documentation for GRand Unified Bootloader
Closes: 239111 261447 261570
Changes: 
 grub (0.95+cvs20040624-7) unstable; urgency=low
 .
   * patches/xfs_freeze.diff: New. Fix grub-install for XFS. (Closes: #239111)
   * update-grub: s/local tmp//g. Thanks again, David. (Closes: #261570)
   * patches/raid_cciss.diff: New. Support for CCISS devices. (Closes: #261447)
   * Use type-handling to auto-generate dpkg archlist for i386 cpus.
     - control.in: New. Set 'Architecture: @i386@' and add type-handling to
       Build-Depends.
     - rules: Auto-generate debian/control in clean target.
Files: 
 9ecc6a0fede724c8ad247ce8230875ec 857 admin optional grub_0.95+cvs20040624-7.dsc
 4256f9d5f1f6dc4f593925826af04dfd 53203 admin optional grub_0.95+cvs20040624-7.diff.gz
 1c34fb89807fb51fe1fa35cf8116863a 348762 admin optional grub_0.95+cvs20040624-7_i386.deb
 e6878cb78f5c8c2e1800e330cffcf4b5 226464 admin optional grub-disk_0.95+cvs20040624-7_all.deb
 49e59bf4d82798334d3d59ba317164a3 259142 doc optional grub-doc_0.95+cvs20040624-7_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBBXzdC19io6rUCv8RAs89AJ4sKpKGMlMypKgZ5XwtxuVizGrr3QCfWp73
FXfT9xAfiT9p5NlYhNT6do8=
=pidC
-----END PGP SIGNATURE-----




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Euan MacGregor <e.r.macgregor@warwick.ac.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #80 received at 239111@bugs.debian.org (full text, mbox):

From: Euan MacGregor <e.r.macgregor@warwick.ac.uk>
To: 239111@bugs.debian.org
Cc: control@bugs.debian.org, debian-boot@lists.debian.org
Subject: Not fixed when I tested it
Date: Mon, 9 Aug 2004 16:27:18 +0100
reopen 239111
thanks

(Side note: the version that claims to have fixed it wasn't present with
the release candidate version of d-i, so this was using a sid snapshot image
from 20040807)

When trying to install Debian with an XFS root partion, it still hangs when
running grub-intall.

Thanks,

Euan.



Bug reopened, originator not changed. Request was from Euan MacGregor <e.r.macgregor@warwick.ac.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #87 received at 239111@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Euan MacGregor <e.r.macgregor@warwick.ac.uk>
Cc: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Not fixed when I tested it
Date: Mon, 9 Aug 2004 18:00:25 -0300
[Message part 1 (text/plain, inline)]
Euan MacGregor wrote:
> reopen 239111
> thanks
> 
> (Side note: the version that claims to have fixed it wasn't present with
> the release candidate version of d-i, so this was using a sid snapshot image
> from 20040807)

I'm afraid I can reproduce this too. With grub -7, the xfs_freeze stuff
does happen, but the result seems to be that the grub command gets stuck
in an uninterruptable sleep. I tried thawing the xfs partition after a
few minutes, and grub happily continued with the install. I see the same
kind of hang if I freeze an XFS partition and then try to write to it,
so it seems like running the grub command must somehow be writing to the
XFS partition as well as accessing it directly. It's seems we're damed
if we do, and damned if we don't... 

FWIW, my test was with a system that had a single XFS partition for the
whole root filesystem, including /boot.

I thought perhaps it was the redirection of grub's output to a log file
by grub-install, since writing to a log file when XFS is frozen could
hang. But even after removing the redirection to $log_file, it still
hangs. :-(

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <rmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #92 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@debian.org>
To: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Sat, 14 Aug 2004 18:42:19 +0200
On Mon, Aug 09, 2004 at 06:00:25PM -0300, Joey Hess wrote:
> 
> I'm afraid I can reproduce this too. With grub -7, the xfs_freeze stuff
> does happen, but the result seems to be that the grub command gets stuck
> in an uninterruptable sleep. I tried thawing the xfs partition after a
> few minutes, and grub happily continued with the install. I see the same
> kind of hang if I freeze an XFS partition and then try to write to it,
> so it seems like running the grub command must somehow be writing to the
> XFS partition as well as accessing it directly. It's seems we're damed
> if we do, and damned if we don't... 
> 
> FWIW, my test was with a system that had a single XFS partition for the
> whole root filesystem, including /boot.
> 
> I thought perhaps it was the redirection of grub's output to a log file
> by grub-install, since writing to a log file when XFS is frozen could
> hang. But even after removing the redirection to $log_file, it still
> hangs. :-(

Hi Joey,

Could you try to mount / as readonly before grub-install is run?

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #97 received at 239111@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Robert Millan <rmh@debian.org>
Cc: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Sat, 14 Aug 2004 17:39:08 -0300
[Message part 1 (text/plain, inline)]
Robert Millan wrote:
> On Mon, Aug 09, 2004 at 06:00:25PM -0300, Joey Hess wrote:
> > 
> > I'm afraid I can reproduce this too. With grub -7, the xfs_freeze stuff
> > does happen, but the result seems to be that the grub command gets stuck
> > in an uninterruptable sleep. I tried thawing the xfs partition after a
> > few minutes, and grub happily continued with the install. I see the same
> > kind of hang if I freeze an XFS partition and then try to write to it,
> > so it seems like running the grub command must somehow be writing to the
> > XFS partition as well as accessing it directly. It's seems we're damed
> > if we do, and damned if we don't... 
> > 
> > FWIW, my test was with a system that had a single XFS partition for the
> > whole root filesystem, including /boot.
> > 
> > I thought perhaps it was the redirection of grub's output to a log file
> > by grub-install, since writing to a log file when XFS is frozen could
> > hang. But even after removing the redirection to $log_file, it still
> > hangs. :-(
> 
> Hi Joey,
> 
> Could you try to mount / as readonly before grub-install is run?

Doesn't grub-install copy things into /boot? My /boot was on the root
filesystem in the test that I did.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <rmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #102 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@debian.org>
To: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Sun, 15 Aug 2004 01:44:46 +0200
On Sat, Aug 14, 2004 at 05:39:08PM -0300, Joey Hess wrote:
> Robert Millan wrote:
> > 
> > Could you try to mount / as readonly before grub-install is run?
> 
> Doesn't grub-install copy things into /boot? My /boot was on the root
> filesystem in the test that I did.

True.  It was just me being silly.

I still don't understand why the current solution doesn't work.  xfs_freeze
suposedly puts the filesystem in a state that all write requests are blocked.

Am I missing something?

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #107 received at 239111@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Robert Millan <rmh@debian.org>
Cc: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Sat, 14 Aug 2004 23:22:45 -0300
[Message part 1 (text/plain, inline)]
Robert Millan wrote:
> I still don't understand why the current solution doesn't work.  xfs_freeze
> suposedly puts the filesystem in a state that all write requests are blocked.
> 
> Am I missing something?

xfs_freeze is definitly causing all write to block. Apparently something
in grub-installer must then be doing a write while the filesystem is
frozen. I don't know for sure what it is; I suspect it may be more than
one thing. One place that seems likely to write and block is the
redirection of $grub_shell to $log_file. Since removing that one doesn't
fix it, I'm left assuming that running $grub_shell itself somehow causes
a write, and thus a freeze. Maybe getting strace on there and stracing
it would help.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <rmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #112 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@debian.org>
To: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Sun, 15 Aug 2004 04:44:57 +0200
On Sat, Aug 14, 2004 at 11:22:45PM -0300, Joey Hess wrote:
> Robert Millan wrote:
> > I still don't understand why the current solution doesn't work.  xfs_freeze
> > suposedly puts the filesystem in a state that all write requests are blocked.
> > 
> > Am I missing something?
> 
> xfs_freeze is definitly causing all write to block. Apparently something
> in grub-installer must then be doing a write while the filesystem is
> frozen. I don't know for sure what it is; I suspect it may be more than
> one thing. One place that seems likely to write and block is the
> redirection of $grub_shell to $log_file. Since removing that one doesn't
> fix it, I'm left assuming that running $grub_shell itself somehow causes
> a write, and thus a freeze. Maybe getting strace on there and stracing
> it would help.

The grub shell needs to write to /dev/hda for grabbing stage files into the
boot sector (see lib/device.c in grub source code).

Maybe what we want is to hack grub so that is freezes the filesystem only when
it's time to, instead of reliing on grub-install to do that.  However, this
calls for a C interface that is equivalent to xfs_freeze.  Is there a library
or something?

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #117 received at 239111@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Robert Millan <rmh@debian.org>
Cc: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Sun, 15 Aug 2004 11:51:16 -0300
[Message part 1 (text/plain, inline)]
Robert Millan wrote:
> The grub shell needs to write to /dev/hda for grabbing stage files into the
> boot sector (see lib/device.c in grub source code).

But that write doesn't go through xfs surely. Is there any filesystem
writing involved?

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <rmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #122 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@debian.org>
To: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Not fixed when I tested it
Date: Thu, 19 Aug 2004 13:00:01 +0200
tags 239111 help
thanks

On Sun, Aug 15, 2004 at 11:51:16AM -0300, Joey Hess wrote:
> Robert Millan wrote:
> > The grub shell needs to write to /dev/hda for grabbing stage files into the
> > boot sector (see lib/device.c in grub source code).
> 
> But that write doesn't go through xfs surely. Is there any filesystem
> writing involved?

AFAIK (i.e. as far as my understanding of GRUB dessign goes), there's no
filesystem write involved in that.  There are userspace filesystem _reads_
and userspace raw _writes_, but that's all.

For what GRUB is concerned, I don't think there's any kernel filesystem
access involved either, but if such happens for other reasons it might fuck
the userspace filesystem reads done by GRUB, which is probably the source
of the problem.

This is going beyond me now.  I'm tagging the bug as "help".  Probably worthy
for an XFS guru, but not for me :(

-- 
Robert Millan

(Debra and Ian) (Gnu's Not (UNiplexed Information and Computing System))/\
(kernel of *(Berkeley Software Distribution))



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Joshua Kwan <joshk@triplehelix.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #127 received at 239111@bugs.debian.org (full text, mbox):

From: Joshua Kwan <joshk@triplehelix.org>
To: 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Followup
Date: Wed, 25 Aug 2004 10:04:30 -0700
[Message part 1 (text/plain, inline)]
I was reinstalling my laptop yesterday and ran into this problem. I
found that replacing all the xfs_freeze stuff with a single call of
'sync;sync;sync' would not cause the deadlock.

Perhaps it is sufficient to freeze, then unfreeze the filesystem?

-- 
Joshua Kwan
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <rmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #132 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@debian.org>
To: joshk@triplehelix.org, 239111@bugs.debian.org, debian-boot@lists.debian.org
Subject: Re: Bug#239111: Followup
Date: Tue, 31 Aug 2004 08:24:36 +0200
On Wed, Aug 25, 2004 at 10:04:30AM -0700, Joshua Kwan wrote:
> I was reinstalling my laptop yesterday and ran into this problem. I
> found that replacing all the xfs_freeze stuff with a single call of
> 'sync;sync;sync' would not cause the deadlock.
> 
> Perhaps it is sufficient to freeze, then unfreeze the filesystem?

Could you be more specific?  (In particular, a tested patch would help)

-- 
 .''`.   Proudly running Debian GNU/kFreeBSD unstable/unreleased (on UFS2+S)
: :' :
`. `'    http://www.debian.org/ports/freebsd/gnu-libc-based
  `-



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to khurram <khurram@rcn.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>.

Your message did not contain a Subject field. They are recommended and useful because the title of a Bug is determined using this field. Please remember to include a Subject field in your messages in future.

Full text and rfc822 format available.


Message #137 received at 239111@bugs.debian.org (full text, mbox):

From: khurram <khurram@rcn.com>
To: 239111@bugs.debian.org
Date: Wed, 13 Oct 2004 15:58:11 -0000
Has this bug been fixed in 0.95+cvs20040624-9?  Grub still seems to hang  
and ps -aux shows it in a 'uninterreptuble sleep'.  Only way to get out of  
that is rebooting.



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Gregor Jasny <gjasny@web.de>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #142 received at 239111@bugs.debian.org (full text, mbox):

From: Gregor Jasny <gjasny@web.de>
To: 239111@bugs.debian.org
Subject: grub-install still hangs
Date: Tue, 5 Apr 2005 22:50:41 +0200
Hi,

today I've migrated my system from ext3 to xfs. When I tried to install grub 
via grub-install --recheck /dev/hda the install process hangs. An apt-get 
update process in another terminal began to hang too. I think it tried to 
write into the frozen root filesystem. So I opened a new terminal and 
executed xfs_freeze -u /boot/grub. After this command my system was working 
again.

Imho grub tries to write to some file in the root filesystem during install 
(i.e. a new device map). Because the filesystem is frozen it deadlocks.

If you need more info please contact me.

Cheers,
Gregor



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to David Everly <deckrider@gmail.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #147 received at 239111@bugs.debian.org (full text, mbox):

From: David Everly <deckrider@gmail.com>
To: 239111@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Robert Millan <zeratul2@wanadoo.es>
Subject: grub and xfs
Date: Mon, 25 Apr 2005 10:58:19 -0600
[Message part 1 (text/plain, inline)]
I have a Debian/Sarge installation (completely up to date as of today)
on which I can reproduce the hanging problem.  I have only one XFS
partition on which to boot and run Debian/Sarge.

Please note that I don't understand a lot of this, but I made some
changes to /sbin/grub-install and it seems to no longer hang.  However,
my system was fairly quiet when I did the test.

Also it would be better to somehow test if /boot/grub is on an XFS
filesystem, and if so, run xfs_magic.  But I don't know how to do this.

My test was to 'rm -r /boot/grub' and then run 'grub-install /dev/hda'.

Here is my version of grub-install which seems to work.

-- 
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                                
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html
[grub-install (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to David Everly <deckrider@gmail.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #152 received at 239111@bugs.debian.org (full text, mbox):

From: David Everly <deckrider@gmail.com>
To: 239111@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>
Subject: Re: grub and xfs
Date: Mon, 25 Apr 2005 12:12:26 -0600
[Message part 1 (text/plain, inline)]
Sorry, but I realized after reading ...

    http://lists.debian.org/debian-boot/2004/06/msg02301.html

... that what I was doing was a little overkill.

Here is a better approach.  I've tested it both on ext3 (to ensure I
haven't broken something when xfs_freeze exists, but the filesystem is
not xfs), and xfs.

Here is xfs_freeze.diff, suitable for replacing xfs_freeze.diff that is
in debian/patches of the source package.

-- 
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                                
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html
[xfs_freeze.diff (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]

Tags added: patch Request was from David Everly <deckrider@gmail.com> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to David Everly <deckrider@gmail.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #159 received at 239111@bugs.debian.org (full text, mbox):

From: David Everly <deckrider@gmail.com>
To: 239111@bugs.debian.org
Cc: Joey Hess <joeyh@debian.org>
Subject: my grub/xfs patch was no good
Date: Mon, 25 Apr 2005 16:55:06 -0600
[Message part 1 (text/plain, inline)]
tags 239111 - patch
thanks

Sorry, but after more testing, it seems my patch is no good.  It only
works inconsistently.

Sorry for the bother.

-- 
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                                
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html
[signature.asc (application/pgp-signature, inline)]

Tags removed: patch Request was from David Everly <deckrider@gmail.com> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to David Everly <deckrider@gmail.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #166 received at 239111@bugs.debian.org (full text, mbox):

From: David Everly <deckrider@gmail.com>
To: 239111@bugs.debian.org, 243835@bugs.debian.org, 246111@bugs.debian.org, control@bugs.debian.org
Subject: new version of xfs_freeze.diff
Date: Fri, 29 Apr 2005 11:37:44 -0600
[Message part 1 (text/plain, inline)]
tags 239111 + patch
tags 246111 + patch
tags 243835 + patch
thanks

I'm attaching a new version of xfs_freeze.diff which can replace the
current one in the sarge version of grub (debian/patches).

For xfs, in theory it is only needed to run 'xfs_freeze -f' followed
immediately by 'xfs_freeze -u'.  This is because xfs_freeze is not
supposed to return until disk I/O is complete.  However, this is
currently not the case with kernel-image-2.6.8-2-686 2.6.8-13:

   http://bugs.debian.org/306966

So this patch defaults to a 20 second sleep (which is what consistently
works on my systems), but has a new option (--sync-sleep) to customize
the sleep time.

In any case, the existing approach which tries to freeze, run a grub
shell, and then unfreeze really needs to be corrected, since it will
ALWAYS hang a system that is a single XFS partition for everything.

-- 
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                                
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html
[xfs_freeze.diff (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]

Tags added: patch Request was from David Everly <deckrider@gmail.com> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: patch Request was from David Everly <deckrider@gmail.com> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: patch Request was from David Everly <deckrider@gmail.com> to control@bugs.debian.org. Full text and rfc822 format available.

Merged 239111 243835 246111 309218. Request was from David Everly <deckrider@gmail.com> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to David Everly <deckrider@gmail.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #179 received at 239111@bugs.debian.org (full text, mbox):

From: David Everly <deckrider@gmail.com>
To: 239111@bugs.debian.org, 243835@bugs.debian.org, 246111@bugs.debian.org, 309218@bugs.debian.org
Subject: updated xfs_freeze.diff (--help output improved)
Date: Tue, 21 Jun 2005 07:03:05 -0600
[Message part 1 (text/plain, inline)]
Here is an updated xfs_freeze.diff

It is the same as the previous version, except the output of --help
is a little better.
-- 
Encrypted Mail Preferred:
    Key ID:  8527B9AF
    Key Fingerprint:  E1B6 40B6 B73F 695E 0D3B  644E 6427 DD74 8527 B9AF
    Information:  http://www.gnupg.org/
                                                                                
ASCII ribbon campaign:
()  against HTML email
/\  against Microsoft attachments
    Information:  http://www.expita.com/nomime.html
[xfs_freeze.diff (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Kristian Edlund <ksed02@control.aau.dk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #184 received at 239111@bugs.debian.org (full text, mbox):

From: Kristian Edlund <ksed02@control.aau.dk>
To: 239111@bugs.debian.org
Cc: joeyh@debian.org, deckrider@gmail.com
Subject: XFS status
Date: Fri, 20 Jan 2006 09:11:23 +0100
Hi everyone

Do you know the status of the xfs bug in grub which casues #309218,
#239111, #243835 and #246111. There is a supplied patch, but I do not
have the possibility to test it.

-- 
Best Regards
Kristian Edlund

GPG ID: 7DD7559F



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Otavio Salvador <otavio@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #189 received at 239111@bugs.debian.org (full text, mbox):

From: Otavio Salvador <otavio@debian.org>
To: Kristian Edlund <ksed02@control.aau.dk>
Cc: 239111@bugs.debian.org, deckrider@gmail.com, joeyh@debian.org
Subject: Re: Bug#239111: XFS status
Date: Fri, 20 Jan 2006 10:07:10 -0200
Kristian Edlund <ksed02@control.aau.dk> writes:

> Hi everyone
>
> Do you know the status of the xfs bug in grub which casues #309218,
> #239111, #243835 and #246111. There is a supplied patch, but I do not
> have the possibility to test it.

I hadn't sucess using the suggested patches. All continue to have GRUB
frozen when installing.

I would like to work out an alternative for it but it isn't a high
priority on my TODO list.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://www.freedom.ind.br/otavio
---------------------------------------------
"Microsoft gives you Windows ... Linux gives
 you the whole house."



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Marcin Owsiany <porridge@debian.org>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #194 received at 239111@bugs.debian.org (full text, mbox):

From: Marcin Owsiany <porridge@debian.org>
To: 239111@bugs.debian.org
Subject: Patch partially works
Date: Wed, 15 Feb 2006 14:19:36 +0100
I have just tried David's patch
(http://bugs.debian.org/cgi-bin/bugreport.cgi/xfs_freeze.diff?bug=239111;msg=179;att=1)
on a system with XFS root (no /boot, I was replacing LILO).

When I tried it on a running system, in a gnome-terminal, it hung at
"Trying to sync filesystem, do not interrupt until complete." stage, and
never got to the "Trying to sync filesystem is complete." moment. I
waited a few minutes, the system has gone completly unresponsive.

After reboot, I tried the same in single user mode, and it succeeded.

This was with kernel 2.6.15-1-686

Marcin
-- 
Marcin Owsiany <porridge@debian.org>             http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Robert Millan <rmh@aybabtu.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #199 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: David Everly <deckrider@gmail.com>
Cc: 239111@bugs.debian.org
Subject: GRUB and XFS
Date: Thu, 21 Sep 2006 20:53:40 +0200
Hi,

Would be nice if you could provide a GRUB 2 version of this patch, too.  Could
you please contact upstream (grub-devel@gnu.org) about it?

-- 
Robert Millan

My spam trap is honeypot@aybabtu.com.  Note: this address is only intended for
spam harvesters.  Writing to it will get you added to my black list.



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Peter Gervai <grin@grin.hu>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #204 received at 239111@bugs.debian.org (full text, mbox):

From: Peter Gervai <grin@grin.hu>
To: Debian Bug Tracking System <239111@bugs.debian.org>
Subject: grub: Some explanation, seems to be useful
Date: Tue, 23 Jan 2007 15:54:07 +0100
Package: grub
Version: 0.97-20
Followup-For: Bug #239111

Okay, some background, since I got this error using FAI and
was bitten pretty hard.

grub-install freeze xfs, then executes grub command:
> setup  --stage2=/tmp/target/boot/grub/stage2 --prefix=/boot/grub (hd0)
which in fact does:
 Running "install --stage2=/tmp/target/boot/grub/stage2 /boot/grub/stage1 (hd0) (hd0)1+18 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... 

Tough, because 'p' means to patch stage2, which sits on the partition we
just freezed... so it waits till spring (thawing, ehm :)).

And by the way you try to write a logfile there, too. If /tmp is on the same
partition as /boot, you frozen it just as well. Bad luck.

So we can't keep stage2 frozen, and should not write logfile when frozen.

Patches may have already addressed it, I didn't have the time to read through 
all the bugreports so far, but this is the reason for the trouble.



Tags removed: patch Request was from Robert Millan <rmh@aybabtu.com> to control@bugs.debian.org. (Thu, 03 May 2007 21:18:10 GMT) Full text and rfc822 format available.

Merged 239111 243835 246111 309218 425367. Request was from Robert Millan <rmh@aybabtu.com> to control@bugs.debian.org. (Tue, 29 May 2007 14:00:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to "Adam Cécile (Le_Vert)" <gandalf@le-vert.net>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #213 received at 239111@bugs.debian.org (full text, mbox):

From: "Adam Cécile (Le_Vert)" <gandalf@le-vert.net>
To: 239111@bugs.debian.org
Subject: (pas de sujet)
Date: Mon, 20 Aug 2007 14:13:36 +0200
Hi,

I confirm I've been able to install a lenny system with XFS / and grub 
by doing root (hd0,0) setup (hd0) instead of using grub-install.

For now, everything is fine.



Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Martin Steigerwald <Martin@lichtvoll.de>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #218 received at 239111@bugs.debian.org (full text, mbox):

From: Martin Steigerwald <Martin@lichtvoll.de>
To: 239111@bugs.debian.org
Subject: installing grub via grub shell always worked on XFS on the systems I tried
Date: Mon, 27 Aug 2007 16:25:23 +0200
[Message part 1 (text/plain, inline)]
Hi!

Installing GRUB via grub shell always worked on the systems I tried:

- IBM ThinkPad T42
- IBM ThinkPad T23
- A bunch of different Dell workstations

It already worked with sarge on my T23 and the Dell workstations, I think 
I also have Sarge on my T42 initially.

But grub-install hangs sometimes when being used via a Knoppix CD. It also 
hung on an etch installation I tried recently, which was nasty, as user 
and password information has not yet been written.

Ciao,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. Full text and rfc822 format available.

Acknowledgement sent to Jason White <jason@jasonjgw.net>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #223 received at 239111@bugs.debian.org (full text, mbox):

From: Jason White <jason@jasonjgw.net>
To: 239111@bugs.debian.org
Subject: Discussed on XFS list
Date: Mon, 17 Dec 2007 14:29:43 +1100
I've opened a thread on the XFS list:
http://comments.gmane.org/gmane.comp.file-systems.xfs.general/21395
where Eric Sandeen gives a helpful explanation of the problem.




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Fri, 12 Dec 2008 03:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert McQueen <robot101@hadesian.co.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Fri, 12 Dec 2008 03:48:02 GMT) Full text and rfc822 format available.

Message #228 received at 239111@bugs.debian.org (full text, mbox):

From: Robert McQueen <robot101@hadesian.co.uk>
To: 239111@bugs.debian.org, control@bugs.debian.org
Subject: following etch->lenny grub upgrade instructions locks up a system with XFS root
Date: Fri, 12 Dec 2008 03:43:31 +0000
severity 239111 grave
found 239111 0.97-47
thanks

Sorry to drag this ancient bug up to RC status, but I just got *totally*
screwed by it. I've just upgraded an etch system to lenny, and following
the instructions in grub's NEWS.Debian file, I ran 'grub-install (hd0)'
after verifying my device.map in order to update the bootloader, under
the threat that my system would not be able to boot a >= 2.6.23 kernel.

Unfortunately, because of this grub-install hanging while my XFS root
filesystem is frozen, my entire (remote, headless) system is now
unresponsive on all of the ssh logins I had open to it, as well as on
its serial console, because any login activity ends up trying to write
to disk. (I could sysrq or powercycle it, but I'm not actually certain
whether the bootloader will be intact currently. Thankfully its the dom0
of a Xen system, and the mission-critical domUs are working still, so I
can risk a reboot over the weekend.)

Previously this bug has just been a minor annoyance because under d-i,
you can work around this freeze by going to the shell (which is in
memory in a different filesystem) and killing grub-install, unfreezing
the filesystem, and doing it manually. However, this is the first time
I've been enticed into using grub-install on a live system, and now I've
realised quite what a screwup this actually is. It's moved from a mild
annoyance for deviants like me who insist on choosing grub from the d-i
menu when using an XFS root, to a way to lock-up and potentially even
brick (I can tell you tomorrow evening) a running system.

As I noted, er, four and a half years ago[1], and by many previous
reporters, what the script currently does will *always* fail where /boot
and / are the same filesystem:
 xfs_freeze -f
 grub --bullshit... # tries to write to the filesystem and log file too,
                    # will never make any progress because / is frozen
 xfs_freeze -u
On a live system, not only does this just hang the grub-install process,
but it effectively stops you from being able to log in to fix the
situation too.

1: http://lists.debian.org/debian-boot/2004/06/msg02301.html

Previous reporters have provided patches[2] to change the behaviour to this:
 xfs_freeze -f
 xfs_freeze -u
 grub --bullshit...
The failures of this approach (see below) are that grub might not
succeed in upgrading/installing, or that it might install an older
version of grub. It will, however, never freeze your system.

2:
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=152;filename=xfs_freeze.diff;att=1;bug=239111

Earlier reporters on the bug in 2006 commented that the above doesn't
work reliably. This is due to #306966, which is present in etch's
kernel, and means xfs_freeze -f can return before the data is actually
synced. I've spoken to the XFS developers about this on IRC, and
apparently it was fixed upstream around 2.6.19 or 20. So actually,
applying that patch to re-order things like that will make this freezing
bug go away on lenny kernel system once and for all, and d-i won't need
to force LILO on XFS users any more. :)

However it /will/ re-introduce the race condition so that grub-install
fails when you're running under etch's kernel, but that's /much/ less of
a problem than locking up or bricking the system, because you can work
around it by just installing grub manually. So, definitely for lenny we
must apply a patch which fixes the script to do freeze / unfreeze / grub.

The only remaining issue is then: how old a grub can really not read the
2.6.26 kernel that comes with lenny?

If etch's grub /can/ read lenny's kernel, and it's only /older/ grubs
that have problems, then this race bug will affect a pretty small number
of people. We can just edit NEWS.Debian then to say "If grub-install
fails and you have XFS /boot and etch's kernel, reboot and try it
again". Any people with >3 year old Debian systems with XFS root and
grub are probably able to figure out how to reinstall grub manually.

If etch's grub /can't/ read lenny's kernel, then I guess we need to
provide a smoother migration path for people who are doing as I did and
running grub-install, so we can apply the patch with the sleep
workaround[3] and include a message:
 "If you got a file not found error and use an XFS root filesystem,
  please try re-running grub-install with the --sync-sleep=60 option to
  work around a bug in the 2.6.18 kernel in etch."

3:
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=179;filename=xfs_freeze.diff;att=1;bug=239111

Regards,
Rob

P.S. If we were being "enterprise", we'd probably push an etch kernel
patch which fixed the race condition with xfs_freeze, so people could
reliably upgrade their kernel and grub at the same time before rebooting
into lenny. But, eh, screw it.

P.P.S. The XFS developers would like to take this opportunity to remind
viewers that reading/writing the block device underneath a filesystem is
the true bug here, and that the grub shell should just be made to use
FIBMAP to find the stage 1.5 block list like lilo has done happily for
over 10 years...




Severity set to `grave' from `normal' Request was from Robert McQueen <robot101@hadesian.co.uk> to control@bugs.debian.org. (Fri, 12 Dec 2008 03:48:03 GMT) Full text and rfc822 format available.

Bug marked as found in version 0.97-47. Request was from Robert McQueen <robot101@hadesian.co.uk> to control@bugs.debian.org. (Fri, 12 Dec 2008 03:48:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Sun, 04 Jan 2009 02:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve McIntyre <steve@einval.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Sun, 04 Jan 2009 02:27:02 GMT) Full text and rfc822 format available.

Message #237 received at 239111@bugs.debian.org (full text, mbox):

From: Steve McIntyre <steve@einval.com>
To: 239111@bugs.debian.org
Subject: Grub is shockingly bad code
Date: Sun, 4 Jan 2009 02:25:28 +0000
Thanks to Rob McQueen for doing a lot of research into this for his
mail about this bug on 12 Dec 2008. Based on that mail, I've looked
through the code in an attempt to find a way to implement a reasonable
fix: using FIBMAP as he suggested.

After several hours of working through the source, I give up. It's a
total mess and I'd much rather see grub simply removed from Debian
altogether than fix this bug and allow it to live on. Highlights:

 * gratuitous use of nested functions
 * horrific interfaces that don't pass enough information around
   internally, leading to:
 * functions passing internal state around via umarked global
   variables, relying on side effects
 * significantly obfuscated code
 * the core bug as described by Rob: accessing a block device
   underneath an active filesystem and assuming that the results will
   be safe and/or correct.

I *know* that grub is a bootloader, so it's always going to end up
having some nasty lowlevel code somewhere. But that's no excuse for
the code quality I've just seen. After this experience, I'm about to
remove grub from all my systems. Come back lilo, all is forgiven.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
Is there anybody out there?





Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Sun, 04 Jan 2009 07:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Sun, 04 Jan 2009 07:39:02 GMT) Full text and rfc822 format available.

Message #242 received at 239111@bugs.debian.org (full text, mbox):

From: Ben Hutchings <ben@decadent.org.uk>
To: 239111@bugs.debian.org
Subject: Re: Freeze when installing GRUB on XFS boot partition
Date: Sun, 04 Jan 2009 07:36:54 +0000
[Message part 1 (text/plain, inline)]
The grub shell already does sync() - many times - so I think we can just
change xfs_freeze.diff to:

--- grub-0.97.orig/util/grub-install.in	2004-07-24 19:57:31.000000000 +0100
+++ grub-0.97/util/grub-install.in	2009-01-04 04:57:47.000000000 +0000
@@ -418,6 +418,12 @@
 # Make a default file.
 ${grub_set_default} --root-directory=${rootdir} default
 
+# XFS is special; we must run xfs_freeze to flush files as well as sync
+# (which grub itself does).
+if [ "$(stat -f --printf=%T ${grubdir})" = "xfs" ]; then
+    xfs_freeze -f ${grubdir} && xfs_freeze -u ${grubdir}
+fi
+
 # Make sure that GRUB reads the same images as the host OS.
 test -n "$mkimg" && img_file=`$mkimg`
 test -n "$mklog" && log_file=`$mklog`
--- END ---

It is probably better to use FIBMAP, but it's kind of hard to map a
device name to a mount point.  The following is an attempt to do that.
It does not use the result of FIBMAP but only uses it to force block
allocation.

However, somehow this triggers "Error 28: Selected item cannot fit into
memory".  So it should certainly not be applied, but it may be useful to
anyone who wants to investigate further. 

--- grub-0.97.orig/stage2/disk_io.c	2004-05-23 17:35:24.000000000 +0100
+++ grub-0.97/stage2/disk_io.c	2009-01-04 06:36:26.000000000 +0000
@@ -29,6 +29,17 @@
 
 #ifdef GRUB_UTIL
 # include <device.h>
+# ifdef __linux__
+#   include <errno.h>
+#   include <stdio.h>
+#   include <stdlib.h>
+#   include <sys/types.h>
+#   include <unistd.h>
+#   include <fcntl.h>
+#   include <sys/ioctl.h>
+#   include <sys/stat.h>
+#   include <linux/fs.h>
+# endif
 #endif
 
 /* instrumentation variables */
@@ -1530,6 +1541,124 @@
 #endif /* STAGE1_5 */
 
 
+#if defined(GRUB_UTIL) && defined(__linux__)
+
+static int
+find_mount_point (dev_t block_dev, char **p_mount_point)
+{
+  static char line[256];
+
+  struct stat stats;
+  FILE *mounts;
+  char *begin, *end, *mount_point;
+  int result = -1;
+
+  mounts = fopen ("/proc/mounts", "r");
+  if (!mounts)
+    return -1;
+
+  errno = 0;
+  mount_point = NULL;
+  while (fgets (line, sizeof(line), mounts))
+    {
+      if (line[0] != '/')
+	continue;
+      end = strstr (line, " ");
+      if (!end)
+	goto out_close;
+      *end = 0;
+      if (stat (line, &stats))
+	goto out_close;
+      if (S_ISBLK (stats.st_mode) && stats.st_rdev == block_dev)
+	{
+	  begin = end + 1;
+	  end = strstr (begin, " ");
+	  if (!end)
+	    goto out_close;
+	  *end = 0;
+	  mount_point = malloc (end + 1 - begin);
+	  if (!mount_point)
+	    goto out_close;
+	  strcpy (mount_point, begin);
+	  break;
+	}
+    }
+  if (errno == 0)
+    {
+      free (*p_mount_point);
+      *p_mount_point = mount_point;
+      result = 0;
+    }
+
+ out_close:
+  fclose(mounts);
+  return result;
+}
+
+/*
+ * If filename is on a mounted filesystem, get its block list, forcing
+ * block allocation on a filesystem with deferred allocation.
+ */
+static int
+map_file (char *filename)
+{
+  static char *mount_point;
+  static dev_t cached_block_dev;
+  static char full_filename[PATH_MAX];
+
+  dev_t block_dev;
+  int block_fd = buf_geom.flags, fd;
+  struct stat stats;
+  unsigned long block_num;
+  int result = -1;
+
+  if (fstat (block_fd, &stats) || !S_ISBLK (stats.st_mode))
+    return -1;
+
+  block_dev = stats.st_rdev;
+  if ((current_partition & 0x00FF00) == 0x00FF00)
+    block_dev += ((current_partition >> 16) & 0xFF) + 1;
+  if (block_dev != cached_block_dev &&
+      find_mount_point(block_dev, &mount_point))
+    return -1;
+  cached_block_dev = block_dev;
+
+  if (!mount_point)
+    return 0;
+
+  if (snprintf (full_filename, sizeof(full_filename),
+		"%s%s", mount_point, filename) >=
+      sizeof(full_filename))
+    return -1;
+  fd = open (full_filename, O_RDONLY);
+  if (fd < 0)
+    return -1;
+
+  if (fstat (fd, &stats))
+    goto out_close;
+  for (block_num = 0;
+       block_num < (stats.st_size + stats.st_blksize - 1) / stats.st_blksize;
+       block_num++)
+    if (ioctl (fd, FIBMAP, &block_num) < 0)
+      goto out_close;
+  result = 0;
+
+ out_close:
+  close (fd);
+  return result;
+}
+
+#else /* !(GRUB_UTIL && __linux__) */
+
+static int
+map_file (char *filename)
+{
+  return 0;
+}
+
+#endif /* GRUB_UTIL && __linux__ */
+
+
 /*
  *  This is the generic file open function.
  */
@@ -1622,6 +1751,11 @@
       errnum = ERR_BAD_FILENAME;
 #endif /* NO_BLOCK_FILES */
     }
+  else /* normal filename */
+    {
+      if (map_file (filename))
+	errnum = ERR_DEV_VALUES;
+    }
 
   if (!errnum && fsys_type == NUM_FSYS)
     errnum = ERR_FSYS_MOUNT;
--- END ---

Ben.

-- 
Ben Hutchings
[W]e found...that it wasn't as easy to get programs right as we had thought.
... I realized that a large part of my life from then on was going to be spent
in finding mistakes in my own programs. - Maurice Wilkes, 1949
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Sun, 04 Jan 2009 20:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Sun, 04 Jan 2009 20:00:02 GMT) Full text and rfc822 format available.

Message #247 received at 239111@bugs.debian.org (full text, mbox):

From: Ben Hutchings <ben@decadent.org.uk>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: 239111@bugs.debian.org
Subject: Re: Freeze when installing GRUB on XFS boot partition
Date: Sun, 04 Jan 2009 19:56:56 +0000
[Message part 1 (text/plain, inline)]
Here's another possibility: don't run xfs_freeze at all but instead run
a separate program that does ioctl(FIBMAP).  This works for me on ext3
in that it doesn't break installation.  Please can you test this with a
fresh installation of grub on XFS?

diff -urN grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in
--- grub-0.97.orig/util/grub-install.in	2004-07-24 19:57:31.000000000 +0100
+++ grub-0.97/util/grub-install.in	2009-01-04 19:26:31.000000000 +0000
@@ -30,6 +30,7 @@
 pkglibdir=${libdir}/${PACKAGE}/${host_cpu}-${host_vendor}
 
 grub_shell=${sbindir}/grub
+grub_map_file=${sbindir}/grub-map-file
 grub_set_default=${sbindir}/grub-set-default
 log_file=/tmp/grub-install.log.$$
 img_file=/tmp/grub-install.img.$$
@@ -471,6 +472,7 @@
 test -n "$mklog" && log_file=`$mklog`
 
 for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
+    $grub_map_file $file || exit 1
     count=5
     tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"`
     while test $count -gt 0; do
diff -urN grub-0.97.orig/util/grub-map-file.c grub-0.97/util/grub-map-file.c
--- grub-0.97.orig/util/grub-map-file.c	1970-01-01 01:00:00.000000000 +0100
+++ grub-0.97/util/grub-map-file.c	2009-01-04 19:19:44.000000000 +0000
@@ -0,0 +1,76 @@
+/* grub-map-file - force block-mapping for a file using ioctl(FIBMAP) */
+/*
+ *  Copyright (C) 2008  Ben Hutchings <ben@decadent.org.uk>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define _FILE_OFFSET_BITS 64
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <linux/fs.h>
+
+int
+main (int argc, char **argv)
+{
+  int fd;
+  struct stat stats;
+  unsigned long n, i;
+
+  if (argc != 2)
+    {
+      fprintf (stderr, "Usage: grub-map-file FILENAME\n");
+      exit (2);
+    }
+
+  fd = open (argv[1], O_RDONLY);
+  if (fd < 0)
+    {
+      fprintf (stderr, "grub-map-file: open %s: %s\n",
+		argv[1], strerror (errno));
+      exit (1);
+    }
+
+  if (fstat (fd, &stats))
+    {
+      fprintf (stderr, "grub-map-file: stat %s: %s\n",
+		argv[1], strerror (errno));
+      exit (1);
+    }
+  n = (stats.st_size + stats.st_blksize - 1) / stats.st_blksize;
+
+  for (i = 0; i < n; i++)
+    {
+      unsigned long temp = i;
+      if (ioctl (fd, FIBMAP, &temp))
+	{
+	  fprintf (stderr, "grub-map-file: FIBMAP %s: %s\n",
+		   argv[1], strerror (errno));
+	  exit (1);
+	}
+    }
+
+  return 0;
+}
diff -urN grub-0.97.orig/util/Makefile.am grub-0.97/util/Makefile.am
--- grub-0.97.orig/util/Makefile.am	2004-06-19 20:52:06.000000000 +0100
+++ grub-0.97/util/Makefile.am	2009-01-04 19:21:05.000000000 +0000
@@ -1,4 +1,5 @@
 bin_PROGRAMS = mbchk
+sbin_PROGRAMS = grub-map-file
 sbin_SCRIPTS = grub-install grub-md5-crypt grub-terminfo \
 	grub-set-default
 noinst_SCRIPTS = grub-image mkbimage
@@ -10,3 +11,5 @@
 
 mbchk_SOURCES = mbchk.c
 mbchk_LDADD = ../lib/libcommon.a
+
+grub_map_file_SOURCES =  grub-map-file.c
--- END ---

If that doesn't work, please also test my previously proposed patch:

--- grub-0.97.orig/util/grub-install.in	2004-07-24 19:57:31.000000000 +0100
+++ grub-0.97/util/grub-install.in	2009-01-04 04:57:47.000000000 +0000
@@ -418,6 +418,12 @@
 # Make a default file.
 ${grub_set_default} --root-directory=${rootdir} default
 
+# XFS is special; we must run xfs_freeze to flush files as well as sync
+# (which grub itself does).
+if [ "$(stat -f --printf=%T ${grubdir})" = "xfs" ]; then
+    xfs_freeze -f ${grubdir} && xfs_freeze -u ${grubdir}
+fi
+
 # Make sure that GRUB reads the same images as the host OS.
 test -n "$mkimg" && img_file=`$mkimg`
 test -n "$mklog" && log_file=`$mklog`
--- END ---

Either of these patches should replace debian/patches/xfs_freeze.diff in
the source package.

Ben.

-- 
Ben Hutchings
[W]e found...that it wasn't as easy to get programs right as we had thought.
... I realized that a large part of my life from then on was going to be spent
in finding mistakes in my own programs. - Maurice Wilkes, 1949
[signature.asc (application/pgp-signature, inline)]

Tags added: lenny-ignore Request was from Neil McGovern <neilm@debian.org> to control@bugs.debian.org. (Sat, 10 Jan 2009 22:15:05 GMT) Full text and rfc822 format available.

Tags added: lenny-ignore Request was from Neil McGovern <neilm@debian.org> to control@bugs.debian.org. (Sat, 10 Jan 2009 22:15:07 GMT) Full text and rfc822 format available.

Tags added: lenny-ignore Request was from Neil McGovern <neilm@debian.org> to control@bugs.debian.org. (Sat, 10 Jan 2009 22:15:08 GMT) Full text and rfc822 format available.

Tags added: lenny-ignore Request was from Neil McGovern <neilm@debian.org> to control@bugs.debian.org. (Sat, 10 Jan 2009 22:15:10 GMT) Full text and rfc822 format available.

Tags added: lenny-ignore Request was from Neil McGovern <neilm@debian.org> to control@bugs.debian.org. (Sat, 10 Jan 2009 22:15:12 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Sun, 11 Jan 2009 11:30:02 GMT) Full text and rfc822 format available.

Message #260 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org
Cc: Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>, Robert McQueen <robot101@hadesian.co.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Sun, 11 Jan 2009 12:26:48 +0100
severity 239111 important
clone 239111 -1
retitle -1 should refuse to install on XFS unless embedding can be used
reassign -1 grub2
thanks

On Sun, Jan 04, 2009 at 02:25:28AM +0000, Steve McIntyre wrote:
> 
> After several hours of working through the source, I give up. It's a
> total mess and I'd much rather see grub simply removed from Debian
> altogether than fix this bug and allow it to live on. Highlights:
> 
>  * gratuitous use of nested functions
>  * horrific interfaces that don't pass enough information around
>    internally, leading to:
>  * functions passing internal state around via umarked global
>    variables, relying on side effects
>  * significantly obfuscated code
>  * the core bug as described by Rob: accessing a block device
>    underneath an active filesystem and assuming that the results will
>    be safe and/or correct.
> 
> I *know* that grub is a bootloader, so it's always going to end up
> having some nasty lowlevel code somewhere. But that's no excuse for
> the code quality I've just seen. After this experience, I'm about to
> remove grub from all my systems. Come back lilo, all is forgiven.

You're right.  Code in GRUB Legacy is such a mess that we would have to
rewrite it from scratch in order to get things right.

Oh, wait, we already did.  It's called GRUB 2.  Though, we're still fond of
the nested functions.  :-)

As for accessing a block device underneath an active filesystem, we don't
do this anymore, except when we have no other choice.

For XFS, this means that as long as you install GRUB to your MBR (and
implicitly, post-MBR area), you'll never hit this problem.  That is,
as long as your core.img fits in 32 kiB, which we are very careful to
ensure it will always do.

This reminds me, when it doesn't, in the particular case of XFS we need to
abort install and tell the user why.  I'm cloning this bug for GRUB 2 with
that purpose.

Robert (et al):  Sorry that you spent so much effort debugging GRUB Legacy;
we (upstream) have abandoned this codebase long ago.

As for the bug severity, this bug has been around for a while, and we never
considered it to be Release Critical.  D-I avoids using GRUB Legacy when user
selected XFS, and rightly so.  As I said, with GRUB 2 it's going to be
different (if someone wants to know more about the technical details on how
we changed our approach, feel free to contact me).

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Severity set to `important' from `grave' Request was from Robert Millan <rmh@aybabtu.com> to control@bugs.debian.org. (Sun, 11 Jan 2009 11:30:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Sun, 11 Jan 2009 17:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve McIntyre <steve@einval.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Sun, 11 Jan 2009 17:18:02 GMT) Full text and rfc822 format available.

Message #267 received at 239111@bugs.debian.org (full text, mbox):

From: Steve McIntyre <steve@einval.com>
To: Robert Millan <rmh@aybabtu.com>
Cc: 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>, Robert McQueen <robot101@hadesian.co.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Sun, 11 Jan 2009 17:16:03 +0000
On Sun, Jan 11, 2009 at 12:26:48PM +0100, Robert Millan wrote:
>severity 239111 important
>clone 239111 -1
>retitle -1 should refuse to install on XFS unless embedding can be used
>reassign -1 grub2
>thanks
>
>On Sun, Jan 04, 2009 at 02:25:28AM +0000, Steve McIntyre wrote:
>> 
>> After several hours of working through the source, I give up. It's a
>> total mess and I'd much rather see grub simply removed from Debian
>> altogether than fix this bug and allow it to live on. Highlights:
>> 
>>  * gratuitous use of nested functions
>>  * horrific interfaces that don't pass enough information around
>>    internally, leading to:
>>  * functions passing internal state around via umarked global
>>    variables, relying on side effects
>>  * significantly obfuscated code
>>  * the core bug as described by Rob: accessing a block device
>>    underneath an active filesystem and assuming that the results will
>>    be safe and/or correct.
>> 
>> I *know* that grub is a bootloader, so it's always going to end up
>> having some nasty lowlevel code somewhere. But that's no excuse for
>> the code quality I've just seen. After this experience, I'm about to
>> remove grub from all my systems. Come back lilo, all is forgiven.
>
>You're right.  Code in GRUB Legacy is such a mess that we would have to
>rewrite it from scratch in order to get things right.
>
>Oh, wait, we already did.  It's called GRUB 2.  Though, we're still fond of
>the nested functions.  :-)

Yes, I've looked at the grub2 source and I'm much happier. It doesn't
look like a novice had written it, which is a major improvement. I'm
still curious WTH anybody would think the nested functions are a good
thing, though...

>As for accessing a block device underneath an active filesystem, we don't
>do this anymore, except when we have no other choice.

Yay.

>For XFS, this means that as long as you install GRUB to your MBR (and
>implicitly, post-MBR area), you'll never hit this problem.  That is,
>as long as your core.img fits in 32 kiB, which we are very careful to
>ensure it will always do.
>
>This reminds me, when it doesn't, in the particular case of XFS we need to
>abort install and tell the user why.  I'm cloning this bug for GRUB 2 with
>that purpose.
>
>Robert (et al):  Sorry that you spent so much effort debugging GRUB Legacy;
>we (upstream) have abandoned this codebase long ago.
>
>As for the bug severity, this bug has been around for a while, and we never
>considered it to be Release Critical.  D-I avoids using GRUB Legacy when user
>selected XFS, and rightly so.  As I said, with GRUB 2 it's going to be
>different (if someone wants to know more about the technical details on how
>we changed our approach, feel free to contact me).

The thing I'm more bothered about right now is what will happen to
people with existing systems who upgrade. That's why Rob raised this
bug to grave: his remote system locked up as part of an upgrade. What
do you plan to do to stop this happening again?

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
"This dress doesn't reverse." -- Alden Spiess





Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:06:05 GMT) Full text and rfc822 format available.

Message #270 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Steve McIntyre <steve@einval.com>
Cc: 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>, Robert McQueen <robot101@hadesian.co.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 19:00:58 +0100
On Sun, Jan 11, 2009 at 05:16:03PM +0000, Steve McIntyre wrote:
> Yes, I've looked at the grub2 source and I'm much happier. It doesn't
> look like a novice had written it, which is a major improvement. I'm
> still curious WTH anybody would think the nested functions are a good
> thing, though...

It's kind of a tradition here.  I think the point is just to limit the
scope of "hook functions" same way as is usually done for variables.

> >As for the bug severity, this bug has been around for a while, and we never
> >considered it to be Release Critical.  D-I avoids using GRUB Legacy when user
> >selected XFS, and rightly so.  As I said, with GRUB 2 it's going to be
> >different (if someone wants to know more about the technical details on how
> >we changed our approach, feel free to contact me).
> 
> The thing I'm more bothered about right now is what will happen to
> people with existing systems who upgrade. That's why Rob raised this
> bug to grave: his remote system locked up as part of an upgrade. What
> do you plan to do to stop this happening again?

The whole approach is wrong, so maybe it makes sense to avoid it, or maybe
it's too late for that, and we should issue a critical debconf warning when
XFS is detected.

I will have to think about it.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve McIntyre <steve@einval.com>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 18:15:03 GMT) Full text and rfc822 format available.

Message #275 received at 239111@bugs.debian.org (full text, mbox):

From: Steve McIntyre <steve@einval.com>
To: Robert Millan <rmh@aybabtu.com>
Cc: 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>, Robert McQueen <robot101@hadesian.co.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 18:12:02 +0000
On Mon, Jan 12, 2009 at 07:00:58PM +0100, Robert Millan wrote:
>On Sun, Jan 11, 2009 at 05:16:03PM +0000, Steve McIntyre wrote:
>> Yes, I've looked at the grub2 source and I'm much happier. It doesn't
>> look like a novice had written it, which is a major improvement. I'm
>> still curious WTH anybody would think the nested functions are a good
>> thing, though...
>
>It's kind of a tradition here.  I think the point is just to limit the
>scope of "hook functions" same way as is usually done for variables.

:-/ As an experienced C programmer, they make me shudder. For simple
readability of the code, I'd give up on them altogether. But it's your
code... 

>> The thing I'm more bothered about right now is what will happen to
>> people with existing systems who upgrade. That's why Rob raised this
>> bug to grave: his remote system locked up as part of an upgrade. What
>> do you plan to do to stop this happening again?
>
>The whole approach is wrong, so maybe it makes sense to avoid it, or maybe
>it's too late for that, and we should issue a critical debconf warning when
>XFS is detected.
>
>I will have to think about it.

OK; please be quick, as we could really do with something in place for
Lenny and we're not far away.

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
You lock the door
And throw away the key
There's someone in my head but it's not me 





Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:18:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert McQueen <robot101@hadesian.co.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 18:18:05 GMT) Full text and rfc822 format available.

Message #280 received at 239111@bugs.debian.org (full text, mbox):

From: Robert McQueen <robot101@hadesian.co.uk>
To: Robert Millan <rmh@aybabtu.com>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>, control@bugs.debian.org
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 18:15:52 +0000
severity 239111 grave
thanks

Robert Millan wrote:
> The whole approach is wrong, so maybe it makes sense to avoid it, or maybe
> it's too late for that, and we should issue a critical debconf warning when
> XFS is detected.
>
> I will have to think about it.

The problem is that Debian's patch to try and make it work on XFS makes
it /worse/. It turns "grub-install fails" into "grub-install fucks my
system". There's no question we should just fix that ASAP by applying a
patch which just does freeze immediately followed by unfreeze. That's
why I raised the severity, and I still consider this RC for lenny
because the upgrade instructions in NEWS.Debian encouraged me to do
something which bricked my system.

(Note that although I didn't try it yet, I'm almost certain that Ben's
approach with a helper binary to run FIBMAP ioctl won't help any more
than calling sync() will. sync is /not/ broken in XFS - if you call it
then it does flush the data to disk - the "problem" is that it considers
metadata synced to the journal as safely sync()'d, so calling it isn't
sufficient to udate the dentry's for grub to read directly.)

Given even xfs_freeze is broken in etch's kernel, we can't make
grub-install work reliably there, but if we put freeze/unfreeze between
copying the files and invoking grub then it will a) not hose people's
systems under etch, and b) will work with lenny's kernel. There's also
no need for a critical warning, because grub-install has to be done by
the user manually anyway. We should just include the correct advice.

If you'd answer my question about which kernel / grub versions are
actually incompatible, then we can choose between the two behaviours.
If etch's grub can boot lenny's kernel, we can tell XFS users to just
update grub after rebooting, otherwise we can direct them at some manual
install instruction and say "please freeze and unfreeze the filesystem,
run sync a few times, and then have a cup of tea, between copying the
stage* files and running the grub shell".

Regards,
Rob




Severity set to `grave' from `important' Request was from Robert McQueen <robot101@hadesian.co.uk> to control@bugs.debian.org. (Mon, 12 Jan 2009 18:18:10 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:36:02 GMT) Full text and rfc822 format available.

Message #285 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 19:32:49 +0100
On Mon, Jan 12, 2009 at 06:15:52PM +0000, Robert McQueen wrote:
> severity 239111 grave
> thanks
> 
> Robert Millan wrote:
> > The whole approach is wrong, so maybe it makes sense to avoid it, or maybe
> > it's too late for that, and we should issue a critical debconf warning when
> > XFS is detected.
> >
> > I will have to think about it.
> 
> The problem is that Debian's patch to try and make it work on XFS makes
> it /worse/. It turns "grub-install fails" into "grub-install fucks my
> system". There's no question we should just fix that ASAP by applying a
> patch which just does freeze immediately followed by unfreeze. That's
> why I raised the severity, and I still consider this RC for lenny
> because the upgrade instructions in NEWS.Debian encouraged me to do
> something which bricked my system.
> 
> (Note that although I didn't try it yet, I'm almost certain that Ben's
> approach with a helper binary to run FIBMAP ioctl won't help any more
> than calling sync() will. sync is /not/ broken in XFS - if you call it
> then it does flush the data to disk - the "problem" is that it considers
> metadata synced to the journal as safely sync()'d, so calling it isn't
> sufficient to udate the dentry's for grub to read directly.)
> 
> Given even xfs_freeze is broken in etch's kernel, we can't make
> grub-install work reliably there, but if we put freeze/unfreeze between
> copying the files and invoking grub then it will a) not hose people's
> systems under etch, and b) will work with lenny's kernel. There's also
> no need for a critical warning, because grub-install has to be done by
> the user manually anyway. We should just include the correct advice.
> 
> If you'd answer my question about which kernel / grub versions are
> actually incompatible, then we can choose between the two behaviours.
> If etch's grub can boot lenny's kernel, we can tell XFS users to just
> update grub after rebooting, otherwise we can direct them at some manual
> install instruction and say "please freeze and unfreeze the filesystem,
> run sync a few times, and then have a cup of tea, between copying the
> stage* files and running the grub shell".

Hi Rob,

You just convinced me that this is completely fucked up.  This is not the
first time someone claims to have fixed this problem, only to discover that
it wasn't, and I'm not going to gamble with ioctls, freeze/unfreeze combos
or Linux version checks.

I (and upstream in general) believe that the only right way to rely on a
hardcoded list of blocks that live inside a filesystem is _not to_.

I'll see if it's feasible to make it use embedding, and if not, XFS support
in GRUB Legacy will be terminated, and users will be advised to either
leave /boot/grub untouched or upgrade to GRUB 2.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:42:06 GMT) Full text and rfc822 format available.

Message #288 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Neil McGovern <neilm@debian.org>
Cc: 239111@bugs.debian.org
Subject: Re: This won't get fixed for lenny
Date: Mon, 12 Jan 2009 19:39:01 +0100
On Sat, Jan 10, 2009 at 10:10:58PM +0000, Neil McGovern wrote:
> tags 239111 +lenny-ignore
> tags 243835 +lenny-ignore
> tags 246111 +lenny-ignore
> tags 309218 +lenny-ignore
> tags 425367 +lenny-ignore
> thanks
> 
> The grub + XFS issues are long standing and complicated go fix. This
> means that they're not going to get fixed in time for lenny. Hence
> adding lenny-ignore tags

Hi Neil,

As Rob pointed out there's a serious regression, and I plan to fix it really
soon.  So please remove the lenny-ignore tag.

Thanks

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert McQueen <robot101@hadesian.co.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 18:51:02 GMT) Full text and rfc822 format available.

Message #293 received at 239111@bugs.debian.org (full text, mbox):

From: Robert McQueen <robot101@hadesian.co.uk>
To: Robert Millan <rmh@aybabtu.com>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 18:48:50 +0000
Robert Millan wrote:
> Hi Rob,

Hi Robert,

> You just convinced me that this is completely fucked up.  This is not the
> first time someone claims to have fixed this problem, only to discover that
> it wasn't, and I'm not going to gamble with ioctls, freeze/unfreeze combos
> or Linux version checks.

We all know this is fucked up. :) I'm not claiming to fix anything so it
somehow works flawlessly. I just want to avoid my system being locked up
when I follow the instructions in NEWS.Debian. So the changes I'm
proposing for lenny are just:

 a) change the Debian XFS hack to grub-install so that it does "copy
    stage files; freeze; unfreeze; install grub" rather than "copy stage
    files; freeze; lots of shit; unfreeze" which is guaranteed. I don't
    care if it *works*, but it will at least print me an error message
    which is fine because everyone who has Grub and XFS probably
    installed it manually once anyway. Anyway, Ben's simpler patch (just
    xfs_freeze followed by unfreeze) probably *does* work on lenny and
    at least fails gracefully on etch. I'll test it.

 b) clarify the documentation in NEWS.Debian which encourages people to
    run "grub-install" unequivocally, so that it tells people with an
    XFS /boot filesystem to either upgrade after rebooting, or upgrade
    later. If you can tell me which kernel versions that etch's Grub can
    boot, I can propose a patch.

For what it's worth I've chatted to XFS developers on IRC (Eric Sandeen
amongst others) and pointed them to this bug, and they agree with my
suggested approach here.

> I (and upstream in general) believe that the only right way to rely on a
> hardcoded list of blocks that live inside a filesystem is _not to_.

You're in 100% agreement with the XFS developers here.

> I'll see if it's feasible to make it use embedding, and if not, XFS support
> in GRUB Legacy will be terminated, and users will be advised to either
> leave /boot/grub untouched or upgrade to GRUB 2.

Maybe sensible, but I suggest the above two changes are made as well to
avoid fucking people's systems if they /do/ run grub-install, because
the current Debian XFS hack makes things much much worse than upstream.

Regards,
Rob




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 18:54:02 GMT) Full text and rfc822 format available.

Message #296 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 19:51:05 +0100
Rob,

Did you hit this problem when installing GRUB to a partition, or to the
whole disk?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 19:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert McQueen <robot101@hadesian.co.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 19:00:03 GMT) Full text and rfc822 format available.

Message #301 received at 239111@bugs.debian.org (full text, mbox):

From: Robert McQueen <robot101@hadesian.co.uk>
To: Robert Millan <rmh@aybabtu.com>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 18:57:55 +0000
Robert Millan wrote:
> Rob,
> 
> Did you hit this problem when installing GRUB to a partition, or to the
> whole disk?

I was upgrading from etch to lenny on a box where / is XFS and /boot and
/var are on the same partition. GRUB is installed into the MBR. I know
you can't install bootloaders onto XFS partitions.

(If that had happened, based on previous experience the FS would've
panicked and all IO returned with an error, so I'd probably have been
able to log in and get a lot of errors, assuming bash was still in the
cache. :D)

So no, it's nothing to do with where I'm trying to install GRUB to, the
problem is the Debian patch to grub-install did xfs_freeze on my root
filesystem and then did various crap including trying to write to the
log file (and make a /boot/grub/default file, I think?), all of which go
into D state while the filesystem is frozen so don't finish, and
meanwhile everything else on my system ground to a halt too. Obviously
hard for me to debug given I lost all my access to the system, but
asking SysRq for backtraces showed everything was blocked on FS access.
(Actually as a result of my experience I think XFS devs are adding an
unfreeze SysRq atm...)

Just make the script not try do anything at all which might potentially
cause a write to the filesystem while it's frozen, is the main thing...
Backing out the bullshit XFS Debian patch would do that, applying Ben's
might even make it work properly on lenny.

Regards,
Rob




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 19:27:02 GMT) Full text and rfc822 format available.

Message #304 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 20:23:52 +0100
On Mon, Jan 12, 2009 at 07:32:49PM +0100, Robert Millan wrote:
> 
> I (and upstream in general) believe that the only right way to rely on a
> hardcoded list of blocks that live inside a filesystem is _not to_.

Grmf.  I was making wrong assumptions.  This is not about block lists
(I still think block lists suck, but let's be fair...):

#ifdef GRUB_UTIL
          /* In the grub shell, access the Stage 2 via the OS filesystem
             service, if possible.  */
          if (stage2_os_file)
            {
[...]
              if (fwrite (stage2_buffer, 1, SECTOR_SIZE, fp)
                  != SECTOR_SIZE)
[...]
            }
          else
#endif /* GRUB_UTIL */
            {
              if (! devwrite (saved_sector - part_start, 1, stage2_buffer))
                goto fail;
            }

So we freeze the filesystem and afterwards try to write to it.  Not a good
idea...

#239111 initial report claims GRUB hangs before we added xfs_freeze.diff, but
according to what Rob says, not freezing makes it work for him.

Rob, can you test removing the patch completely?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 19:30:04 GMT) Full text and rfc822 format available.

Message #307 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 20:28:19 +0100
On Mon, Jan 12, 2009 at 06:57:55PM +0000, Robert McQueen wrote:
> 
> So no, it's nothing to do with where I'm trying to install GRUB to, the
> problem is the Debian patch to grub-install did xfs_freeze on my root
> filesystem and then did various crap including trying to write to the
> log file (and make a /boot/grub/default file, I think?),

It's not the log file.  Joeyh tried that (see the bug log).

I'm almost certain it's the fwrite() call in install_func.  I could be
wrong, but I still don't see why we would want to use xfs_freeze anyway.

And if we _really_ need xfs_freeze, it means we're doing something wrong.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 19:57:02 GMT) Full text and rfc822 format available.

Message #310 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 20:54:43 +0100
On Mon, Jan 12, 2009 at 08:28:19PM +0100, Robert Millan wrote:
> 
> It's not the log file.  Joeyh tried that (see the bug log).
> 
> I'm almost certain it's the fwrite() call in install_func.  I could be
> wrong, but I still don't see why we would want to use xfs_freeze anyway.
> 
> And if we _really_ need xfs_freeze, it means we're doing something wrong.

Ah, I remember.  There was a sanity check.  The GRUB shell tries to read the
file using its own filesystem driver, to make sure real GRUB will be able to
do it as well.  At least, that's what we do in GRUB 2.

It would seem that running sync would suffice for that.  Unfortunately, it
seems that:

  - sync is not enough
    (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111#53)

  - xfs_freeze could hang even if you don't write anything
    (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111#194)

This is odd.  I think I'm going to assume sync does what is expected from
it.  If it doesn't maybe it's a bug in Linux, which maybe got fixed already,
or maybe it's a (lesser) bug in GRUB which we can't find untill it's
exposed.

In any case, we're better off not using xfs_freeze untill we know for sure
why it is needed, and are certain it won't cause hangs.

I'm waiting for Ron's confirmation that this works for him, and then I'll
remove the patch & upload.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 20:00:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert McQueen <robot101@hadesian.co.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 20:00:05 GMT) Full text and rfc822 format available.

Message #315 received at 239111@bugs.debian.org (full text, mbox):

From: Robert McQueen <robot101@hadesian.co.uk>
To: Robert Millan <rmh@aybabtu.com>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 19:57:44 +0000
Robert Millan wrote:
> Grmf.  I was making wrong assumptions.  This is not about block lists
> (I still think block lists suck, but let's be fair...):
...
> So we freeze the filesystem and afterwards try to write to it.  Not a
> good idea...

Indeed not.

> #239111 initial report claims GRUB hangs before we added
> xfs_freeze.diff, but according to what Rob says, not freezing makes it
> work for him.

I didn't test that, I was basing on my experiences of installing GRUB
manually. I usually do:

mkdir /boot/grub
cp -a /usr/lib/grub/i386-pc/* /boot/grub
vi /boot/grub/device.map
grub --device-map=/boot/grub/device.map
# doesn't work because XFS hasn't put /boot/grub onto disk ...
# swear a bit
xfs_freeze -f /
xfs_freeze -u /
grub --device-map=/boot/grub/device.map
# works
update-grub
# makes me a menu.lst file

This never froze for me.

> Rob, can you test removing the patch completely?

I suppose, it would at least make it fail rather than fuck my system,
but based on my understanding of the problem, won't make installations
on XFS work reliably.

> I'm almost certain it's the fwrite() call in install_func.  I could be
> wrong, but I still don't see why we would want to use xfs_freeze anyway.

You use xfs_freeze to force XFS to flush the metadata for the newly
created stage* files out of the journal and into the directory entries
themselves. sync() puts the data on disk and the metadata in the
journal, but xfs_freeze gives the extra guarantee of the journal being
clean and empty so the filesystem can be shapshotted and mounted as
read-only (with no journal replay).

> And if we _really_ need xfs_freeze, it means we're doing something wrong.

I thought the wrongness was well known: the GRUB shell tries to read the
block device directly and traverse the filesystem directories itself to
to find which blocks on the disk are where the stage* files are located.
XFS considers putting the metadata into the journal an acceptable
implementation of sync(), but grub's filesystem reading code ignores the
journal, so can't find the files. If the shell used FIBMAP ioctl to find
the blocks when running under the OS, it'd always find them and all
would be sweetness and light. Thats what Steve was trying to do, I
think, before he gave up and sent the OP on this thread.

Regards,
Rob




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 20:15:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert McQueen <robot101@hadesian.co.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 20:15:08 GMT) Full text and rfc822 format available.

Message #320 received at 239111@bugs.debian.org (full text, mbox):

From: Robert McQueen <robot101@hadesian.co.uk>
To: Robert Millan <rmh@aybabtu.com>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 20:13:52 +0000
Robert Millan wrote:
> It would seem that running sync would suffice for that.  Unfortunately, it
> seems that:
> 
>   - sync is not enough
>     (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111#53)

Correct. This is a property of XFS. As I said, it considers that putting
metadata into the journal, and knowing it's flushed there, to meet the
API guarantee of sync(). sync() doesn't make any guarantee that the
files can be found by an an incomplete implementation of the filesystem
(such as GRUB's, which ignores the journal).

>   - xfs_freeze could hang even if you don't write anything
>     (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111#194)

I believe this report is unreliable, perhaps it froze because it's made
an echo in a process whose stdout is being logged?

> This is odd.  I think I'm going to assume sync does what is expected from
> it.  If it doesn't maybe it's a bug in Linux, which maybe got fixed already,
> or maybe it's a (lesser) bug in GRUB which we can't find untill it's
> exposed.

It's not a bug, it's the behaviour of XFS which I've explained a few
times already. The bug in GRUB is trying to read the filesystem at a
block level, behind the kernel's back.

> In any case, we're better off not using xfs_freeze untill we know for sure
> why it is needed, and are certain it won't cause hangs.

I know why it's needed, and have done for around 4 years, and have had
this confirmed from the XFS developers too.

> I'm waiting for Ron's confirmation that this works for him, and then I'll
> remove the patch & upload.

I'm pretty sure it won't work reliably without some xfs_freeze, so I
still prefer including the patch. I will try to find some time to test
it as well as Ben's simple freeze; unfreeze patch which I prefer, as I
believe it will make things work in lenny's kernel (although not etch,
where freeze is sadly broken, which is why the patch in #179 has such
horrible looping sleep/freeze hacks anyway).

Cheers,
Rob




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 21:06:05 GMT) Full text and rfc822 format available.

Message #323 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 21:41:36 +0100
On Mon, Jan 12, 2009 at 07:57:44PM +0000, Robert McQueen wrote:
> I didn't test that, I was basing on my experiences of installing GRUB
> manually. I usually do:
> 
> mkdir /boot/grub
> cp -a /usr/lib/grub/i386-pc/* /boot/grub
> vi /boot/grub/device.map
> grub --device-map=/boot/grub/device.map
> # doesn't work because XFS hasn't put /boot/grub onto disk ...
> # swear a bit
> xfs_freeze -f /
> xfs_freeze -u /
> grub --device-map=/boot/grub/device.map
> # works
> update-grub
> # makes me a menu.lst file
> 
> This never froze for me.

I wasn't aware you were running xfs_freeze by hand.

But I don't trust that this won't hang the kernel.  See the link I pasted in
the previous mail.

This situation is very unfortunate.  If we call xfs_freeze, we risk hanging
Linux.  If we don't, we risk the file being inaccesible.  As you point
out, an error message is preferable to hanging the kernel, but it's a
certain error message against a possible but unlikely hang.  Maybe we should
go with the latter then?

In any case, both are better than a certain hang which is what we have now.

> > And if we _really_ need xfs_freeze, it means we're doing something wrong.
> 
> I thought the wrongness was well known: the GRUB shell tries to read the
> block device directly and traverse the filesystem directories itself to
> to find which blocks on the disk are where the stage* files are located.

No, this is a missunderstanding (which I got misled with, too).  GRUB only
tries to verify that the file will be readable later on (that is, when
Linux isn't running).

stage1 is the MBR.  stage1.5 is supposed to be embedded after the MBR.
stage2 is in the filesystem, and only accessed using the filesystem driver
in stage1.5.

> XFS considers putting the metadata into the journal an acceptable
> implementation of sync(), but grub's filesystem reading code ignores the
> journal, so can't find the files. If the shell used FIBMAP ioctl to find
> the blocks when running under the OS, it'd always find them and all
> would be sweetness and light.

We can't do that.  Using kernel facilities to find the blocks would defeat
the point of verifiing that GRUB can read the file.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 21:06:06 GMT) Full text and rfc822 format available.

Message #326 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Mon, 12 Jan 2009 22:03:21 +0100
On Mon, Jan 12, 2009 at 08:13:52PM +0000, Robert McQueen wrote:
> >   - sync is not enough
> >     (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111#53)
> 
> Correct. This is a property of XFS. As I said, it considers that putting
> metadata into the journal, and knowing it's flushed there, to meet the
> API guarantee of sync(). sync() doesn't make any guarantee that the
> files can be found by an an incomplete implementation of the filesystem
> (such as GRUB's, which ignores the journal).

There was a conscious decision to avoid implementing journaling.  I don't
remember why;  code size, I guess.

> >   - xfs_freeze could hang even if you don't write anything
> >     (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239111#194)
> 
> I believe this report is unreliable, perhaps it froze because it's made
> an echo in a process whose stdout is being logged?

Good catch.  Ok, then I'm fine with that approach.

> I will try to find some time to test
> it as well as Ben's simple freeze; unfreeze patch which I prefer,

You mean the one in #242 ?  This looks good to me.

Btw, Ben, could you test your patch on GRUB 2 too?  It probably has exactly
the same problem.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 22:12:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Neil McGovern <maulkin@halon.org.uk>:
Extra info received and forwarded to list. Copy sent to Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>. (Mon, 12 Jan 2009 22:12:05 GMT) Full text and rfc822 format available.

Message #331 received at 239111@bugs.debian.org (full text, mbox):

From: Neil McGovern <maulkin@halon.org.uk>
To: Robert Millan <rmh@aybabtu.com>
Cc: debian-release@lists.debian.org, 239111@bugs.debian.org
Subject: Re: This won't get fixed for lenny
Date: Mon, 12 Jan 2009 22:08:49 +0000
On Mon, Jan 12, 2009 at 07:39:01PM +0100, Robert Millan wrote:
> On Sat, Jan 10, 2009 at 10:10:58PM +0000, Neil McGovern wrote:
> > tags 239111 +lenny-ignore
> > tags 243835 +lenny-ignore
> > tags 246111 +lenny-ignore
> > tags 309218 +lenny-ignore
> > tags 425367 +lenny-ignore
> > thanks
> > 
> > The grub + XFS issues are long standing and complicated go fix. This
> > means that they're not going to get fixed in time for lenny. Hence
> > adding lenny-ignore tags
> 
> Hi Neil,
> 
> As Rob pointed out there's a serious regression, and I plan to fix it really
> soon.  So please remove the lenny-ignore tag.
> 

I'll believe it when I see it :)

This has been 'fixed' many times, and it seems to be non-trivial. If we
*do* end up with a fix, that'll be great; the RC bug gets closed (yay!).

If not, I don't want to delay the release over it as we'll be putting it
in the release notes (#511440).

However, ccing -release so a RM can override my decision if they want.

Neil
-- 
A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?
gpg key - http://www.halon.org.uk/pubkey.txt ; the.earth.li B345BDD3




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Mon, 12 Jan 2009 22:57:02 GMT) Full text and rfc822 format available.

Message #334 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Neil McGovern <maulkin@halon.org.uk>
Cc: debian-release@lists.debian.org, 239111@bugs.debian.org, 511440@bugs.debian.org
Subject: Re: This won't get fixed for lenny
Date: Mon, 12 Jan 2009 23:53:58 +0100
On Mon, Jan 12, 2009 at 10:08:49PM +0000, Neil McGovern wrote:
> On Mon, Jan 12, 2009 at 07:39:01PM +0100, Robert Millan wrote:
> > 
> > Hi Neil,
> > 
> > As Rob pointed out there's a serious regression, and I plan to fix it really
> > soon.  So please remove the lenny-ignore tag.
> > 
> 
> I'll believe it when I see it :)
> 
> This has been 'fixed' many times, and it seems to be non-trivial. If we
> *do* end up with a fix, that'll be great; the RC bug gets closed (yay!).

Well, I was going to fix the regression, not the bug completely.

> If not, I don't want to delay the release over it as we'll be putting it
> in the release notes (#511440).

Please don't put it in the release notes yet.  I'm fixing this really soon,
probably tomorrow.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




Information forwarded to debian-bugs-dist@lists.debian.org, Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>:
Bug#239111; Package grub. (Tue, 13 Jan 2009 11:21:02 GMT) Full text and rfc822 format available.

Message #337 received at 239111@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: Robert McQueen <robot101@hadesian.co.uk>
Cc: Steve McIntyre <steve@einval.com>, 239111@bugs.debian.org, Neil McGovern <neilm@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Subject: Re: Bug#239111: Grub is shockingly bad code
Date: Tue, 13 Jan 2009 12:20:18 +0100
[Message part 1 (text/plain, inline)]
tags 239111 patch
thanks

Hi,

Please could you try the attached patch, and confirm that it works?  Thanks

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
[xfs.diff (text/x-diff, attachment)]

Tags added: patch Request was from Robert Millan <rmh@aybabtu.com> to control@bugs.debian.org. (Tue, 13 Jan 2009 11:21:12 GMT) Full text and rfc822 format available.

Tags added: pending Request was from Robert Millan <rmh@aybabtu.com> to control@bugs.debian.org. (Fri, 16 Jan 2009 21:24:04 GMT) Full text and rfc822 format available.

Reply sent to Robert Millan <rmh@aybabtu.com>:
You have taken responsibility. (Fri, 16 Jan 2009 22:12:09 GMT) Full text and rfc822 format available.

Notification sent to asjo@koldfront.dk (Adam Sjøgren):
Bug acknowledged by developer. (Fri, 16 Jan 2009 22:12:09 GMT) Full text and rfc822 format available.

Message #346 received at 239111-close@bugs.debian.org (full text, mbox):

From: Robert Millan <rmh@aybabtu.com>
To: 239111-close@bugs.debian.org
Subject: Bug#239111: fixed in grub 0.97-47lenny2
Date: Fri, 16 Jan 2009 21:47:17 +0000
Source: grub
Source-Version: 0.97-47lenny2

We believe that the bug you reported is fixed in the latest version of
grub, which is due to be installed in the Debian FTP archive:

grub-disk_0.97-47lenny2_all.deb
  to pool/main/g/grub/grub-disk_0.97-47lenny2_all.deb
grub-doc_0.97-47lenny2_all.deb
  to pool/main/g/grub/grub-doc_0.97-47lenny2_all.deb
grub-legacy-doc_0.97-47lenny2_all.deb
  to pool/main/g/grub/grub-legacy-doc_0.97-47lenny2_all.deb
grub_0.97-47lenny2.diff.gz
  to pool/main/g/grub/grub_0.97-47lenny2.diff.gz
grub_0.97-47lenny2.dsc
  to pool/main/g/grub/grub_0.97-47lenny2.dsc
grub_0.97-47lenny2_i386.deb
  to pool/main/g/grub/grub_0.97-47lenny2_i386.deb
multiboot-doc_0.97-47lenny2_all.deb
  to pool/main/g/grub/multiboot-doc_0.97-47lenny2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 239111@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Robert Millan <rmh@aybabtu.com> (supplier of updated grub package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Fri, 16 Jan 2009 22:18:45 +0100
Source: grub
Binary: grub grub-disk grub-doc grub-legacy-doc multiboot-doc
Architecture: source i386 all
Version: 0.97-47lenny2
Distribution: unstable
Urgency: high
Maintainer: Grub Maintainers <pkg-grub-devel@lists.alioth.debian.org>
Changed-By: Robert Millan <rmh@aybabtu.com>
Description: 
 grub       - GRand Unified Bootloader (Legacy version)
 grub-disk  - GRUB bootable disk image (dummy package)
 grub-doc   - Documentation for GRand Unified Bootloader (dummy package)
 grub-legacy-doc - Documentation for GRUB Legacy
 multiboot-doc - The Multiboot specification
Closes: 239111 243835 246111 309218 425367
Changes: 
 grub (0.97-47lenny2) unstable; urgency=high
 .
   * patches/xfs_freeze.diff: Replace with a new patch, which thaws XFS
     inmediately after freezing it.  (Closes: #239111, #243835, #246111,
     #309218, #425367) hopefully for good this time.  Thanks everyone
     who sent their feedback, too many to list them here.
Checksums-Sha1: 
 3889aca8522d80a4bb5e9e2ec70ab869a1c38964 1335 grub_0.97-47lenny2.dsc
 7deec94e2ea3bab0afb2662727d6da2e72935a8d 93919 grub_0.97-47lenny2.diff.gz
 398f2ce7f25c80a26f534399bc36e9c35fa8af22 389142 grub_0.97-47lenny2_i386.deb
 2f1fbde1642248110eff0736acbbaf07f9a5d53d 115638 grub-disk_0.97-47lenny2_all.deb
 d762da2eb2c5fdb2d94e90b23f84244fc2548754 115654 grub-doc_0.97-47lenny2_all.deb
 81c1ebcca104bfae77535d801ed7f72946aab0a3 252928 grub-legacy-doc_0.97-47lenny2_all.deb
 f6e569ded9a589b1cd4d01a563bf7bac11d0f493 160656 multiboot-doc_0.97-47lenny2_all.deb
Checksums-Sha256: 
 61db3238dc231e719889c69eaa90aafd7416fd20b799f2fce65ea9f8b9054828 1335 grub_0.97-47lenny2.dsc
 5fe634459c51bc7dea7e5296056d5d27e313bb3cceb1e93a28ee43ece3e8eec8 93919 grub_0.97-47lenny2.diff.gz
 c265db869d4233f71f34e5a536c72e8e94dfb49009b889fef054ed61ec75d83a 389142 grub_0.97-47lenny2_i386.deb
 f7cb88f2e4c615f63c69db61eca0b0d6908124208652f7c737377bbd9652919b 115638 grub-disk_0.97-47lenny2_all.deb
 a96f50eaf6aa782eb94cddc477792a8ac1f178031816c51333a1566c2d97f293 115654 grub-doc_0.97-47lenny2_all.deb
 8ce487aba6747aad4d66acbbcb58f875f19b67da24fa998da2b8281ec3f78781 252928 grub-legacy-doc_0.97-47lenny2_all.deb
 d284f498e9d372569dda70e47cd0540bff554cc5f7cd55b4953e84be0ea1aa7a 160656 multiboot-doc_0.97-47lenny2_all.deb
Files: 
 2bcb7f59526e0ac1a9a102ac06aa92b5 1335 admin optional grub_0.97-47lenny2.dsc
 acd307042a3edd10ab806840449f5804 93919 admin optional grub_0.97-47lenny2.diff.gz
 1be70d8bb8eb5b5ed6fe1cbf39431b57 389142 admin optional grub_0.97-47lenny2_i386.deb
 6137c94ec8cd047ba6674c5d0683e1fb 115638 admin optional grub-disk_0.97-47lenny2_all.deb
 88c7a206da2e3ba00b030b1a8e0b4d78 115654 doc optional grub-doc_0.97-47lenny2_all.deb
 863e8375c2cac5fa349ce795d62acbed 252928 doc optional grub-legacy-doc_0.97-47lenny2_all.deb
 a9e336fcb23d20bcb9ea2e00c2701677 160656 doc optional multiboot-doc_0.97-47lenny2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAklw+7EACgkQC19io6rUCv9fOgCdH/X9EvhyioRh6oM7oYuF2yG5
3/0An1oVT7DDv7hXEnCyyHDQE2QLppTr
=9By4
-----END PGP SIGNATURE-----





Reply sent to Robert Millan <rmh@aybabtu.com>:
You have taken responsibility. (Fri, 16 Jan 2009 22:12:10 GMT) Full text and rfc822 format available.

Notification sent to Joey Hess <joeyh@debian.org>:
Bug acknowledged by developer. (Fri, 16 Jan 2009 22:12:10 GMT) Full text and rfc822 format available.

Reply sent to Robert Millan <rmh@aybabtu.com>:
You have taken responsibility. (Fri, 16 Jan 2009 22:12:10 GMT) Full text and rfc822 format available.

Notification sent to Stefan Palm <stefan.palm@vodafone.com>:
Bug acknowledged by developer. (Fri, 16 Jan 2009 22:12:10 GMT) Full text and rfc822 format available.

Reply sent to Robert Millan <rmh@aybabtu.com>:
You have taken responsibility. (Fri, 16 Jan 2009 22:12:11 GMT) Full text and rfc822 format available.

Notification sent to Christoph Hellwig <hch@lst.de>:
Bug acknowledged by developer. (Fri, 16 Jan 2009 22:12:11 GMT) Full text and rfc822 format available.

Reply sent to Robert Millan <rmh@aybabtu.com>:
You have taken responsibility. (Fri, 16 Jan 2009 22:12:12 GMT) Full text and rfc822 format available.

Notification sent to Olleg Samoylov <olleg@mipt.ru>:
Bug acknowledged by developer. (Fri, 16 Jan 2009 22:12:12 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 16 Mar 2009 07:48:32 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 13:38:08 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.