Summary: | sys-boot/grub-0.97-r9: Patch to add btrfs support | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Jochen Seeber <jochen> |
Component: | New packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED WONTFIX | ||
Severity: | enhancement | CC: | ansla80, bugs_gentoo_org.Tim_OKelly, jstein, juggernautfin, kfm, main.haarp, piavka, randy-andy-, tdalman, timmy, trapni, trxman |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 674364 | ||
Bug Blocks: | |||
Attachments: |
btrfs support for grub-0.97
grub_0.97_btrfs.patch |
Description
Jochen Seeber
2009-09-04 09:33:52 UTC
Created attachment 208666 [details, diff]
btrfs support for grub-0.97
Hm, maybe I'm blind, but I don't see any atteched patch.
I've taken the posted patches from Edward Shishkin on the btrfs-ML and put them into shape for gentoo-grub. The patch was made against a full patched grub-0.97 from gentoo. It's tested and works fine for me on a single-device btrfs as root-fs.
The patch triggers this error with USE=netboot enabled: fsys_btrfs.c: In function ‘scan_grub_devices’: fsys_btrfs.c:458: error: ‘network_ready’ undeclared (first use in this function) fsys_btrfs.c:458: error: (Each undeclared identifier is reported only once fsys_btrfs.c:458: error: for each function it appears in.) With this patch, I was able to boot indirectly (using stage2 from a ext3 parition) into a btrfs root filesystem. However, when I try to use the grub shell to update the mbr to boot directly into the btrfs root, I get this: grub> root (hd0,2) Filesystem type is btrfs, partition type 0x83 grub> setup (hd0) Checking if "/boot/grub/stage1" exists... no Checking if "/grub/stage1" exists... no Error 15: File not found (In reply to comment #3) > With this patch, I was able to boot indirectly (using stage2 from a ext3 > parition) into a btrfs root filesystem. However, when I try to use the grub > shell to update the mbr to boot directly into the btrfs root, I get this: > > grub> root (hd0,2) > Filesystem type is btrfs, partition type 0x83 > > grub> setup (hd0) > Checking if "/boot/grub/stage1" exists... no > Checking if "/grub/stage1" exists... no > > Error 15: File not found > i was also facing same problem. later i found that btrfs_stage1_5 is not present under /boot/grub dir even after compilation with this patch so i did manual compilation,installation and copied btrfs_stage1_5 under /boot/grub and it work for me (In reply to comment #4) > i was also facing same problem. later i found that btrfs_stage1_5 is not > present under /boot/grub dir even after compilation with this patch That file was always been present for me, but I still got the 'Error 15: File not found' think. (In reply to comment #1) > Created an attachment (id=208666) [details] > btrfs support for grub-0.97 > > Hm, maybe I'm blind, but I don't see any atteched patch. > > I've taken the posted patches from Edward Shishkin on the btrfs-ML and put them > into shape for gentoo-grub. The patch was made against a full patched grub-0.97 > from gentoo. It's tested and works fine for me on a single-device btrfs as > root-fs. > Please be carefull with this patch. I've tested now with a second machine and with this pacht grub is unable to detect the still present XFS root filesystem. Created attachment 212661 [details, diff]
grub_0.97_btrfs.patch
(In reply to comment #2) > The patch triggers this error with USE=netboot enabled: > > fsys_btrfs.c: In function ‘scan_grub_devices’: > fsys_btrfs.c:458: error: ‘network_ready’ undeclared (first use in this > function) > fsys_btrfs.c:458: error: (Each undeclared identifier is reported only once > fsys_btrfs.c:458: error: for each function it appears in.) > Fixed with the new submitted patch. The new patch also fixes the problem with not detected XFS filesystems. The bug affects other filesystems too, like JFS or ISO9660. The only filesystem which is still (possibly) affected by this bug is FFS. All other should work as expected. (In reply to comment #4) > (In reply to comment #3) > > With this patch, I was able to boot indirectly (using stage2 from a ext3 > > parition) into a btrfs root filesystem. However, when I try to use the grub > > shell to update the mbr to boot directly into the btrfs root, I get this: > > > > grub> root (hd0,2) > > Filesystem type is btrfs, partition type 0x83 > > > > grub> setup (hd0) > > Checking if "/boot/grub/stage1" exists... no > > Checking if "/grub/stage1" exists... no > > > > Error 15: File not found > > > > i was also facing same problem. later i found that btrfs_stage1_5 is not > present under /boot/grub dir even after compilation with this patch so i did > manual compilation,installation and copied btrfs_stage1_5 under /boot/grub and > it work for me > (In reply to comment #3) > With this patch, I was able to boot indirectly (using stage2 from a ext3 > parition) into a btrfs root filesystem. However, when I try to use the grub > shell to update the mbr to boot directly into the btrfs root, I get this: > > grub> root (hd0,2) > Filesystem type is btrfs, partition type 0x83 > > grub> setup (hd0) > Checking if "/boot/grub/stage1" exists... no > Checking if "/grub/stage1" exists... no > > Error 15: File not found > That's a little strange. Did you tried to update the mbr from a btrfs filesystem? I forgot to mention, that setup in grub shell needs a little different handling. grub> root (hdX,Y) grub> setup --stage2=/mnt/grub/stage2 (hdX) The stage2 option tells grug to rewrite the stage2 file by the OS filesystem driver. Without this option, the rewrite is done bypassing the OS, which will fail. So the ebuild should be updated too, to warn users about this. But this doesn't explain the missing stage1. Thank you. It's working fine for me now. (In reply to comment #9) > I forgot to mention, that setup in grub shell needs a little different > handling. > > grub> root (hdX,Y) > grub> setup --stage2=/mnt/grub/stage2 (hdX) Is still does not work for me , see blow: # cat /boot/grub/install-btrfs.sh grub --device-map=/dev/null --batch <<EOF device (hd0) /dev/vda root (hd0,1) setup --stage2=/mnt/grub/stage2 (hd0) EOF # /boot/grub/install-btrfs.sh GNU GRUB version 0.97 (640K lower / 7168K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub> device (hd0) /dev/vda grub> root (hd0,1) Filesystem type is btrfs, partition type 0x83 grub> setup --stage2=/mnt/grub/stage2 (hd0) Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/btrfs_stage1_5" exists... yes Running "embed /boot/grub/btrfs_stage1_5 (hd0)"... 29 sectors are embedded. succeeded Running "install --stage2=/mnt/grub/stage2 /boot/grub/stage1 (hd0) (hd0)1+29 p (hd0,1)/boot/grub/stage2 /boot/grub/menu.lst"... failed Error 15: File not found grub> It does work with the following script: # cat /boot/grub/install-btrfs-ext3.sh grub --device-map=/dev/null --batch <<EOF device (hd0) /dev/vda root (hd0,1) embed /boot/grub/btrfs_stage1_5 (hd0) install /boot/grub/stage1 (hd0) (hd0)1+29 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst EOF # /boot/grub/install-btrfs-ext3.sh GNU GRUB version 0.97 (640K lower / 7168K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub> device (hd0) /dev/vda grub> root (hd0,1) Filesystem type is btrfs, partition type 0x83 grub> embed /boot/grub/btrfs_stage1_5 (hd0) 29 sectors are embedded. grub> install /boot/grub/stage1 (hd0) (hd0)1+29 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst grub> # Any ideas? forgot to mention that (hd0,0) is ext3 and (hd0,1) is btrfs With the 2009-12-11 patch (added to the Ubuntu grub patches in the .deb) applied, grub gave the "Error 15: File not found" error that piavlo mentioned. I had intentionally used compression to be able to fit the operating system on a small ssd disk, and realized that grub is looking for an uncompressed stage1, stage2, btrfs_stage1_5, and menu.lst with fixed offsets on the disk for each. After remounting the root filesystem containing /boot without compression and rewriting /boot on disk ( mv /boot /boot. ; cp -ar /boot. /boot ), grub was satisfied and updated the MBR, but upon rebooting the (Ubuntu) kernel couldn't find the btrfs filesystem on the disk, even though the btrfs kernel modules were in the /boot initrd and, if I remember correctly, were loaded before trying to mount the filesystem. At this point I decided to compile btrfs into the booting kernel, and then the kernel found the btrfs filesystem, but it didn't use the initrd even though it was specified in the boot command line, so I had other driver-related problems. However, after a number of fixes to the /sbin/init boot process, the system now boots directly into a compressed btrfs filesystem without any issues. I should note that a bootable USB disk with syslinux was quite valuable during this process, and I will keep it handy in case a system update accidentally overwrites some of the necessary changes. pushing to -r11 due to other patches going into -r10 (In reply to comment #14) > pushing to -r11 due to other patches going into -r10 > Could someone port the patch for -r11? It can't be apply with -r10 currently. Thanks grub:0 is gone |