From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XyOuo-0007XU-Qb for mharc-grub-devel@gnu.org; Tue, 09 Dec 2014 12:49:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyOuj-0007XE-7H for grub-devel@gnu.org; Tue, 09 Dec 2014 12:49:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyOuc-00077H-QA for grub-devel@gnu.org; Tue, 09 Dec 2014 12:49:33 -0500 Received: from mondschein.lichtvoll.de ([194.150.191.11]:60109 helo=mail.lichtvoll.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyOuc-00077B-HB for grub-devel@gnu.org; Tue, 09 Dec 2014 12:49:26 -0500 Received: from merkaba.localnet (unknown [188.174.192.218]) by mail.lichtvoll.de (Postfix) with ESMTPSA id 0C937A2; Tue, 9 Dec 2014 18:49:16 +0100 (CET) From: Martin Steigerwald To: Andrei Borzenkov Subject: Re: Bug#747653: grub2-common: update-grub adds both devices and a line feed for BTRFS RAID 1 setup Date: Tue, 09 Dec 2014 18:49:21 +0100 Message-ID: <5209642.2kf49jzVN6@merkaba> User-Agent: KMail/4.14.2 (Linux/3.18.0-tp520; KDE/4.14.2; x86_64; ; ) In-Reply-To: <20141208230924.36804ca7@opensuse.site> References: <20140510185334.5756.69796.reportbug@merkaba.lichtvoll> <16494259.4vNOI0uB2Y@merkaba> <20141208230924.36804ca7@opensuse.site> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 194.150.191.11 Cc: Debian Bug Tracking System , The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 17:49:38 -0000 Am Montag, 8. Dezember 2014, 23:09:24 schrieb Andrei Borzenkov: > =D0=92 Sat, 06 Dec 2014 12:01:11 +0100 >=20 > Martin Steigerwald =D0=BF=D0=B8=D1=88=D0=B5=D1=82= : > > Am Montag, 2. Juni 2014, 19:39:22 schrieb Andrey Borzenkov: > > > =D0=92 Sat, 10 May 2014 20:53:34 +0200 > > >=20 > > > Martin Steigerwald =D0=BF=D0=B8=D1=88=D0=B5= =D1=82: > > > > Package: grub2-common > > > > Version: 2.02~beta2-10 > > > > Severity: normal > > > >=20 > > > > Dear Maintainer, > > > >=20 > > > > I am booting my Debian system via a BTRFS RAID 1 which spans a = logical > > > > volume on a Crucial MSATA and Intel SATA SSD each. > > > >=20 > > > > After running update-grub I am getting this in /boot/grub/grub.= cfg: > > > > echo 'Linux 3.15.0-rc5-tp520 wird geladen =E2= =80=A6' > > > > linux /vmlinuz-3.15.0-rc5-tp520 > > > > root=3D/dev/mapper/sata-debian > > > > =20 > > > > /dev/mapper/msata-debian ro rootflags=3Dsubvol=3Ddebian= > > > > init=3D/bin/systemd resume=3D/dev/mapper/sata-swap> > > > > =20 > > > > echo 'Initiale Ramdisk wird geladen =E2=80=A6= ' > > > > initrd /initrd.img-3.15.0-rc5-tp520 > > > >=20 > > > > update-grub basically adds both devices of the BTRFS RAID 1 dev= ice > > > > separated by a line feed. For mounting BTRFS RAID 1 tough one o= f them > > > > is enough, once btrfs device scan is run, for which I currently= use an > > > > script for initramfs-tools as a work-around as it didn=C2=B4t w= ork out of > > > > the box on my last tests[1]. > > > >=20 > > > > This behaviour is due to grub-probe which is called by grub-mkc= onfig > > > > at line 139 > > > >=20 > > > > 138 # Device containing our userland. Typically used for root=3D= > > > > parameter. > > > > 139 GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice /`" > > > > 140 GRUB_DEVICE_UUID=3D"`${grub_probe} --device ${GRUB_DEVICE} > > > > --target=3Dfs_uuid 2> /dev/null`" || true > > > >=20 > > > > which is called by update-grub returns both devices with a > > > > linefeed: > > > >=20 > > > > merkaba:~> grub-probe --target=3Ddevice / > > > > /dev/mapper/sata-debian > > > > /dev/mapper/msata-debian > > > >=20 > > > > grub-probe is an ELF binary. > > > >=20 > > > > The following little change workarounds the issue for me: > > > >=20 > > > > merkaba:~> diff -u /usr/sbin/grub-mkconfig.dist > > > > /usr/sbin/grub-mkconfig > > > > --- /usr/sbin/grub-mkconfig.dist 2014-05-08 14:35:25.000= 000000 > > > > +0200 > > > > +++ /usr/sbin/grub-mkconfig 2014-05-10 20:46:00.380096263 += 0200 > > > > @@ -136,7 +136,7 @@ > > > >=20 > > > > fi > > > > =20 > > > > # Device containing our userland. Typically used for root=3D > > > > parameter. > > > >=20 > > > > -GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice /`" > > > > +GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice / | head -1`" > > > >=20 > > > > GRUB_DEVICE_UUID=3D"`${grub_probe} --device ${GRUB_DEVICE} > > > > --target=3Dfs_uuid > > > > 2> /dev/null`" || true > > > > =20 > > > > # Device containing our /boot partition. Usually the same as > > > > GRUB_DEVICE. > > > >=20 > > > > But I suppose the real fix is to be made in the binary grub-pro= be. > > >=20 > > > No, grub-probe is correct; grub needs to know all devices so it c= an > > > have full information which drivers it requires to access them. > > >=20 > > > See also > > > https://lists.gnu.org/archive/html/grub-devel/2014-05/msg00005.ht= ml > > >=20 > > > I suggest you discuss it with Colin, but for now I tend to think,= fix > > > should go into 10_linux. May be always use UUID for btrfs. > > >=20 > > > But this sounds like new can of worms :( > >=20 > > Any way on how to proceed on this one? >=20 > Try patch below >=20 > From: Andrei Borzenkov > Subject: [PATCH] fix linux kernel root=3D argument with multidev btrf= s >=20 > Btrfs may reside on multiple devices, but only one of them should be > passed to root=3D kernel argument. Add two helper functions: >=20 > - get_root_device: select "best" device for the list. For single devi= ce > just return it to skip probing; for multiple devices try to find LVM = as > before but fall back to the first device if not found. >=20 > - find_abstraction: return device with requested abstraction driver f= rom > the given list. >=20 > Refactor code to use them and reimplement uses_abstraction on top of > find_abstraction. >=20 > Also replace check for LVM with uses_abstraction in 10_kfreebsd. >=20 > --- > util/grub-mkconfig_lib.in | 50 > ++++++++++++++++++++++++++++++++++----------- util/grub.d/10_kfreebsd= .in | > 8 +++----- > util/grub.d/10_linux.in | 10 +++++---- > util/grub.d/20_linux_xen.in | 10 +++++---- > 4 files changed, 53 insertions(+), 25 deletions(-) >=20 > diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in This looks like it needs to be applied to grub sources instead a instal= led=20 grub. > # Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT= . [=E2=80=A6] > tg: (17328db..) u/btrfs-multidev (depends on: master) Or I can use some version control branch? I don=C2=B4t see the branch on http://git.savannah.gnu.org/cgit/grub.git/refs/heads Where can I clone it? And then I just build it and copy over the generated files from the fil= es the=20 patch changed manually to my installed grub to test? I have grub-pc 2.02~beta2-17 debian package installed. Thanks, --=20 Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7