Hi, grub 0.97 does not support ext4 extents. I found some patches that might be worth a look. Actually, i'm going to test them, because i converted my system to ext4 some days ago and now i need a working grub. I found one patch that adds support for extents to grub 0.97: https://qa.mandriva.com/show_bug.cgi?id=41227 http://www.mail-archive.com/bug-grub@gnu.org/msg11458.html Maybe you want to unclude that in a new masked ebuild? Reproducible: Always Steps to Reproduce:
Oh, steps to reproduce: - tune2fs -O extents /dev/sdaX - reboot - install new kernel - reboot - grub won't find the kernel image (old files, that have been created prior to enabling extents will continue to work)
I've put grub-0.97-r8 in my overlay and made it use the patch from above. My system bootet fine from a ext4 based partition which grub-0.97-r6 wasn't able to handle.
Created attachment 176095 [details, diff] ebuild patch to include ext4 patch
Created attachment 176097 [details, diff] patch for booting from ext4
For completeness' sake I attached the necessary patches. They just saved my behind as I just accidentally converted my / (typo!) and was already looking forward to terrorbytes to restore from backup, manual booting procedures and whatnot. After remerging grub and adapting the fstab to ext4dev, It Just Worked. Since official ext4 support is coming soon, many more people will need this..
ext4 just went stable in 2.6.28 release moments ago. :-)
The patch doesn't work for me. Grub still refuses to boot from an ext4 partition (hangs at "Loading grub stage 2").
Did you reinstall the first stage? meaning: grub>root (hd0,0) & setup (hd0) or whatever your disks/partitions are.
No, I used: grub-install /dev/sda2 sda2 is ext4. It contains both / as well as /boot. I made an ext2 /boot partition in order to get it work.
(In reply to comment #9) > No, I used: > > grub-install /dev/sda2 You should have installed it to the MBR, that is /dev/sda. The old grub is still in the MBR...
(In reply to comment #10) > (In reply to comment #9) > > No, I used: > > > > grub-install /dev/sda2 > > You should have installed it to the MBR, that is /dev/sda. The old grub is > still in the MBR... Hmm, even after all those years and I'm still confused by boot loaders it seems :P I never did install to sda, only to sda2 which is marked active/bootable. There's Windows XP in sda1 so I never touched the MBR.
(In reply to comment #11) > (In reply to comment #10) > > (In reply to comment #9) > > > No, I used: > > > > > > grub-install /dev/sda2 > > > > You should have installed it to the MBR, that is /dev/sda. The old grub is > > still in the MBR... > > Hmm, even after all those years and I'm still confused by boot loaders it seems > :P I never did install to sda, only to sda2 which is marked active/bootable. > There's Windows XP in sda1 so I never touched the MBR. > Are you sure? Do you select "windows" from grub or from the windows' bootloader? If you do select it from grub, then you must have it installed to the MBR.
(In reply to comment #12) > Are you sure? Do you select "windows" from grub or from the windows' > bootloader? If you do select it from grub, then you must have it installed to > the MBR. Sorry, but you're wrong. You can install grub into the MBR or into the bootsector of any partition on the drive. In case gurb is not installed in the MBR, the mbr had to filled with a little program (that usually comes with windows and even lilo offered sich a thing) that load the bootsector of the partition, that has been marked bootable. And that bootsector can contain grub. This is how things work on a lot of my machines. I always do something like "grub-install /dev/sda2" and mark my sda2 as bootable.
(In reply to comment #13) > (In reply to comment #12) > > Are you sure? Do you select "windows" from grub or from the windows' > > bootloader? If you do select it from grub, then you must have it installed to > > the MBR. > > Sorry, but you're wrong. You can install grub into the MBR or into the > bootsector of any partition on the drive. Yes, I know, > In case gurb is not installed in the MBR, the mbr had to filled with a little > program (that usually comes with windows and even lilo offered sich a thing) > that load the bootsector of the partition, that has been marked bootable. And > that bootsector can contain grub. Sorry, what I meant to say is probably different from what I actually said ;) I meant to ask if there is actually a first stage bootloader at the MBR or not. Since grub was on the sda2 bootsector specially because windows was on sda1 (I understood that from the post), I assumed that on the MBR was the windows bootloader with its menu (I don't use windows so I don't really know...). Hence my (probably stupid) question... :) I didn't knew windows would cooperate with grub though
(In reply to comment #14) > Since grub was on the sda2 bootsector specially because windows was on sda1 (I > understood that from the post), I assumed that on the MBR was the windows > bootloader with its menu (I don't use windows so I don't really know...). Hence > my (probably stupid) question... :) > > I didn't knew windows would cooperate with grub though Since MS-DOS, Microsoft installs some tiny software into the MBR, which simply loads the bootsector of one of the primary partitions (the one that marked as bootable). The actual Windows bootloader (with the menu etc.) is in the bootsector of the partition onto which Windows has been installed.
If it works for everyone else, then it must be an error on my part. It's too painful to try it again though; non-working grub involves a rescue CD to bring the system to boot again, and it's even harder because rescue CDs right now lack recent tools for ext4.
(In reply to comment #16) > If it works for everyone else, then it must be an error on my part. It's too > painful to try it again though; non-working grub involves a rescue CD to bring > the system to boot again, and it's even harder because rescue CDs right now > lack recent tools for ext4. Ok, so much for my "expertise" (or lack of..) [shame on me]. I've only booted the system today, after having to move around all the stuff on my hd. It also doesn't work for me, and it also hangs loading stage2. At present I have two root partitions, one with ext3 and another with ext4. It's just a matter of finding my 64bit live cd to fix the setup back to boot from ext3. They both have the patched grub version, I just "install" from one or from the other. I'll try to find out what's wrong.. Now where is that 64 bit live cd??? :/
Just checking, for those who can actually boot from an ext4 partition, have you converted from ext3 or formated as ext4 and copied over the files? I ask this because unpatched grub should be able to read ext4 if it's still formated as ext3 (which happens if you just converted the partition).
(In reply to comment #18) > Just checking, for those who can actually boot from an ext4 partition, have you > converted from ext3 or formated as ext4 and copied over the files? > > I ask this because unpatched grub should be able to read ext4 if it's still > formated as ext3 (which happens if you just converted the partition). 1) first my ext3 was only mounted using ext4 (rootfstype=ext4) without turning on the extents feature (unpatched grub worked fine) 2) then i turned on the extents feature (mounting as ext3 wouldn't work anymore) and grub also continued to work, until the day i installed a new kernel. New files seem to use the extents feature while the old files remain readable for grub. 3) then i wrote my own grub-ebuild using the patch, re-emerged grub and booting worked again.
I copied my / with "rsync -axHA" to another ext3 partition. Then I booted from that partition and formatted my real one with "mkfs.ext4 -L GentooRoot /dev/sda2". Then I rsynced the data back from the ext3 to the ext4 partition and installed (the patched) grub.
Ok, so my procedure was very much like Nikos', except I used "cp -a". I was able to boot the kernel from the ext4 partition if the bootloader files were on the ext3 one. Sven, could you possibly cp grub files to another place, rm the old ones and mv them back? (This is probably dangerous!) I suspect grub doesn't like its files to be on an ext4 partition... I've got to investigate this further.
I'm sorry guys, but do you actually have something to contribute here, except the original report + Holger's work on the patches? There are 21 comments, already, and most of them are chatting. Also, for the record, I hope you understand now, why there is still in hanbooks the separate /boot partition on ext2. Please, reconsider if your comment will be "helpful" for base-system@ , instead of just make them read 21 comments and 23-24 mails (some of them with "historical information"). Thank you all, and I hope I don't bother you.
Yes, namely that the patch doesn't work. The people are trying to figure out if it's actually the patch that doesn't work or if they made some error with the install. Furthermore, if the patch indeed doesn't work for some people, they're trying to find out under what circumstances it works/doesn't work, which is always helpful in bug reports. Bug reports with just "doesn't work" in them are rather unhelpful.
It would be much appreciated if when you 're doing what you describe above, you can explain the situation more briefly, in order to let us understand what really matters. Thank you for your help, again. Let's just don't pollute more the bug, please.
Ok, I'm now able to boot from ext4. I did two things, so it can be either of them (or both). Nikos can you try them please? First I installed grub manually [grub, root (hd0,0), setup (hd0)], not with grub-install. Second, I recompiled grub with -Os. I already had trouble with -O3 and was forced to compile with -O2. Even though it seemed to work, it was possibly malfunctioning. I hope this helps :)
Quick note, grub-install has always complained for the past year for me when booting from the gentoo install cd. As such, easier install using grub command line. Also, compiling grub w/ -03 (or other custom cflags) is a known killer! (I found this with either -O3 or -march=pentium3) echo "sys-boot/grub -custom-cflags" >> /etc/portage/package.use
Another interesting note, this ebuild pulls grub version 1.96 from their ftp and the file is dated "02/03/08"! This is almost a year old.
Created attachment 176556 [details] Alternative ext4 patch I'm sincerely not sure where the patch in this bug comes from (I haven't read it too deeply to be honest), but this is a patch adapted out of http://code.google.com/p/grub4ext4/ (it's considerably bigger afaics), adapted to apply on the top of Gentoo's patches. Prepared this in a hurry tonight after converting / without turning my brain on. The filesystem was formatted from scratch, and rsync'd over, extents enabled.
FYI: Grub2 seems to have a new config file (& layout??). As such, need to reconfigure before rebooting or you'll get a nice command grub prompt! ;-)
@#$@#%@#$ Strike comment #29 from the record. Was meant for another bug. (D*rn bugzilla won't let me delete my own junk.)
patchset 1.9 now exists (0.97-r9) and contains flameeyes' patch. I tested the patch on my laptop, with /boot on: ext2, ext3, ext4 # mkfs.ext4 /dev/sda1 -O large_file,dir_index,filetype,flex_bg,extent,uninit_bg,resize_inode,sparse_super -L /boot