Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XxD78-0007Q3-TJ for mharc-grub-devel@gnu.org; Sat, 06 Dec 2014 06:01:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxD72-0007OK-6c for grub-devel@gnu.org; Sat, 06 Dec 2014 06:01:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxD6w-000854-PJ for grub-devel@gnu.org; Sat, 06 Dec 2014 06:01:20 -0500 Received: from mondschein.lichtvoll.de ([194.150.191.11]:50311 helo=mail.lichtvoll.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxD6w-00084i-CV for grub-devel@gnu.org; Sat, 06 Dec 2014 06:01:14 -0500 Received: from merkaba.localnet (ppp-88-217-112-49.dynamic.mnet-online.de [88.217.112.49]) by mail.lichtvoll.de (Postfix) with ESMTPSA id 0B4E1222; Sat, 6 Dec 2014 12:01:12 +0100 (CET) From: Martin Steigerwald To: Andrey Borzenkov Subject: Re: Bug#747653: grub2-common: update-grub adds both devices and a line feed for BTRFS RAID 1 setup Date: Sat, 06 Dec 2014 12:01:11 +0100 Message-ID: <16494259.4vNOI0uB2Y@merkaba> User-Agent: KMail/4.14.2 (Linux/3.18.0-rc7-tp520; KDE/4.14.2; x86_64; ; ) In-Reply-To: <20140602193922.18d3a188@opensuse.site> References: <20140510185334.5756.69796.reportbug@merkaba.lichtvoll> <20140602193922.18d3a188@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: Sat, 06 Dec 2014 11:01:25 -0000 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 logi= cal > > 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=20 > > 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 device > > separated by a line feed. For mounting BTRFS RAID 1 tough one of th= em > > 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 work = out of > > the box on my last tests[1]. > >=20 > > This behaviour is due to grub-probe which is called by grub-mkconfi= g > > at line 139 > >=20 > > 138 # Device containing our userland. Typically used for root=3D p= arameter. > > 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-mkco= nfig > > --- /usr/sbin/grub-mkconfig.dist 2014-05-08 14:35:25.0000000= 00 > > +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 para= meter. > >=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} --targe= t=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-probe. >=20 > No, grub-probe is correct; grub needs to know all devices so it can > have full information which drivers it requires to access them. >=20 > See also > https://lists.gnu.org/archive/html/grub-devel/2014-05/msg00005.html >=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 :( Any way on how to proceed on this one? I applied merkaba:/usr/sbin> diff -u grub-mkconfig.dist grub-mkconfig --- grub-mkconfig.dist 2014-05-08 14:35:25.000000000 +0200 +++ grub-mkconfig 2014-05-10 20:46:00.380096263 +0200 @@ -136,7 +136,7 @@ fi =20 # Device containing our userland. Typically used for root=3D paramete= r. -GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice /`" +GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice / | head -1`" GRUB_DEVICE_UUID=3D"`${grub_probe} --device ${GRUB_DEVICE} --target=3D= fs_uuid 2> /dev/null`" || true =20 # Device containing our /boot partition. Usually the same as GRUB_DEV= ICE for a dozen of times meanwhile. It works for me. I understand that it may not work if the first drive i= s not on LVM, while the second is, as I bet grub would not load LVM drive= r then. Anyway I still boot of a small Ext4 /boot. Well I dpkg-diverted the file for now, but this way I risk breakage on upgrades as changes to the file are not automatically applied. Maybe above can just to into 10_linux, *just* for the root=3D kernel co= mmand line. Or=E2=80=A6 it could additional devices on kernel command line in that = BTRFS syntax, for non initrd users, but that might break as well as between update-grub a= nd boot may be changes of device paths. So either just supplying the first device on kernel command line or the= UUID sounds reasonable to me. Either way BTRFS will require a btrfs device s= can call in initrd, but unless you do add the devices manually on kernel co= mmand line thats just how it is. This is discussed currently in=E2=80=A6 hmmm= , I thought there was a discussion on BTRFS mailing list, but I do not find it at t= he moment. Ciao, --=20 Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7