grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Sebastian Pipping <sebastian@pipping.org>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Future of installing GRUB to LVM volumes (and loop devices)
Date: Sun, 17 May 2015 11:14:40 +0300	[thread overview]
Message-ID: <20150517111440.3d550ffd@opensuse.site> (raw)
In-Reply-To: <5555CD85.4050804@pipping.org>

В Fri, 15 May 2015 12:42:13 +0200
Sebastian Pipping <sebastian@pipping.org> пишет:

> Hello Andrei,
> 
> 
> On 05/15/2015 11:34 AM, Andrei Borzenkov wrote:
> > On Fri, May 15, 2015 at 12:28 PM, Sebastian Pipping
> > <sebastian@pipping.org> wrote:
> >>
> >> I understand that some relations may be hard to impossible to detect.
> >> The cases that I have are plain parent-child relations, though.
> >> It would rock the house to get these cases covered again.
> >>
> >> (On a side note, text "unknown device type loop0" looks like a bug to me
> >> since "loop0" is not a type.)
> > 
> > It comes from Open Firmware part. May be it should be downgraded to
> > Info. But as long as it happens in grub-probe only it is OK.
> 
> my point was more about the text of the error message.
> 
> 
> >>>>> Half working solution would be to assume that it is always child map.
> >>>>>
> >>>>> Or you can take shortcut and assume that /dev/mapper/XXXXpY is
> >>>>> partition of /dev/mapper/XXX but you still will need to verify it.
> >>>>>
> >>>>> Patches are welcome.
> >>>>
> >>>> I am still wondering: how come it was working in GRUB 2.00 but now
> >>>> longer is?
> >>>>
> >>>
> >>> But by you said in previous message that HEAD works? Not sure how
> >>> though :)
> >>
> >> That referred to the '(hd0)'-parameter-with-device-map case, only.
> >>
> >> This patch to grml-debootstrap says best what has stopped working:
> >> https://github.com/hartwork/grml-debootstrap/commit/a705ff45c2d053b0d90ec51700e2d25a760106f3
> >>
> > 
> > Could you please describe your exact configuration that does not work
> > (including all devices and their relationships) and what does not
> > work? Sorry if you did it already but I somehow lost track here.
> 
> Sure.
> 
> The setup is a single plain partition in an LVM volume.
> 
> The following commands reproduce the setup (in RAM if /tmp is tmpfs).
> With a plain LVM volume, the error is the same tough.
> 
>   # tmpfile="$(mktemp)"
>   # echo "${tmpfile}"
>   # truncate --size=$((100*1024**2)) "${tmpfile}"
>   # loop_device_2="$(losetup --show -f "${tmpfile}")"
>   # echo "${loop_device_2}"
>   # vgcreate vg "${loop_device_2}"
>   # lvcreate --name lv -l 100%free vg
>   # sleep 1
> 
>   # parted /dev/vg/lv --script mklabel msdos
>   # parted /dev/vg/lv --script mkpart primary ext4 4m 100%
>   # sleep 1
>   # mkfs.ext4 /dev/mapper/vg-lv1
>   # mkdir /mnt/lv-root
>   # mount /dev/mapper/vg-lv1 /mnt/lv-root
>   # mkdir /mnt/lv-root/boot
>   # grub-install --boot-directory=/mnt/lv-root/boot /dev/mapper/vg-lv ;
> echo $?
>   Installing for i386-pc platform.
>   grub-install: error: disk
> `lvmid/KO9MVd-KNgN-Nbo0-RJb0-pGdK-K7lO-apdskW/rrvxSA-SFY6-P6gy-1jYv-0ims-RmyL-m1KZMB'
> not found.
>   1
> 

Yes, it got broken during code rearrange. grub effectively ignores
device.map at this point:

opensuse:/home/bor/build/grub # ./grub-probe --verbose -t drive -m /tmp/device.map -d /dev/mapper/vg-lv
./grub-probe: info: adding `hd0' -> `/dev/dm-5' from device.map.
./grub-probe: info: /dev/mapper/vg-lv is present in device map.
./grub-probe: info: Looking for /dev/mapper/vg-lv.
./grub-probe: info: /dev/mapper/vg-lv (0) is a parent of /dev/mapper/vg-lv.
./grub-probe: info: /dev/mapper/vg-lv is present in device map.
./grub-probe: info: Looking for /dev/mapper/vg-lv.
./grub-probe: info: /dev/mapper/vg-lv (0) is a parent of /dev/mapper/vg-lv.
(lvmid/Q7vbHZ-MAzV-RtmN-lWJh-I2z3-2Jz2-CJRBgf/NyMQtV-4NgS-uXZ0-3klS-VQ7c-zMVz-butVbK)


Comparing 2.00 and current head:

2.00:

char *
grub_util_get_grub_dev (const char *os_dev)
{
  char *grub_dev = NULL;

  grub_util_pull_device (os_dev);

  switch (grub_util_get_dev_abstraction (os_dev))
    {
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
    case GRUB_DEV_ABSTRACTION_LVM:

      {

and current head:

char *
grub_util_get_grub_dev (const char *os_dev)
{
  char *ret;

  grub_util_pull_device (os_dev);

  ret = grub_util_get_devmapper_grub_dev (os_dev);

So device.map effectively got ignored at this point. I'm not sure
whether it was intentional; Vladimir?

Hmm ... grub_util_get_devmapper_grub_dev() actually always returns
either LVM or LUKS device. At which point we probably have to check
whether device abstraction is really one of them.

Anyway, Sebastian, thanks for report; could you open bug report so it is
not lost?


  parent reply	other threads:[~2015-05-17  8:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 16:54 Future of installing GRUB to LVM volumes (and loop devices) Sebastian Pipping
2015-05-05 17:38 ` Andrei Borzenkov
2015-05-06 12:30   ` Sebastian Pipping
2015-05-06 17:16     ` Andrei Borzenkov
2015-05-12 10:41       ` Sebastian Pipping
2015-05-12 11:41         ` Andrei Borzenkov
2015-05-15  9:28           ` Sebastian Pipping
2015-05-15  9:34             ` Andrei Borzenkov
2015-05-15 10:42               ` Sebastian Pipping
2015-05-16  3:47                 ` Jordan Uggla
2015-05-16 14:10                   ` Sebastian Pipping
2015-05-16 23:33                     ` Jordan Uggla
2015-05-17  8:14                 ` Andrei Borzenkov [this message]
2015-05-21 21:41                   ` Sebastian Pipping
2015-05-21 21:44                     ` Vladimir 'phcoder' Serbinenko
2015-05-21 21:48                       ` Sebastian Pipping
2015-05-21 22:17                         ` Vladimir 'phcoder' Serbinenko
2015-05-21 22:20                           ` Sebastian Pipping
2015-05-22  2:25                           ` Andrei Borzenkov
2015-05-07  9:35     ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-05-12  9:16       ` Sebastian Pipping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150517111440.3d550ffd@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=sebastian@pipping.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).