[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Future of installing GRUB to LVM volumes (and loop devices)
From: |
Andrei Borzenkov |
Subject: |
Re: Future of installing GRUB to LVM volumes (and loop devices) |
Date: |
Fri, 22 May 2015 05:25:52 +0300 |
В Fri, 22 May 2015 00:17:50 +0200
"Vladimir 'phcoder' Serbinenko" <address@hidden> пишет:
> Le 21 mai 2015 23:48, "Sebastian Pipping" <address@hidden> a écrit :
> >
> > There is not device map and there was no need for one previously.
> > I'm happy to add that to the ticket, give me a second.
> >
> It worked only by lack of support for devmapper, not because it was
> designed so or because it's reasonable to. It was just a bug which happened
> to do what you wanted
The actual bug is that device.map does not work anymore for
device-mapper devices that LVM happens to be:
opensuse:/home/bor # grub2-install --boot-directory /tmp/x/boot
/dev/mapper/vg-lv
Выполняется установка для платформы i386-pc.
grub2-install: ошибка: диск
«lvmid/AxK0hm-Xmee-kRPP-dqU3-ycoo-EfcX-Vs3mk2/aot5OT-H8ZH-FXKe-Kz8e-gw6r-PI6v-9IdcGb»
не найден.
opensuse:/home/bor # grub2-install --boot-directory /tmp/x/boot '(hd0)'
Выполняется установка для платформы i386-pc.
grub2-install: ошибка: диск «hd0» не найден.
opensuse:/home/bor # cat /tmp/x/boot/grub/device.map
(hd0) /dev/mapper/vg-lv
This is fixed with patch below. And yes, with this patch it does not
require device.map which itself is a bug and should be fixed but it is
much more intrusive.
From: Andrei Borzenkov <address@hidden>
Subject: [PATCH] check for abstraction in grub_util_get_devmapper_grub_dev
If user added device to device.map we should respect it.
---
grub-core/osdep/devmapper/getroot.c | 33 ++++++++++++++++++++-------------
grub-core/osdep/linux/getroot.c | 2 +-
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/grub-core/osdep/devmapper/getroot.c
b/grub-core/osdep/devmapper/getroot.c
index 0a77a04..f830f9c 100644
--- a/grub-core/osdep/devmapper/getroot.c
+++ b/grub-core/osdep/devmapper/getroot.c
@@ -224,11 +224,14 @@ grub_util_get_devmapper_grub_dev (const char *os_dev)
uuid = get_dm_uuid (os_dev);
if (!uuid)
return NULL;
-
- if (strncmp (uuid, "LVM-", sizeof ("LVM-") - 1) == 0)
+
+ switch (grub_util_get_dev_abstraction (os_dev))
{
+ case GRUB_DEV_ABSTRACTION_LVM:
+ {
unsigned i;
int dashes[] = { 0, 6, 10, 14, 18, 22, 26, 32, 38, 42, 46, 50, 54, 58};
+
grub_dev = xmalloc (grub_strlen (uuid) + 40);
optr = grub_stpcpy (grub_dev, "lvmid/");
for (i = 0; i < ARRAY_SIZE (dashes) - 1; i++)
@@ -246,19 +249,23 @@ grub_util_get_devmapper_grub_dev (const char *os_dev)
return grub_dev;
}
- if (strncmp (uuid, "CRYPT-LUKS1-", sizeof ("CRYPT-LUKS1-") - 1) == 0)
- {
- char *dash;
- dash = grub_strchr (uuid + sizeof ("CRYPT-LUKS1-") - 1, '-');
- if (dash)
- *dash = 0;
- grub_dev = grub_xasprintf ("cryptouuid/%s",
- uuid + sizeof ("CRYPT-LUKS1-") - 1);
+ case GRUB_DEV_ABSTRACTION_LUKS:
+ {
+ char *dash;
+
+ dash = grub_strchr (uuid + sizeof ("CRYPT-LUKS1-") - 1, '-');
+ if (dash)
+ *dash = 0;
+ grub_dev = grub_xasprintf ("cryptouuid/%s",
+ uuid + sizeof ("CRYPT-LUKS1-") - 1);
+ grub_free (uuid);
+ return grub_dev;
+ }
+
+ default:
grub_free (uuid);
- return grub_dev;
+ return NULL;
}
- grub_free (uuid);
- return NULL;
}
char *
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index a2e360f..bc79eaa 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -1075,7 +1075,7 @@ grub_util_get_grub_dev_os (const char *os_dev)
switch (grub_util_get_dev_abstraction (os_dev))
{
/* Fallback for non-devmapper build. In devmapper-builds LVM is handled
- in rub_util_get_devmapper_grub_dev and this point isn't reached.
+ in grub_util_get_devmapper_grub_dev and this point isn't reached.
*/
case GRUB_DEV_ABSTRACTION_LVM:
{
--
tg: (f4e62af..) u/devmapper-check-abstraction (depends on: master)
- Re: Future of installing GRUB to LVM volumes (and loop devices), (continued)
- Re: Future of installing GRUB to LVM volumes (and loop devices), Andrei Borzenkov, 2015/05/17
- Re: Future of installing GRUB to LVM volumes (and loop devices), Sebastian Pipping, 2015/05/21
- Re: Future of installing GRUB to LVM volumes (and loop devices), Vladimir 'phcoder' Serbinenko, 2015/05/21
- Re: Future of installing GRUB to LVM volumes (and loop devices), Sebastian Pipping, 2015/05/21
- Re: Future of installing GRUB to LVM volumes (and loop devices), Vladimir 'phcoder' Serbinenko, 2015/05/21
- Re: Future of installing GRUB to LVM volumes (and loop devices), Sebastian Pipping, 2015/05/21
- Re: Future of installing GRUB to LVM volumes (and loop devices),
Andrei Borzenkov <=
- Re: Future of installing GRUB to LVM volumes (and loop devices), Vladimir 'φ-coder/phcoder' Serbinenko, 2015/05/07
- Re: Future of installing GRUB to LVM volumes (and loop devices), Sebastian Pipping, 2015/05/12