All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Sebastian Pipping <sebastian@pipping.org>
Cc: grub-devel@gnu.org
Subject: Re: Future of installing GRUB to LVM volumes (and loop devices)
Date: Tue, 5 May 2015 20:38:36 +0300	[thread overview]
Message-ID: <20150505203836.30e66cbc@opensuse.site> (raw)
In-Reply-To: <5548F5AB.4080305@pipping.org>

В Tue, 05 May 2015 18:54:03 +0200
Sebastian Pipping <sebastian@pipping.org> пишет:

> Hello!
> 
> 
> I noticed that GRUB stopped supporting installation to LVM volumes and
> that installing to loop devices also started failing unless --force is
> given.  The Release of Debian jessie made me realize that GRUB
> 2.02~beta2 stopped doing what 1.99 did without complaining.  So I did
> some debugging.
> 
> A word on what this is needed for:
> I have a case where grub-install is asked to install to an LVM volume
> [1] that is later passed to Xen to boot a Xen guest.  Inside the Xen
> guest the LVM volume is seen as a regular hard disk.  So I can no longer
> use grml-debootstrap/grub-install to install to LVM volumes without
> patching at least one of those.
> 
> To reproduce it:
> 
>   # touch /var/tmp/disk2
>   # truncate --size=$((100*1024**2)) /var/tmp/disk2
>   # loop_device_2="$(losetup --show -f /var/tmp/disk2)"
>   # vgcreate vg "${loop_device_2}"
>   # lvcreate --name lv -l 100%free vg
>   # parted /dev/vg/lv mklabel msdos
>   # parted /dev/vg/lv mkpart primary ext4 4m 100%
>   # mkfs.ext4 /dev/mapper/vg-lvp1
>   # mkdir /mnt/lv-root
>   # mount /dev/mapper/vg-lvp1 /mnt/lv-root
>   # mkdir /mnt/lv-root/boot
>   # grub-install --boot-directory=/mnt/lv-root/boot /dev/mapper/vg-lv
>   Installing for i386-pc platform.
>   grub-install: error: disk
> `lvmid/GrSIBA-3EPT-TxGE-cnSa-glgA-pXpy-Kw8cOg/PD3WT8-956c-CEJ8-yPJE-ttGy-yACP-ffwTac'
> not found.
> 
> When I add a device map containing that drive ..
> 
>   # echo -e
> '(lvmid/GrSIBA-3EPT-TxGE-cnSa-glgA-pXpy-Kw8cOg/PD3WT8-956c-CEJ8-yPJE-ttGy-yACP-ffwTac)\t/dev/mapper/vg-lv'
> > /mnt/lv-root/boot/grub/device.map
> 
> .. grub-install replaces the "lvmid/*" drive to
> "hostdisk//dev/mapper/vg-lv" saying
> 
>   grub-install: warning: the drive name
> `lvmid/GrSIBA-3EPT-TxGE-cnSa-glgA-pXpy-Kw8cOg/PD3WT8-956c-CEJ8-yPJE-ttGy-yACP-ffwTac'
> in device.map is incorrect. Using hostdisk//dev/mapper/vg-lv instead.
> Please use the form [hfc]d[0-9]* (E.g. `hd0' or `cd').
> 
> and remains complaining "disk `lvmid/...' not found.
> Since the docs at "13.1 How to specify devices" (docs/grub.info)
> advertise "lvmid/" in Git for valid drive syntax, that came unexpected
> to me.
> Inspecting the code of read_device_map shows that only
> 
>   (fd0) ...
>   (hd0) ...
>   (cd) ...
> 
> of the documented syntax are actually registering the drive as-is (which
> does match the warning), everything else (including "(lvmid/*)") ends up
> being re-written to "(hostdisk/<file>)".  So it does not allow me
> helping GRUB in finding the disk.
> 

bor@opensuse:~/build/grub> cat boot/grub/device.map 
(hd0) /dev/system/docker
bor@opensuse:~/build/grub> sudo pkgdatadir=$PWD ./grub-install -d grub-core --boot-directory $PWD/boot --grub-mkdevicemap /tmp/device.map '(hd0)'
Installing for i386-pc platform.
Installation finished. No error reported.

Yes, device.map is *still* useful :)

> 
> I did manage convincing grub-install to accept lvmid device map entries
> using the patch attached but I would also like to see something that
> works out of the box again (including loop devices), of course.
> 
> 
> Now that you know about the scenario and problem I would like to ask:
> 
>  * How you would like to see this addressed in GRUB code?
> 
>  * What replacements to "grub-install --boot-directory=<X> <Y>" can
>    you think of for a temporary workaround?
>    How would use existing GRUB commands to dump future MBR bytes needed
>    to some regular file to apply that to any device using dd after or
>    something like that?
> 
> 
> Many thanks in advance,
> 
> 
> 
> Sebastian
> 
> 
> [1] from inside a tool called grmldeboostrap [2], a wrapper around
>     deboostrap installing Debian to a given block device
> [2] https://github.com/grml/grml-debootstrap



  reply	other threads:[~2015-05-05 17:38 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 [this message]
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
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=20150505203836.30e66cbc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.