On Oct 14, 2013, at 5:09 PM, Chris Murphy <li...@colorremedies.com> wrote:
> > On Oct 14, 2013, at 3:01 PM, Vladimir 'φ-coder/phcoder' Serbinenko > <phco...@gmail.com> wrote: > >> On 14.10.2013 22:45, Chris Murphy wrote: >>> >>> On Oct 14, 2013, at 1:29 PM, Vladimir 'φ-coder/phcoder' Serbinenko >>> <phco...@gmail.com> wrote: >>> >>>>> So it seems that GRUB is using relative pathnames to the default >>>>> subvolume. >>>> This is not intentional. When this part of code was written there was no >>>> set-default available at all so this couldn't be tested and I simply >>>> followed the specification. It told to take root_tree and >>>> root_dir_objectid from superblock then go to "default" directory. What >>>> of this needs to be changed? Just remove "default" and make it part of >>>> path? We would need to change grub-mkrelpath to match runtime behaviour. >>>> Is there a way to detect that mountinfo gives garbage and somehow get >>>> where the real root points? >>> >>> Here's the response. It seems similar but not identical to what you >>> described above. >>> >>> http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg27955.html >>> >> Possibly this is the answer: >> === modified file 'grub-core/fs/btrfs.c' >> --- grub-core/fs/btrfs.c 2013-01-21 01:33:46 +0000 >> +++ grub-core/fs/btrfs.c 2013-10-14 21:00:53 +0000 >> @@ -1217,7 +1217,7 @@ >> >> *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; >> *tree = data->sblock.root_tree; >> - key->object_id = data->sblock.root_dir_objectid; >> + key->object_id = grub_cpu_to_le64_compile_time (5); >> key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; >> key->offset = 0; >> skip_default = 1; >> > > I applied this to current bzr and built it. With the default default > subvolume, i.e set-default is ID 5, I get: > > GRUB loading .. > Welcome to GRUB! > > error: file '/' not found. > Entering rescue mode… > grub rescue> > Nevermind. The /etc/fstab was technically not valid at the time I ran grub-install, because I was using subvolid= there, and grub-install probably picked that up. So with your change applied, I can still boot with 'btrfs subvol set-default 5 /'. However if I change the default subvolume, I get the same results as without the change: error: file 'boot/grub/i386-pc/normal.mod' not found Entering rescue mode… grub rescue> set prefix=(hd0,msdos1)/boot/grub root=hd0,msdos1 grub rescue> ls (hd0,msdos1)/ youfoundme So instead of it listing the subvolumes in the top level ID 5 subvolume, which includes /boot, it lists 'youfoundme' which is a file in a nested subvolume with ID 266 that has been 'btrfs subvol set-default 266 /' Chris Murphy _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel