Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] How to boot the LiveDVD iso file from bootloader?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
teika
Apprentice
Apprentice


Joined: 19 Feb 2011
Posts: 155
Location: YYYY-MM-DD, period. Have you ever used the Internet?

PostPosted: Thu Feb 08, 2024 7:25 am    Post subject: [Solved] How to boot the LiveDVD iso file from bootloader? Reply with quote

[Solved] Solution: When something doesn't work, try avoiding lvm.

Hi. I'd like to boot the Gentoo LiveDVD iso image file stored in a filesystem from a bootloader, but my attempt doesn't work.

I have the following lines in my grub.cfg:
------------------------------------------------------------------------
linux (loop)/boot/gentoo overlayfs nodhcp looptype=squashfs loop=/image.squashfs cdroot isoboot=$isofile
initrd (loop)/boot/gentoo.igz
------------------------------------------------------------------------
I have set up $isofile and loop correctly, so Grub can boot the image and use the initramfs, but the boot process stops, complaining:
------------------------------------------------------------------------
>> Looking for the cdrom
>> Attempting to mount media: /dev/sr0
>> [similar lines follow for other /dev files]
!! Media not found
** No bootable medium found. Waiting for new devices ...
>> Looking for the cdrom
>> [snip]
!! Could not find CD to boot, something else needed!
>> Determining root device (trying ) ....
!! Could not find the root block device in .
------------------------------------------------------------------------
(Hand-typed from a photo of the pc screen. Don't expect letter-by-letter accuracy.)
I copied the above grub config lines from the actual grub.cfg stored in the iso image. (You can do it by: $ mount -o loop /path/to/livedvd.iso /tmp/moutpoint )

Any advice?

This method is really useful. In the default way, by dd-ing to a usb drive, you lose all contents therein, but this way you won't. It's also a good practice to have a bootable image in a drive or two, external or internal, for a rescue purpose.

IMHO booting the livedvd image from a bootloader deserves to be the default way, rather than burning to an entire drive. Today you can prepare one even from MSWin by using WSL, at least.

FYI: If you want a general help to do such thing, this Archwiki page is a good starting point.

TIA
_________________
Hack of easy Shift / Ctrl / AltGr etc; save your pinkies, type without drudgery: topic 865313

XPAT - Xi, Putin, Abe and Trump - are security holes of their own nations.


Last edited by teika on Sun Feb 18, 2024 6:52 am; edited 2 times in total
Back to top
View user's profile Send private message
plasmonics
n00b
n00b


Joined: 16 Mar 2011
Posts: 6

PostPosted: Fri Feb 09, 2024 2:58 pm    Post subject: Re: ¿How to boot the LiveDVD iso file from bootloader? Reply with quote

teika wrote:
Hi. I'd like to boot the Gentoo LiveDVD iso image file stored in a filesystem from a bootloader, but my attempt doesn't work.

I have the following lines in my grub.cfg:
------------------------------------------------------------------------
linux (loop)/boot/gentoo overlayfs nodhcp looptype=squashfs loop=/image.squashfs cdroot isoboot=$isofile
initrd (loop)/boot/gentoo.igz
------------------------------------------------------------------------
I have set up $isofile and loop correctly, so Grub can boot the image and use the initramfs, but the boot process stops, complaining:
------------------------------------------------------------------------
>> Looking for the cdrom
>> Attempting to mount media: /dev/sr0
>> [similar lines follow for other /dev files]
!! Media not found
** No bootable medium found. Waiting for new devices ...
>> Looking for the cdrom
>> [snip]
!! Could not find CD to boot, something else needed!
>> Determining root device (trying ) ....
!! Could not find the root block device in .
------------------------------------------------------------------------
(Hand-typed from a photo of the pc screen. Don't expect letter-by-letter accuracy.)
I copied the above grub config lines from the actual grub.cfg stored in the iso image. (You can do it by: $ mount -o loop /path/to/livedvd.iso /tmp/moutpoint )

Any advice?

This method is really useful. In the default way, by dd-ing to a usb drive, you lose all contents therein, but this way you won't. It's also a good practice to have a bootable image in a drive or two, external or internal, for a rescue purpose.

IMHO booting the livedvd image from a bootloader deserves to be the default way, rather than burning to an entire drive. Today you can prepare one even from MSWin by using WSL, at least.

FYI: If you want a general help to do such thing, this Archwiki page is a good starting point.

TIA


I use the same method described by the arch wiki. It does not work for all ISOs. If the iso is not correctly hybridized, it will assume that the information it needs to load is on an optical drive, hence the /dev/sr0 error. Ubuntu iso used to have this problem, but they fixed it. Pop!os is one of the many ISOs that do not work with the Arch method. AFAIK, the only way to fix it is to unpack the ISO and hack one of the scripts in the initrd. Then rebuild the ISO. I use the following Grub code to boot the Gentoo minimal ISO:
Code:

set isofile='/install-amd64-minimal-20230402T170151Z.iso'
bootoptions="isoboot=$isofile root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot"
menuentry 'Boot Gentoo minimal ISO' --class gentoo {
     loopback loop $isofile
     linux (loop)/boot/gentoo $bootoptions
     initrd (loop)/boot/gentoo.igz
}

The other option is to use Ventoy. It uses a different boot method.

PS:
Just out of curiosity, I tried the above code block with the Live ISO and it worked.
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3925
Location: Hamburg

PostPosted: Sat Feb 10, 2024 3:19 pm    Post subject: Reply with quote

This works for me (hd0,2) is the 2nd partition here:
Code:

 cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Admin CD" {
  set isofile='/admin.iso'
  loopback loop (hd0,2)$isofile
  set root=(loop)
  linux  /boot/gentoo root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot isoboot=$isofile vga=791 dokeymap
  initrd /boot/gentoo.igz
}

menuentry "Install Minimal" {
  set isofile='/install-minimal.iso'
  loopback loop (hd0,2)$isofile
  set root=(loop)
  linux  /boot/gentoo root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot isoboot=$isofile vga=791 dokeymap
  initrd /boot/gentoo.igz
}

menuentry "Live GUI" {
  set isofile='/livegui.iso'
  loopback loop (hd0,2)$isofile
  set root=(loop)
  linux  /boot/gentoo root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot isoboot=$isofile vga=791 dokeymap
  initrd /boot/gentoo.igz
}

menuentry "Tails" {
  set isofile='/tails.iso'
  loopback loop (hd0,2)$isofile
  set root=(loop)
  linux  /boot/gentoo root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/image.squashfs cdroot isoboot=$isofile vga=791 dokeymap
  initrd /boot/gentoo.igz
}

Back to top
View user's profile Send private message
teika
Apprentice
Apprentice


Joined: 19 Feb 2011
Posts: 155
Location: YYYY-MM-DD, period. Have you ever used the Internet?

PostPosted: Sun Feb 11, 2024 9:12 am    Post subject: Reply with quote

@plasmonics: Thanks for you reply, but I doubt your explanation of "proper hybridization". All except me have succeeded, and I was able to use Gentoo 2016 and Ubuntu 2019 isos.

From you two's answers, seems like I'm to blame, doing something wrong. :p
Thanks. Maybe I'll write this to the wiki.
Back to top
View user's profile Send private message
teika
Apprentice
Apprentice


Joined: 19 Feb 2011
Posts: 155
Location: YYYY-MM-DD, period. Have you ever used the Internet?

PostPosted: Sun Feb 18, 2024 6:50 am    Post subject: Reply with quote

My original config worked, but when the iso image is in lvm, it doesn't.

Strange. For the 2016 Gentoo iso, adding "dolvm" sufficed, and Ubuntu 2019 didn't require any.

I wrote this in the Wiki article Installation alternatives.

Let me thank you all again. Bye.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum