Received: (at 27709) by debbugs.gnu.org; 13 Aug 2018 20:04:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 13 16:04:08 2018 Received: from localhost ([127.0.0.1]:49952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1fpJ4S-0005G0-CU for submit <at> debbugs.gnu.org; Mon, 13 Aug 2018 16:04:08 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pali.rohar@HIDDEN>) id 1fpIte-0004xg-69 for 27709 <at> debbugs.gnu.org; Mon, 13 Aug 2018 15:52:58 -0400 Received: by mail-wr1-f68.google.com with SMTP id e7-v6so15254231wrs.9 for <27709 <at> debbugs.gnu.org>; Mon, 13 Aug 2018 12:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=A+lQDaU7cBqVYRPWQQz0Z0hs8zG8xpa3uHMEpYQkipU=; b=ESk/0pp5447p72/RXcyttWPJEIC+kPlmH1SXi/JsHsD7TJK/Q/xKTO1X+WpPODHxWb OF0senbpsWF6rQYaHd9XA1Gwgq2P3fUzguk8nVUS4V7IDPw/Zdi7LwCSXAitxmwP3apa eFNX06tthC9flEsRzijVJuwbAENd2JWaJmCeKGtFaWQcZ7eeochCpdzp2VxoC2y1bTOm iTkjdU7uxfRkOs950CqyXubPOitr1ptKnAnDKcUN1QEv2fIYAzkWuuEq3tsMHQnskl9O Izi//7wvd7KzkaDEtUMcAguALSlYiN1TgmwssoGyjnaj4PS7HP8ZExGvlIqaGhGOPFjz YLdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=A+lQDaU7cBqVYRPWQQz0Z0hs8zG8xpa3uHMEpYQkipU=; b=AKd8WKM+Zhfv2sddhL6NP3p2EuphPayAf3Tpc70aMooKbH7/lstdQQh9So61Tkbm7w r8IcEb8wr+W3bF8HxndcLbg8a2gApEKW5AaCvoxA5unQeS0EdMB5qseOX7C0AOXWWb7p 7oF5V5DpnZJEJ3SIxReYHUvhy4n31ev1ZMe21QdFBCYn3n4jFxg+rj+rIBB+wSjiLBc4 zOZ+Cs0OKLIbDLTfRE+I+C7wFnaTHEyhjFXVH0CHRZMjz+phzaIrZlaINaXrrKNeXu3X Qgvu3H4BnQ4O72YLDSBlwH5z7Am9uFwR5hkCgS06ZhHdYyaNTK8T4Om72AFjeWjEq4DI XY6g== X-Gm-Message-State: AOUpUlGQKvUUtV3lCNMCETfzOkFM2r4c9jXPHt9Ij5Zce0NnnNUz1CFf BMgAK8CTEV4QxRR0JVrl8Io07P+cGjE= X-Google-Smtp-Source: AA+uWPxDvTyBOUNA2t6vLix9DGnHpcF+ZvpMuuukCfkMDmzcqRNKAfyDjflPuOmt7uvNTdcIdSOA8g== X-Received: by 2002:adf:a29b:: with SMTP id s27-v6mr12196160wra.100.1534189971851; Mon, 13 Aug 2018 12:52:51 -0700 (PDT) Received: from pali ([2a02:2b88:2:1::5cc6:2f]) by smtp.gmail.com with ESMTPSA id c129-v6sm15795265wmh.2.2018.08.13.12.52.50 for <27709 <at> debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Aug 2018 12:52:51 -0700 (PDT) Date: Mon, 13 Aug 2018 21:52:50 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= <pali.rohar@HIDDEN> To: 27709 <at> debbugs.gnu.org Subject: Re: bug#27709: parted does not produce Protective MBR for GPT correctly Message-ID: <20180813195250.numsyzbgmbkppwnj@pali> References: <201707151351.04473@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y64jfa3l67ij7ggt" Content-Disposition: inline In-Reply-To: <201707151351.04473@pali> User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 27709 X-Mailman-Approved-At: Mon, 13 Aug 2018 16:04:06 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.9 (/) --y64jfa3l67ij7ggt Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Saturday 15 July 2017 13:51:04 Pali Roh=C3=A1r wrote: > Bug report originally reported to gparted: > https://bugzilla.gnome.org/show_bug.cgi?id=3D784976 >=20 > But from second comment it appears that real problem is in parted, > because gparted only used parted. See: >=20 > # truncate -s 10G /tmp/gpt > # parted /tmp/gpt > GNU Parted 3.2 > Using /tmp/gpt > Welcome to GNU Parted! Type 'help' to view a list of commands. > (parted) mklabel gpt = =20 > Warning: The existing disk label on /tmp/gpt will be destroyed and all da= ta on > this disk > will be lost. Do you want to continue? > Yes/No? yes = =20 > (parted) quit = =20 > # dd if=3D/tmp/gpt bs=3D1 count=3D16 skip=3D446 2>/dev/null | xxd > 00000000: 0000 0100 eefe ffff 0100 0000 ffff 3f01 ..............?. >=20 > Original bug report: >=20 > According to _UEFI Specification 2.6_, section _5 GUID Partition Table (G= PT) > Disk Layout_, subsection _5.2.3 Protective MBR_, Table 17. _Protective MBR > Partition Record protecting the entire disk_, **StartingCHS** is 0x000200 > (**0/0/2**) and **EndingCHS** is 0xFFFFFF (**1023/255/63**) if it is not > possible to represent last logical block as C-H-S. >=20 > But When creating new GPT partition table via gparted StartingCHS is 0/0/= 1 and > EndingCHS is 1023/254/63 which is incorrect. >=20 > Please make gparted compliant to UEFI/GPT specification. >=20 > Test to reprocude: > $ truncate -s 10G /tmp/gpt > $ sudo ./src/gpartedbin /tmp/gpt > (now create new GPT partition table in menu and exit) > $ dd if=3D/tmp/gpt bs=3D1 count=3D16 skip=3D446 2>/dev/null | xxd > 0000000: 0000 0100 eefe ffff 0100 0000 ffff 3f01 ..............?. >=20 > StartingCHS is 0x000100 (1st byte - 4th byte) which means 0/0/1 > EndingCHS is 0xfeffff (5th byte - 8th byte) which means 1023/254/63 >=20 > When creating new gpt partition table with gdisk, Protective MBR is filled > correctly: > $ truncate -s 10G /tmp/gpt2 > $ printf "o\ny\nw\ny" | gdisk /tmp/gpt2 > $ dd if=3D/tmp/gpt2 bs=3D1 count=3D16 skip=3D446 2>/dev/null | xxd > 0000000: 0000 0200 eeff ffff 0100 0000 ffff 3f01 ..............?. >=20 > StartingCHS is 0x000200 (1st byte - 4th byte) which means 0/0/2 > EndingCHS is 0xffffff (5th byte - 8th byte) which means 1023/255/63 >=20 > Btw, same problem had fdisk from util-linux... > https://github.com/karelzak/util-linux/issues/485 It looks like that problem with StartingCHS was fixed in commit: http://git.savannah.gnu.org/cgit/parted.git/commit/?id=3Ddf6770d213b6032042= 6a3ee0bed118d063b40fc5 But problem with EndingCHS is not fixed yet. Below is a patch which fix also EndingCHS, to be set to 0xFFFFFF value as required by UEFI Specificati= on. diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 4f922b2..6f92a34 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -1144,7 +1144,7 @@ _write_pmbr (PedDevice *dev, bool pmbr_boot) pmbr->Signature =3D PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE); pmbr->PartitionRecord[0].OSType =3D EFI_PMBR_OSTYPE_EFI; pmbr->PartitionRecord[0].StartSector =3D 2; - pmbr->PartitionRecord[0].EndHead =3D 0xFE; + pmbr->PartitionRecord[0].EndHead =3D 0xFF; pmbr->PartitionRecord[0].EndSector =3D 0xFF; pmbr->PartitionRecord[0].EndTrack =3D 0xFF; pmbr->PartitionRecord[0].StartingLBA =3D PED_CPU_TO_LE32 (1); --=20 Pali Roh=C3=A1r pali.rohar@HIDDEN --y64jfa3l67ij7ggt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQS4VrIQdKium2krgIWL8Mk9A+RDUgUCW3HhjwAKCRCL8Mk9A+RD Uv3/AJ9BAG3GCN3neXuKwR/tOfIprx1xJACgoTN0irasiSiVdgSlT2LWXU131OI= =HWVZ -----END PGP SIGNATURE----- --y64jfa3l67ij7ggt--
bug-parted@HIDDEN
:bug#27709
; Package parted
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Jul 2017 16:42:35 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 15 12:42:35 2017 Received: from localhost ([127.0.0.1]:40555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1dWQ9K-0007as-Nn for submit <at> debbugs.gnu.org; Sat, 15 Jul 2017 12:42:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <pali.rohar@HIDDEN>) id 1dWLbW-0008VH-ML for submit <at> debbugs.gnu.org; Sat, 15 Jul 2017 07:51:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <pali.rohar@HIDDEN>) id 1dWLbP-0000Et-Tc for submit <at> debbugs.gnu.org; Sat, 15 Jul 2017 07:51:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59609) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <pali.rohar@HIDDEN>) id 1dWLbP-0000Eo-Pi for submit <at> debbugs.gnu.org; Sat, 15 Jul 2017 07:51:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <pali.rohar@HIDDEN>) id 1dWLbO-0003rn-Gz for bug-parted@HIDDEN; Sat, 15 Jul 2017 07:51:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <pali.rohar@HIDDEN>) id 1dWLbL-0000Dm-7G for bug-parted@HIDDEN; Sat, 15 Jul 2017 07:51:14 -0400 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:35493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <pali.rohar@HIDDEN>) id 1dWLbL-0000DI-0p for bug-parted@HIDDEN; Sat, 15 Jul 2017 07:51:11 -0400 Received: by mail-wm0-x22a.google.com with SMTP id w126so40038047wme.0 for <bug-parted@HIDDEN>; Sat, 15 Jul 2017 04:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:user-agent:mime-version :content-transfer-encoding:message-id; bh=1Fsg0a2gsfskXPkKxApeRw+jbIlf90Q+OWFWwGQ01Ms=; b=S2tyIXgYlBvxGlieuDaPmmwmRuP8LTlvJvE0794GQR/guaxsI9U4+C4uOA6pP3qMnl Ul+gvlm9dlvRui902O0/h0h62t6Vzqsc+LUbXWKiRsCbqvbUtfgg7xWvHv0VZmJ/TlxV iqutWuqF/3l+HHrTiO7cC7i9vfv7nqQpPM1zp+k3Fy9dVIzHzjhncqYlD+/TWllpKYLF 8PGhhNeLkErkGCGDfEbklm/AyYf94clPQnI1yQqqosWYmvqsW7vq7iUbfB163+g0UUKZ Dqq9I/TP1gklvxoO/c0uJQhkvNfL+r3VDIgGOl2EklMvPX+r91kCyV1wIaIYp2QoC+19 I8yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:user-agent:mime-version :content-transfer-encoding:message-id; bh=1Fsg0a2gsfskXPkKxApeRw+jbIlf90Q+OWFWwGQ01Ms=; b=iCWzJDEE7hUlcqnBFgKF8rjcUd5QOvkLsPukW9loWOT1hmVnozxFJ0WjKhN6MPlefg 9r9sm7hvq19vCtPg7VTFzKVOUndmEUzAWJ9IjeFGSInYIDcUhhlPa8kfoFa5mNgHFhCQ VoTXz6ugnW6AFcNC1vHKARKu8VnEfKULQke9pmbyjt+9A3E1oZ+Ig3mbdR/YlChAXEwk KGITXXRFTZduFipMy8de1bk4pTcIIFRVh2b+P2UjRtVdswQGJWzJe9QOUGBCCYe+8jVF MyA/HpH+ElMsrbUEJYTjEyOFQ5Q9HYcdqcwPZEUZDE5HqZmNuMP3S6MGgChzMFk5NhLA 2YEw== X-Gm-Message-State: AIVw112Rv4YZhSNiWX90MXK0GGji5Vbmmww28rUKGt4p2vddyotmwYVr 9Ee0GxnH1r8iz8fU X-Received: by 10.28.217.207 with SMTP id q198mr834575wmg.45.1500119466830; Sat, 15 Jul 2017 04:51:06 -0700 (PDT) Received: from pali-latitude.localnet (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id l46sm10698959wrl.15.2017.07.15.04.51.05 for <bug-parted@HIDDEN> (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 15 Jul 2017 04:51:05 -0700 (PDT) From: Pali =?utf-8?q?Roh=C3=A1r?= <pali.rohar@HIDDEN> To: bug-parted@HIDDEN Subject: parted does not produce Protective MBR for GPT correctly Date: Sat, 15 Jul 2017 13:51:04 +0200 User-Agent: KMail/1.13.7 (Linux/3.13.0-117-generic; KDE/4.14.2; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3115318.89ddLv08ky"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201707151351.04473@pali> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 15 Jul 2017 12:42:33 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.0 (----) --nextPart3115318.89ddLv08ky Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Bug report originally reported to gparted: https://bugzilla.gnome.org/show_bug.cgi?id=3D784976 But from second comment it appears that real problem is in parted, because gparted only used parted. See: # truncate -s 10G /tmp/gpt # parted /tmp/gpt GNU Parted 3.2 Using /tmp/gpt Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt =20 Warning: The existing disk label on /tmp/gpt will be destroyed and all data= on this disk will be lost. Do you want to continue? Yes/No? yes =20 (parted) quit =20 # dd if=3D/tmp/gpt bs=3D1 count=3D16 skip=3D446 2>/dev/null | xxd 00000000: 0000 0100 eefe ffff 0100 0000 ffff 3f01 ..............?. Original bug report: According to _UEFI Specification 2.6_, section _5 GUID Partition Table (GPT) Disk Layout_, subsection _5.2.3 Protective MBR_, Table 17. _Protective MBR Partition Record protecting the entire disk_, **StartingCHS** is 0x000200 (**0/0/2**) and **EndingCHS** is 0xFFFFFF (**1023/255/63**) if it is not possible to represent last logical block as C-H-S. But When creating new GPT partition table via gparted StartingCHS is 0/0/1 = and EndingCHS is 1023/254/63 which is incorrect. Please make gparted compliant to UEFI/GPT specification. Test to reprocude: $ truncate -s 10G /tmp/gpt $ sudo ./src/gpartedbin /tmp/gpt (now create new GPT partition table in menu and exit) $ dd if=3D/tmp/gpt bs=3D1 count=3D16 skip=3D446 2>/dev/null | xxd 0000000: 0000 0100 eefe ffff 0100 0000 ffff 3f01 ..............?. StartingCHS is 0x000100 (1st byte - 4th byte) which means 0/0/1 EndingCHS is 0xfeffff (5th byte - 8th byte) which means 1023/254/63 When creating new gpt partition table with gdisk, Protective MBR is filled correctly: $ truncate -s 10G /tmp/gpt2 $ printf "o\ny\nw\ny" | gdisk /tmp/gpt2 $ dd if=3D/tmp/gpt2 bs=3D1 count=3D16 skip=3D446 2>/dev/null | xxd 0000000: 0000 0200 eeff ffff 0100 0000 ffff 3f01 ..............?. StartingCHS is 0x000200 (1st byte - 4th byte) which means 0/0/2 EndingCHS is 0xffffff (5th byte - 8th byte) which means 1023/255/63 Btw, same problem had fdisk from util-linux... https://github.com/karelzak/util-linux/issues/485 =2D-=20 Pali Roh=C3=A1r pali.rohar@HIDDEN --nextPart3115318.89ddLv08ky Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAllqAagACgkQi/DJPQPkQ1IR5wCdEjdHdoIJBLZI01Ov5RkZjqAU D3QAoMp+odI0shQFQLjMmpQLcwZRNCPv =aUUS -----END PGP SIGNATURE----- --nextPart3115318.89ddLv08ky--
Pali Rohár <pali.rohar@HIDDEN>
:bug-parted@HIDDEN
.
Full text available.bug-parted@HIDDEN
:bug#27709
; Package parted
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.