[wishlist] bootloader-configuration, avoid use of /dev/sd?

  • Done
  • quality assurance status badge
Details
4 participants
  • Danny Milosavljevic
  • Giovanni Biscuolo
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Giovanni Biscuolo
Severity
wishlist
G
G
Giovanni Biscuolo wrote on 29 May 2019 21:16
(address . bug-guix@gnu.org)
87imtt137o.fsf@roquette.mug.biscuolo.net
Hello,

Following a recent discussion on Guix-devel [1] I'm "forwarding here" a
proposal to switch from /dev/sd? to (target (uuid ...)) in
bootloader-configuration operating-system declaration

This is a recap of current situation: the installer usually uses
/dev/sda as target for grub-install (and bootloader-cofiguration) but it
happened to me that on a machine /dev/sda was the USB media, not the
target HD

The fact is that it's not guaranteed that /dev/sd? always corresponds to
the same device

This is where we are with the discussion:

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (37 lines)
> Hello!
>
> Giovanni Biscuolo <g@xelera.eu> skribis:
>
>> But wait! There's the /dev/disk/by-id/ tree, I did not notice it until
>> now! :-)
>>
>> That's the solution:
>>
>>
>> (bootloader
>> (bootloader-configuration
>> (bootloader grub-bootloader)
>> (target "/dev/disk/by-id/scsi-3600508b1001c75a3bebb04b23d19e249")
>> (keyboard-layout keyboard-layout)))
>>
>> I did not test this but it smells like running, if Guix devels agree I
>> think Installer should adopt /dev/disk/by-id by default, sorry I'm not
>> able to propose a patch for this
>
> Ideally, we’d use an actual UUID object (or a string?) here rather than
> this Linux/udev-specific idiom. So it would look like:
>
> (bootloader-configuration
> ;; …
> (target (uuid …)))
>
> Would that work?
>
> I believe using Guile-Parted we could map it back to a /dev name.
>
> WDYT?
>
> Ludo’.



[1] Message-ID: <87o93mwr4b.fsf@gnu.org>

--
Giovanni Biscuolo

Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERcxjuFJYydVfNLI5030Op87MORIFAlzu2nsACgkQ030Op87M
ORLxIRAAofCSPxkPjw/1rmFuJmp03DzujXbWQF6idUvGPZnhBPyDYjXyMJCU2oEk
ctvOlOKfe4NpI/2P7wUxSxgXJ6iLOezdZZV5BOrc707TaeB3sRYILKhnsL8FLBJK
zo+5fALgXw47TVh6KHFIN6NCb70F31tDtrFtGkKE043J4u59CtvwSxdQxEAaLIoc
wkIW6f9xiMzf/I/EHt31Rw+ZqaLZjKxXDzkn6ETwK8tsNRQd+eZDpsuvHH8KpelU
aiLrSPs2xyG2HScqgsFQNINQMomq/TNFwwqcSUr7//5/Ea/cQl8vZQ67L7aV3HzV
+B9Zx1KwYYaYGlL234cBMOMl3NhAtkoOiWW1O9cv30JWQBKO3JzwFv3l7dq0eslW
Fdu6R7rt4puh+OTpMwmxuBxBq4+h3/kf6Hm2kdbTulTLL3m7qX3LWoH/vMtCeGCB
9P9LJCe4UZ7sRkrZvO2QleeaexKHEWndvEeSbODFAGka1zmiAuiC1rAscErf7sj+
XZTTW4+zIY2Gb8xHnMa/Xj1ja0CZj4afamgAZ9eaE6KyLsi+qjNARd1K5wWJ+uff
UrZR86QmlZ+w6FybWSaSVNfziyDRrr2GsRD2J6pBteFwvTPZkVjZCGvWciXBuYIU
tmAaNJE8aC0EVsLIMDlSMTJn/gkp7gFJLXkm1LNZ0nJCw2TWESA=
=A/Yd
-----END PGP SIGNATURE-----

G
G
Giovanni Biscuolo wrote on 29 May 2019 21:49
Re: Installer: GUIX_IMAGE as /dev/sda on some hardware?
(address . guix-devel@gnu.org)
87ftox11nu.fsf@roquette.mug.biscuolo.net
Hello Tobias and Ludo'

I've opened a bug report for this, WDYT if we go on there?

Tobias Geerinckx-Rice <me@tobias.gr> writes:

Toggle quote (22 lines)
> Ludovic Courtès wrote:
>> Ideally, we’d use an actual UUID object (or a string?) here
>> rather than
>> this Linux/udev-specific idiom. […]
>> I believe using Guile-Parted we could map it back to a /dev
>> name.
>
> Yah, 's one of the reasons that I haven't sent anything yet (the
> main one being shame, of course; car/cdr for the win & all that).
>
>> Would that work?
>
> I'd looked in Guile-parted before but came up dry. To be fair I
> did little more than grep around for ‘uid’ and friends. So you
> tell me ;-)
>
> …
>
> Hum, wait a minute. Isn't that irrelevant? Doesn't Guix itself
> do exactly this when mounting file systems? Sigh, silly me, I
> should be able to re-use that… >_<

Grub supports quite a number of ways to specify devices [1] but I cannot
find something suitable for this purpose: am I missimg something
obvious?

AFAIU on ther distros (e.g. Debian) (the installer?) populates a device
map [2] using the grub-mkdevicemap utility (grub-common package in
Debian) but I cannot find that in our grub package

This is an example on one of my Debian hosts:

Toggle snippet (11 lines)
$ cat /boot/grub/device.map
(hd0) /dev/disk/by-id/ata-WDC_WD10EADS-00L5B1_WD-WCAU4D992691
(hd1) /dev/disk/by-id/ata-ST3250620NS_9QE2L68Z
(hd2) /dev/disk/by-id/ata-ST3250620NS_9QE2FSQD
(hd3) /dev/disk/by-id/ata-ST3250620NS_9QE27YPJ
(hd4) /dev/disk/by-id/ata-WDC_WD7500BPKT-00PK4T0_WD-WX11A4181554
(hd5) /dev/disk/by-id/ata-WDC_WD7500BPKT-00PK4T0_WD-WXM1A61D0766


(the map is not updated)

We could use (hd?) in grub config - that's grub specific, not Linux/udev
specific - **but** we should find a way to automate the selection of the
device corresponding to our target (the one mounted as /mnt)

Thanks for working on this!!!

Happy hacking. Gio'.






--
Giovanni Biscuolo

Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERcxjuFJYydVfNLI5030Op87MORIFAlzu4lYACgkQ030Op87M
ORIhGg/+ISQXtwbCR4aEtCpcpaQEgFdizZ7zZIsBQY24y2HLn2GpEkrS4kJotDbJ
Kr3/Ss2TN3jlqvS/nWM0CdSRq9p1qJN/emwQAldFkxejHqmbuJkw1hCyw+UZPEq9
6H+zkx+J3ya9bjcOLdtQID2mllv+pyaI/oDHu99bX1Ein+XkJGuu+bt27u/ALyPc
eOoKnU1cRhM8Y2ivn30hCIfx7BhWFhv3QK9JUaQvgFFUhuxVK1aTmmtXLTta3AUR
8TIKmV6uTN9lbeiC96EzIPODQj4PTqVxq9nunQ8ss6vAnjl04zvnBU4+KVPi+KCy
x1bxPrHCkkg8ypg2qfDpEv9aPVnihMHF+snpOaBCjSFzSm6/6U0NixVQi/vYtUHD
EVLwlda2oIlR0lFts6aXMfzEN60jDdOd9d+3dh4q1NmY7l7y8+rv7eWv0bXQSIvG
OKr5Ngkf63kKnm9CjOQwempjDVi8i708bG4q2gh9jcMed5pLd7Ms4OXmIn97AhPA
+ielVB4dak8iqv1pE5hTad7rXoCmbSet8gCWN9T7A9pC4XVTKYTZpBGfZxiRcei7
328X8UoycaQtp8I1G+5Mo+Cyq0wUqVJkSFCAnaFjXLLo61NUxQps6LY99CqP7N4A
WZqCM+zWoPZhCFOk8Ity9VpfSWfP6rzYpcK+oHxJrlfKOaEbUMo=
=7U82
-----END PGP SIGNATURE-----

D
D
Danny Milosavljevic wrote on 29 May 2019 22:19
20190529221944.2d361250@scratchpost.org
Grub already can search by uuid or label (via "search --fsuuid" and
"search --label", respectively). IF you specify an uuid or label
in your operating-system configuration it will use that.

The only part missing is: The Guix installer's config generator should
find out the uuids and print those instead of the /dev nodes.

If nothing else, we can just use blkid to find out which is which.

For example: blkid -d -s UUID -o value /dev/sda1

But T G-R is right, Guix already does what is required at other places.

Care has to be taken that parted also uses GUIDs for GPT partition TYPES
and also for partitions as such (not their contents). Those are something
else.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzu6WAACgkQ5xo1VCww
uqV3+wf9EXt8vpP3lyfQVilyOagjkrolC9wWwDLXvgHNvxrT3dVb1zVWKm8UEIok
8EvETyDTPoSejkgzRjfpN+pJlH1L7LcGMXl62WZGkTVK5r6f5tJGBv+eVBiBug5P
4AuB/AdVvGKwMJgEfc626jQVIdcsaW6JQOIW28tLB3ieIPx+xCoGQLON4YCB6GV1
DZ9HinntnI7IXi56BzzoQpEz9Snq4iNIvqiPD0o6hQL85KL3GG6LPkBf48ynAWSM
7cqgUNSupvyK7LESwlLn3bt9rhFVjyuTde21X22N34ucxfRBiUC2yVrl3lKSM0Rv
7fD4EkFPvgqMEjIOb7RlgMpQbZ9u4Q==
=0Ah5
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 31 May 2019 23:42
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
874l5amhc8.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (4 lines)
> Grub already can search by uuid or label (via "search --fsuuid" and
> "search --label", respectively). IF you specify an uuid or label
> in your operating-system configuration it will use that.

These are concerned with file system UUIDs/labels, whereas this issue is
about disk IDs, AIUI. Or am I missing something?

Ludo’.
T
T
Tobias Geerinckx-Rice wrote on 1 Jun 2019 00:16
(name . Ludovic Courtès)(address . ludo@gnu.org)
87r28ep8vg.fsf@nckx
Ludovic Courtès wrote:
Toggle quote (11 lines)
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>> Grub already can search by uuid or label (via "search --fsuuid"
>> and
>> "search --label", respectively). IF you specify an uuid or
>> label
>> in your operating-system configuration it will use that.
>
> These are concerned with file system UUIDs/labels, whereas this
> issue is
> about disk IDs, AIUI. Or am I missing something?

This. Also, this only affects grub-install—not ‘grub
run-time’—which runs under the Hurd/Linux/…, unless I, too, am
missing something, and this entire thread collapses in a cacophony
of confusion.

G'night,

T G-R
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXPGn0wAKCRANsP+IT1Vt
eezfAP9Wt9X6DEDgcgYwcXXdu3LFzURcMtqREGsWCliiZSbOLwD/Us/lSRdyXrIC
RtmhsV0ZEbYj9o8G5Xe2mcFHSE5h7wI=
=IgY2
-----END PGP SIGNATURE-----

D
D
Danny Milosavljevic wrote on 1 Jun 2019 01:31
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)
20190601013127.6dbd31ca@scratchpost.org
Yeah, but disk ids are not uuids.

/dev/disk/by-id seems to be a good way to find those disk ids in order to pass
them to grub-install. I doubt that this can be made OS-independent--even the
udev rules specify different variables for different devices, sometimes it's
bus id and serial number, sometimes it's name and serial number, sometimes it's
ieee1394_id, sometimes ID_WWN_WITH_EXTENSION.

Alternatively, grub also works from a boot-active partition--it nothing else
works, we can install grub to a partition (for example the root partition).

Then, migration would be difficult, though (if people had grub installed on
the MBR, that destroyed the previous loader that would have loaded from the
boot sector of the partition).
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzxuU8ACgkQ5xo1VCww
uqWIegf/VzQwkEKWQoN3NHCaKGOS7ddoLoW6VmJKtdNOKLq951aq5vMxt/l4K/8v
W2D8ArZASv6NZEukelCLKqiG5u4S5nILAYyjJ7w6mSFdDCkNd6IN5CnNZvpO82oI
kv9VolTKDafhu3Dm1h2lJIECNB6b53T69XqOUW8PVpXrJfS4pAvtCS29zFCucIcx
ptEdUVyGdMjZbXAnOUUglLizd/dYPuX4ULgijFt7XjkJKsU0yKaH/VkMbD6xHXEU
HciItmCIFeYKE1rDk0R5sNxorMWfyQKztd3o6TSDmB05UrsQOowBvkAS0dnMhauo
ev5kr8/IAuwNZNNpNiAfX0l88ObZ/A==
=0eIB
-----END PGP SIGNATURE-----


G
G
Giovanni Biscuolo wrote on 28 Feb 10:29 +0100
bug#35995: [wishlist] bootloader-configuration, avoid use of /dev/sd?
(address . 35995-done@debbugs.gnu.org)
87o7c13pjz.fsf@xelera.eu
Hello,

I think this bug has been fixed in bug #51878:

Pushed as b90504cdb5ce3d1981c8d7bc8a9cc918b0d60af7 (26 Nov 2021).

Closing! :-)

--
Giovanni Biscuolo

Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----

iQJABAEBCgAqFiEERcxjuFJYydVfNLI5030Op87MORIFAmXe/OEMHGdAeGVsZXJh
LmV1AAoJENN9DqfOzDkSKGEP/iuAOjVz6ecPEuylsumHYvb0HRkznx3Fb19ZNvUW
ogJ7iFAC/HzWzAPkdMcj5GgJqaCo9rsF1SkUkGkCQAf7pGtk8APqqv8ddjY+MA9F
BeFXmZZ7FoKg50h/N6TJNR/eInccifirkeg5m8VCr6SmFyqWH6Vx9h3umEnSu2x6
mKWaygvQ0sxCqkV8hk+msAZuwTrVYRGzsHgSZ/AtMfpf9bjo7MrJiZxnZfu8Jwop
WOQwk8N1ilmZL5BS00lxRAIYNQOvTfnGh8J7S+AACDDZg5rbM8HSrfPJaPTvtkIM
O/gVPzXyt4q20ECWKL+RQh2i0hUQ4qpG6W623CCjyhAXNPXeJPcVzlGKhMeijuc/
UmpZ2q8EYY+KQqP1AvVReWpUAVvriJyjfenIPSiFhd/h/udx9zCPeKerexkIPJV8
CZzgQW1QVQQ8u3gP41E2smyWEM07XcNicRr9MX3CzEegkMjsw9NiHGJ45nb4tzdR
0nRydBWbsyWcBhzTL9mmYz7wztCfrKlVLO4m4OiApbPJY94/UExIiWWeXrN+wW2I
XbO8KeLQHOFH2dY/2LoxGBh9tSgspbeZYmAMDwhbFACHXygUVyapqLlgXb9BpXy4
TOJgRONwdIbSVzPID1b1JpyfvYuWj2SDgm9MtbdmMJQ6Y2+m9UPAyVeWgZ611qzL
6cVB
=PGRI
-----END PGP SIGNATURE-----

Closed
?