Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#10639 - grub 0.97-12 - gpt patch broke partition commands

Attached to Project: Arch Linux
Opened by Michal Soltys (msoltyspl) - Wednesday, 11 June 2008, 16:57 GMT
Last edited by Ronald van Haren (pressh) - Wednesday, 12 November 2008, 11:02 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Aaron Griffin (phrakture)
Alexander Baldeck (kth5)
Thomas B├Ąchler (brain0)
Ronald van Haren (pressh)
Andreas Radke (AndyRTR)
Dan McGee (toofishes)
Architecture All
Severity Medium
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


This is common on all my arch systems, where grub supplied with gpt patch is used. Partition related commands, like parttype, hide, unhide don't work anymore, always returning
"Error 22: No such partition", both from boot shell and os shell.

I made a quick test and recompiled the grub w/o gpt patch, and the problem is gone - so the culprit is in it somewhere. I haven't digged any deeper in the code though.
This task depends upon

Closed by  Ronald van Haren (pressh)
Wednesday, 12 November 2008, 11:02 GMT
Reason for closing:  Fixed
Additional comments about closing:  patch removed in grub 0.97-14
Comment by Andreas Radke (AndyRTR) - Wednesday, 11 June 2008, 22:03 GMT Comment by Gerhard Brauer (GerBra) - Friday, 13 June 2008, 09:09 GMT
I could confirm this.
As i'm was the "guy with the gpt patch" i would meantime prefer to remove this patch. If one needs GPT support in grub it's easier to build a own grub (or we put a package in AUR). Also my approach to Arch and patching have changed, maybe this report and the discussion would be a good argument against patching in core packages.

One thing of interesst: Could someone with a gpt-patched grub on another distro (debian,gentoo) also confirm this on their patched grub? I have no access to such a machine currently, so test could be: set partition type of your swap partition
to swap (which was no change, but test the command):
parttype (hd0,0) 0x82
were hd0,0 must reflect the swap partition of YOUR installation.
Comment by Gerhard Brauer (GerBra) - Monday, 27 October 2008, 13:05 GMT
I wan't to push this report again. On we have another problem resulting from the gpt-patch where hide/unhide of windows partitions get failed with this error. The OP says, that neither Ubuntu or gentoo have this problem (and these distris have a gpt patched grub).

So we should look what else must be patched to get back the grub base functions (and gpt). Or we revert the patch, have a full functionally grub again, and if someone needs gpt or other patches in Grub he should do this himselve (or via a AUR grub paket).
I would assume to remove the gpt patch ASAP, it breaks the bootloader.
Comment by Gerhard Brauer (GerBra) - Tuesday, 28 October 2008, 20:29 GMT
Ok, i've found the reason what's wrong with the gpt patch file. The author has made syntax errors: he patched the code for some sources so that a if-construct follows directly after a while, before the opening { on this while. So the while-block was never checked.

There was a comment from Robin Johnson in this thread which takes me on the path. Im not a c developer but after some hours staring on the patch code an some cups of strong coffee i saw the mistake ;-)

I attach a patch which fixes these. It's a patch against the patched code when grub-0.97-gpt.patch has beed applied. So my fix should run after this patch. Cause this is patching a patch i think it's not the best way. But i'm not very firm with patches, so if one of you could perhaps correct the grub-0.97-gpt.patch-File direkt...
(Oh my english... May anyone understand what i mean with that.. ;-)

Comment by Gerhard Brauer (GerBra) - Wednesday, 29 October 2008, 12:26 GMT
Thomas pointet me to the combinediff tool, so here is a better gpt patch, it should replace the original grub-0.97-gpt.patch.
Comment by Aaron Griffin (phrakture) - Thursday, 30 October 2008, 21:35 GMT
Andy, the decision to either revert, or apply the fixed patch is left to you. I'd probably prefer removing the patch altogether, but i'm not strongly opinionated either way