Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

tl;dr - Is it possible to boot from a .iso file that is located in an unencrypted lmv2 logical volume? How?

I'm trying to set this up in a VirtualBox VM before I do it for real with my laptop. I have the following set up:

  • 4 gpt partitions
    • gpt1 - 2M ef02 bios boot
    • gpt2 - 5G unencrypted non-lvm, for misc data,iso's, etc.
    • gpt3 - 5G unencrypted lvm, for /boot,iso's, etc.
    • gpt4 - remaining, lvm, encrypted with dm-crypt/luks, for root,swap,home,etc.
  • in gpt2, I have copies of current Arch and Xubuntu iso's
  • in gpt3, I have an lvm2 lv with the same copies of the same iso's

I have the following working:

  • in gpt4, functioning installs of Arch and Xubuntu (and would like to add other distro's in other logical volumes at some point)
  • grub2 installed from Arch on /dev/sda
  • using grub2's configfile command, can switch and boot from both distro's grub2 menu's
  • can boot iso's from grub menu from non-lvm gpt2

What I would like to do is boot from the iso's in gpt3 lvm (and ultimately, not even have the non-lvm gpt2 partition at all).

My grub entry is:

menuentry "Xubuntu ISO" {
  set isofile="/xubuntu-12.04.1-desktop-amd64.iso"
  # from non-lvm
  loopback loop (hd0,gpt2)$isofile
  # from lvm
  #loopback loop (vgboot-iso)$isofile
  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
  initrd (loop)/casper/initrd.lz
}

The 2 loopback lines point to 2 different copies of the same iso. I've verified at the grub command line that both loopback lines work.

When booting from the iso in the non-lvm partition, everything works fine.

When booting from the iso in the lvm partition, the boot starts, and eventually gets this error:

(initramfs) /scripts/casper-premount/20iso_scan: line 46: can't open /dev/sr0: No medium found

For the arch entry:

menuentry "Arch ISO" {
  set isofile="/archlinux-2012.09.07-dual.iso"
  loopback loop (hd0,gpt2)$isofile
  #loopback loop (vgboot-iso)$isofile
  linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201209 img_dev=/dev/sda2 img_loop=$isofile earlymodules=loop
  initrd (loop)/arch/boot/x86_64/archiso.img
}

booting from gpt2 iso works, but I don't know what to change the "/dev/sda2" to for lvm boot.


EDIT: Can this be done? For any current Linux distro's official .iso file? Fedora? Debian? openSUSE? CentOS?

Is this impossible? Or is it something no one has thought to try before?


EDIT2: My bounty has long since expired, and after 9 months, I'm assuming this is simply not possible with any Linux distro. I'll leave the question open, but I'm doubtful there will be a working solution anytime in the near future.

share|improve this question

3 Answers 3

I think that it is not possible for most distributions' official iso file.

The error you're getting :

 (initramfs) /scripts/casper-premount/20iso_scan: line 46: can't open /dev/sr0: No medium found

means that at boot, the live system you're starting is searching for a cd/dvd drive and not finding any.

Live CDs are not configured to search for their source iso on a LVM; you can maybe modify the boot scripts of the image to do it, but I don't think any current distro official .iso file does that. You can try to contact your favorite distro's devs to have that integrated maybe ?

share|improve this answer

You could try this:

Add this at the start of the menuentry:

insmod lvm

Then, specify your LVM partition with:

set lvmpart=lvm/<lvm_group_name>-<lvm_logical_partition_name>

So your Xubuntu ISO entry would be like this:

menuentry "Xubuntu ISO" {
  insmod lvm
  set lvmpart=lvm/<lvm_group_name>-<lvm_logical_partition_name>
  set isofile="/xubuntu-12.04.1-desktop-amd64.iso"
  loopback loop $lvmpart$isofile
  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
  initrd (loop)/casper/initrd.lz
}

Please make corrections as needed.

This should make GRUB recognize the lvm2 volume, making it possible to read the ISO file in it. However, probably the ISO will still not be found...

share|improve this answer
    
I tried your suggestions, but as you said, the iso still isn't found. –  snapshoe May 9 '13 at 0:15

It can be done easily :-) This is an detailed example on my website.

Adapted to your problem you should change:

loopback loop (hd0,gpt2)$isofile

for /dev/sda2 to:

loopback loop (hd0,$(getPartType /dev/sda)2)$isofile
share|improve this answer
    
As I said in the question, the iso located on (hd0,gpt2) already works. You're just adding a level of indirection to create the string 'gpt2'. Your reply and website mention nothing about LVM, and doesn't answer any part of this question. –  snapshoe Oct 16 '12 at 23:18
    
Maybe your question was not "clear" enough ? ;-) –  user86064 Oct 17 '12 at 6:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.