2

In a simple boot procedure from an ISO image the below statements works well:

menuentry "Ubuntu.iso" {
set isofile="/iso/ubuntu.iso"
loopback loop (hd0,3)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile      noeject noprompt --
initrd (loop)/casper/initrd.lz
}

where hd0 is the first hdd and 3 is the partition number.

I wish how to know to do into a lvm environments

loopback loop (hd0,3)$isofile   ----> (hd0,???)

The result of blkid command is

/dev/sda1: UUID="28f0906e-d285-42dd-b3cd-18ef27b9261e" TYPE="ext2" 
/dev/sda5: UUID="Nx2a6F-O11u-sZxe-HDvm-6a2u-zdUf-suvn46" TYPE="LVM2_member" 
/dev/mapper/sal06--vg-root: UUID="2adef9b5-66de-4ffc-9c04-b33199815a35" TYPE="ext4" 
/dev/mapper/sal06--vg-swap_1: UUID="95938380-8ee5-42c9-ad1b-eee1338870db" TYPE="swap"

My iso is in /dev/mapper/sal06--vg-root.

2 Answers 2

1

Finally i found the way

just we need add to add the following line in /etc/default/grub

GRUB_PRELOAD_MODULES="lvm"

then, in /etc/grub.d/40_custom

menuentry "Ubuntu.iso" {
set isofile="/iso/ubuntu.iso"
search --no-floppy --fs-uuid --set=root <your LV uuid here >
loopback loop ($root)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile          noeject noprompt --
initrd (loop)/casper/initrd.lz

}

and done, here i made a video

https://youtu.be/5MCWFStgkQU

1
  • Instead of editing two files, you can just edit one, the /etc/grub.d/40_custom, and add the line insmod=lvm as the second line. See my answer for how to boot Fedora 27 and Ubuntu 17.10 from a LVM.
    – erik
    Jan 29, 2018 at 0:51
0

Inspired by your solution and the somewhat complicated one I found here, I used the following, which works for loading a Fedora 27 KDE iso and a Ubuntu 17.10 iso.

I just appended the following lines in the file /etc/grub.d/40_custom

menuentry "Live Fedora KDE 27" --class fedora {
  insmod part_msdos
  insmod lvm
  set iso_path="/erik/Downloads/transmission/Fedora-KDE-Live-x86_64-27/Fedora-KDE-Live-x86_64-27-1.6.iso"
  search --no-floppy --fs-uuid --set=root 6340d364-fc09-44d1-914f-b902a6394a55
  loopback loop ($root)$iso_path
  linux (loop)/isolinux/vmlinuz iso-scan/filename=${iso_path} root=live:CDLABEL=Fedora-KDE-Live-27-1-6 rootfstype=auto rd.live.image quiet
  initrd (loop)/isolinux/initrd.img
}

menuentry "Ubuntu 17.10.1" --class ubuntu {
  insmod part_msdos
  insmod lvm
  set iso_path="/erik/Downloads/transmission/ubuntu-17.10.1-desktop-amd64.iso"
  search --no-floppy --fs-uuid --set=root 6340d364-fc09-44d1-914f-b902a6394a55
  loopback loop ($root)$iso_path
  linux (loop)/casper/vmlinuz.efi  file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=${iso_path} quiet splash ---
  initrd (loop)/casper/initrd.lz
}

Explanation

  • The line that begins with set iso_path defines the path, where the iso file can be found on the logical volume. When I start my system, it lies in /home/erik/Downloads/transmission/Fedora-KDE-Live-x86_64-27/Fedora-KDE-Live-x86_64-27-1.6.iso", but /home is the mounted logical volume, so I leave this out and begin the path with /erik/Downloads/…
  • The line that begins with search has a strange alphanumerical variable (a so called UUID) at the end, that begins with 6340. I got this number from the command

    sudo blkid
    

    which gave me, along others, the following line

    /dev/mapper/fedora_pluto-home: UUID="6340d364-fc09-44d1-914f-b902a6394a55" TYPE="ext4"
    
  • Then, another important thing if you want to boot other iso files, are the lines that begin with linux and initrd. I got them by opening the iso file with file-roller (gui for extracting compressed archives) or mc (console file manager).

    • Fedora and similar: There you go to the directory /isolinux, where you will find a file called isolinux.cfg. There I found some lines beginning with label, and below them the following important lines

      kernel vmlinuz
      append initrd=initrd.img root=live:CDLABEL=Fedora-KDE-Live-27-1-6 rd.live.image quiet
      

      which you will use to fill the last two lines of my grub2 menuentry.

    • Ubuntu and similar: There you go to the directory /boot/grub, where you will find a file called grub.cfg. Here you will find some lines beginning with menuentry, and below them the following important lines

      linux   /casper/vmlinuz.efi  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash ---
      initrd  /casper/initrd.lz
      

      which you can just copy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .