From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bSPwt-0006p6-A2 for mharc-grub-devel@gnu.org; Wed, 27 Jul 2016 10:36:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSPwl-0006hR-9j for grub-devel@gnu.org; Wed, 27 Jul 2016 10:36:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSPwi-0007l4-VO for grub-devel@gnu.org; Wed, 27 Jul 2016 10:36:30 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:34092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSPwi-0007kq-Jj for grub-devel@gnu.org; Wed, 27 Jul 2016 10:36:28 -0400 Received: by mail-pf0-x243.google.com with SMTP id g202so1968370pfb.1 for ; Wed, 27 Jul 2016 07:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=Hd/GXUmm0BDglXZR70TPHqr8xXjSREAK+PMPxEuypVk=; b=O+PTk1DpNaLdk6bUoDW+xT+tF3fyxqicIE5PXKgxeRCV/k/En3pAzzDAt96lSFYk+r Bkjl3f+cvkxqUCTHG0B6393atHeX/KzjOAiLvCuTSH1AR2fe9wig2uWHs94HwOrwNP7k dZS9OUNs1gseeTUmixoyfdQPOW1GBgWeLhaJbUNt63OzGvzq5IBHtpC44NINB3Ogcdjy QMgRdEfiH46kAVX+LrXbq3EhVjRbg2sytnF60LaBt+j7G+YP2bzbfYgbsAkn5WXL2CoM 1dd5wykeVFOTa+UCILY9O3DkLhzudU4Sp8m3kfYX1z8182+b9Op7SfdqfgkCv3w6Z4cr KqnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=Hd/GXUmm0BDglXZR70TPHqr8xXjSREAK+PMPxEuypVk=; b=MY61IAmCcJzRZQVN2FruRBhDHDchwLnXLPf4Sw7bwBbebauQTxXT2sluqPQ1PQGdtm x61OnyCjb5janbisKdCDkTdAtLp1bG7YERmftWWoSFz/NY2sa4aYer3G9n5bR+cTtRF/ KIZ159pZEXZPByHQ1AbJOO7pK56S3Wy4pICwnfPa25RQf4EHlIGFLAND9jNwaEZdkK95 ydYFgeuDCZBRAMhMvDyfjF+U9XFx7zQNzGb2hTo61hRcpT5crE/I9jbP1BEw3phTe1rB tePOEkyvrrWTWHSmhTZySYFwvxt8w3BesEbJ+QpleePaRKbrtqt3zgJnOwiR37O1Fv83 xzjQ== X-Gm-Message-State: AEkoouu5fxp9/mjFvEYly0JA1d5wVbbfTRnOCJbOmoLJc+fsjYfJX8WVLvMIJjUZuw/heQ== X-Received: by 10.98.15.145 with SMTP id 17mr50165436pfp.40.1469630184950; Wed, 27 Jul 2016 07:36:24 -0700 (PDT) Received: from ?IPv6:2601:602:9c00:cf41:a15c:1ca:cdf1:57a3? ([2601:602:9c00:cf41:a15c:1ca:cdf1:57a3]) by smtp.googlemail.com with ESMTPSA id yv9sm9954796pab.0.2016.07.27.07.36.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jul 2016 07:36:24 -0700 (PDT) Subject: Re: [GRUB PARTUUID PATCH 2/2] Update grub script template files To: Andrei Borzenkov , The development of GNU GRUB References: <41dbc01b-c380-f7d6-fcf4-b421b1352b97@gmail.com> From: Nick Vinson Message-ID: <0ceaa6dc-0fa6-d2f6-27da-de07b7f023d5@gmail.com> Date: Wed, 27 Jul 2016 07:36:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <41dbc01b-c380-f7d6-fcf4-b421b1352b97@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mJQGc08XJobluFtH8BUEANXcgxj8K5RuU" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::243 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 14:36:38 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mJQGc08XJobluFtH8BUEANXcgxj8K5RuU Content-Type: multipart/mixed; boundary="QCH2SoMOrrknHuVaftQoTwwvv72uq3wcB" From: Nick Vinson To: Andrei Borzenkov , The development of GNU GRUB Message-ID: <0ceaa6dc-0fa6-d2f6-27da-de07b7f023d5@gmail.com> Subject: Re: [GRUB PARTUUID PATCH 2/2] Update grub script template files References: <41dbc01b-c380-f7d6-fcf4-b421b1352b97@gmail.com> In-Reply-To: <41dbc01b-c380-f7d6-fcf4-b421b1352b97@gmail.com> --QCH2SoMOrrknHuVaftQoTwwvv72uq3wcB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/26/2016 10:01 PM, Andrei Borzenkov wrote: > 20.06.2016 04:37, Nicholas Vinson =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> Update grub-mkconfig.in and 10_linux.in to support grub-probe's new >> partuuid target. >> >> Signed-off-by: Nicholas Vinson >> --- >> util/grub-mkconfig.in | 2 ++ >> util/grub.d/10_linux.in | 11 +++++++++-- >> 2 files changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in >> index f8496d2..fc42462 100644 >> --- a/util/grub-mkconfig.in >> +++ b/util/grub-mkconfig.in >> @@ -134,6 +134,7 @@ fi >> # Device containing our userland. Typically used for root=3D paramet= er. >> GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice /`" >> GRUB_DEVICE_UUID=3D"`${grub_probe} --device ${GRUB_DEVICE} --target=3D= fs_uuid 2> /dev/null`" || true >> +GRUB_DEVICE_PARTUUID=3D"`${grub_probe} --device ${GRUB_DEVICE} --targ= et=3Dpartuuid 2> /dev/null`" || true >> =20 >> # Device containing our /boot partition. Usually the same as GRUB_DE= VICE. >> GRUB_DEVICE_BOOT=3D"`${grub_probe} --target=3Ddevice /boot`" >> @@ -182,6 +183,7 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" =3D "xsaved" ] ; th= en GRUB_ACTUAL_DEFAULT=3D"`"${grub >> # override them. >> export GRUB_DEVICE \ >> GRUB_DEVICE_UUID \ >> + GRUB_DEVICE_PARTUUID \ >> GRUB_DEVICE_BOOT \ >> GRUB_DEVICE_BOOT_UUID \ >> GRUB_FS \ >> diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in >> index de9044c..8081fdb 100644 >> --- a/util/grub.d/10_linux.in >> +++ b/util/grub.d/10_linux.in >> @@ -220,8 +220,15 @@ while [ "x$list" !=3D "x" ] ; do >> gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" = >&2 >> elif test -z "${initramfs}" ; then >> # "UUID=3D" and "ZFS=3D" magic is parsed by initrd or initramfs. = Since there's >> - # no initrd or builtin initramfs, it can't work here. >> - linux_root_device_thisversion=3D${GRUB_DEVICE} >> + # no initrd or builtin initramfs, it can't work here. However, i= f >> + # GRUB_DEVICE_PARTUUID is not empty we can use that here if >> + # GRUD_DISABLE_LINUX_UUID is not set to true. >> + if [ "x${GRUB_DISABLE_LINUX_UUID}" !=3D "xtrue" ] >> + && [ "x${GRUB_DEVICE_PARTUUID}" !=3D "x" ]; then >> + linux_root_device_thisversion=3D"PARTUUID=3D${GRUB_DEVICE_PAR= TUUID}" >=20 > Well, PARTUUID appeared first in 2.6.37 and MSDOS "UUID" in 3.10. > Unfortunately we have no way to check for it, even as fragile as stored= > kernel config. So I am not sure we should do it by default. And if we > add some extra knob to turn it on, as you mentioned yourself, you can > simply add root=3DPARTUUID=3Dxxx to stored kernel command line. I've done that using /etc/default/grub and it works, but you end up with two root=3D... entries in your kernel command line. I could have gone back and edited the grub.cfg to clean up the command-line. I will adjust the logic so that using PARTUUID is an opt-in feature instead of an opt-out feature. Downstream distributions would then be able to adjust GRUB's defaults in their own packaging and turn this feature on by default if it made sense for them to do so. >=20 > One more consideration is that reinstalling in existing partition will > invalidate FS UUID stored in grub.cfg which is arguably the right thing= > because you now have something different there, but PARTUUID will most > likely remain the same. I am sorry, but I am not sure I understand the issue you are raising here= =2E If I boot Linux without an initramfs, I must specify where the root partition (or device, if the device has no partitions) is. GRUB currently does this by setting root to something like '/dev/sda3'. That said, this is a Linux limitation not GRUB's. Linux is unable to use the FS UUID this early in the boot process. If I have an initramfs, I *may* be able to use the FS UUID. In this case, it all depends on the implementation of my initramfs. However, GRUB's current behavior is to assume that all initramfs implementations understand how to handle UUIDs, that the UUID is the FS UUID, and are able to mount rootfs properly. I have no interest in debating if that behavior is correct or not, nor do I have any interest in changing it. As currently written, my patch should favor the FS UUID when an initramfs is detected, the PARTUUID when it is not, and the Linux device naming scheme when the UUID feature is disabled or the PARTUUID could not be found. The rationale for favoring PARTUUID over the linux device name is because the PARTUUID would allow a system to boot if the device with the root partition is ever renamed. In other words, if the device was sda when grub.cfg was created, but somehow became sdb (or the other way around), the system would sill be able to boot because the kernel would still be able to find /sbin/init. Whereas with the linux device name, the boot would fail because it would be looking at the wrong device for /sbin/init (FS UUID provides the same protections, but in theory allows use to reorder partitions on a single device and still boot successfully without having to regenerate the grub.cfg). If there is something I am missing, let me know, so I can address it. Thanks, Nicholas Vinson >=20 >> + else >> + linux_root_device_thisversion=3D${GRUB_DEVICE} >> + fi >> fi >> =20 >> if [ "x$is_top_level" =3D xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != =3D xy ]; then >> >=20 --QCH2SoMOrrknHuVaftQoTwwvv72uq3wcB-- --mJQGc08XJobluFtH8BUEANXcgxj8K5RuU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXmMbkAAoJEAQpRPZaa5gqtKEP/Ryn0p4b7b0AhtotDhbs3qpo Xo7k6tigtcjF36XK5Kh16Ycg8j53EldjNALjPxC+7jzj/8ZhtxXe16ipfWhAaVVz kmTM5XDB+pbKgJS3+Al7+aGEh6Hs9Y/8k1jSUzRxHd+1S2F3AbzKShKVVb3RD8bh 8KLBlgf0F1XEayZCVShI0ooH4BizohCYXXXrdy4wdfOmBFEyogd5H6EDnqO5BJM1 Y8ooa153mvB4i/xozWcDfl0NtGIt9ghGhsfIyNcy4JJS7cTfJHJAZ/ZCdz1HE2fx JXhg9ZQjbPYBdVaRid6A5YgMK80O9Lajx17obDSCecZNKuHap/4KLefCz+Oaqzse wgxsH6TnbszcHXZu/QCfIdOl8U2AMY4X5uDtz2jmo5k71YsA6avv/76pF4Inptjk LHh1eSaac/A2pacvL0VeOBKWQJZ3pzTd0PFE1DbJxBwcVHuaBTw3UlqzE+excWN7 lzXEuVm/YY7TUUHvExaxsj/HbHcJMBROM5ItGyXghAdrU0jTy21sO8Pco2DwG0I6 Zv10WRv0gnx/sxWwHG2gUtzvUJbubCsYLadjxxRit+Q8vtbErIqs9YXXWQNQWDkS AQiHCGGA2f2jK/Hl3x+tiuHt2KtH8oJXrZoN6mj4SAIS+MEyuWOOia0qydnDtlP8 GresP/GKkgeE7PepMYHN =1luA -----END PGP SIGNATURE----- --mJQGc08XJobluFtH8BUEANXcgxj8K5RuU--