Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting livecd-iso image directly via grub2?
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
onkelfusspilz
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2002
Posts: 128
Location: Germany

PostPosted: Fri Aug 28, 2009 8:16 pm    Post subject: Booting livecd-iso image directly via grub2? Reply with quote

Ok this is not directly installation-related, but it may come in handy if you want to install gentoo on a machine without a cd-drive.

I want to boot the gentoo minimal install-cd from a usb-stick. But I don't want to use netbootin or anything other that extracts the iso to the usb-stick. Instead I want grub2 to boot the iso-image directly via the loopback feature.

I have installed grub2 on the usbstick (via grub-install) and my grub.cfg file looks like this:
Code:

set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue

search --fs-uuid --set 1272-1480

menuentry "Gentoo Linux minimal install cd x86 20090623" {
  loopback loop /isoimages/gentoo_install-x86-minimal-20090623.iso
  linux    (loop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs cdboot initrd=gentoo.igz vga=791
  initrd   (loop)/isolinux/gentoo.igz
}


I've stolen the kernel-parameters from the isolinux.cfg file from the gentoo-installer iso-file. The boot process starts fine (just like it did with the iso burned to a cd) but then the process stucks at the point where it says "looking for cd" which actually makes sense because there is no cd.

So my question is as simple as this: Is there a easy way (different boot parameters or so) to let the boot-script from the gentoo minimal install cd not search for the cd but mount the iso-image (with -o loop) from the usb-stick instead?

This would be very nice since one can have different gentoo-installer-cds for different architectures (at least x86 and amd64) on one usb-stick with a comfortable menu to choose from which to boot.

Any hint or help on this is greatly appreciated.

Thank you in advance,

Andreas Piening
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Wed Sep 02, 2009 9:32 am    Post subject: Reply with quote

Hi,

i'm actually not sure, if that helps or not, as i haven't tried the loop-feature of Grub yet...
But i know that USB sometimes takes some time to get detected by the Kernel! -Therefore i used to have "rootdelay=10" as Kernel option!
If that doesn't work, try to place a file called "livecd" in the rootdir of the stick... (The initramfs searches for it to find the device, and i'm not sure, if that specific function within genkernel is prepared for a loop-grub-setup).

Hope that helps!

Cheers
_________________
Power to the people!
Back to top
View user's profile Send private message
onkelfusspilz
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2002
Posts: 128
Location: Germany

PostPosted: Wed Sep 02, 2009 12:23 pm    Post subject: Reply with quote

Hi nativemad,

thank you for your hint, I did not know that the initramfs looks for this "livecd" file. Anyways it doesn't help that much here, since the content that the initramfs needs to continue its boot procedure is still inside the iso-image. The idea of the loopback-feature is to leave the iso-image "as is" and boot a kernel and initramfs from inside the iso-image.
The question is, can I cheat the initramfs to not search for a livecd (aka content of the iso-image-file) but loop-mount the iso-image and use it as live-cd?

Technical this works and some livecds (like the ubuntu-ones) supports this, but I can't figure out if the gentoo livecd does.

Thank you again,

Andreas
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Wed Sep 02, 2009 12:54 pm    Post subject: Reply with quote

Quote:
The question is, can I cheat the initramfs to not search for a livecd (aka content of the iso-image-file) but loop-mount the iso-image and use it as live-cd?

Thats exactly what i thought about.... The init/linuxrc-script actually gets a list of known devices and partitions on it. Then it mounts each of them and looks out for a file called "livecd" in the root of that part... But maybe this "list" just hasn't got the proper loop-device to check....
hmmm.... lets see, how far we can get! :roll:

Do you get to a shell? -could you do a "losetup -a" and maybe a "mount" there for me?
_________________
Power to the people!
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Wed Sep 02, 2009 7:36 pm    Post subject: Reply with quote

i got it to work now:
Code:
menuentry "Gentoo Linux minimal install cd x86 20090901" {
  loopback loop (hd0,3)/isoimages/gentoo_install-x86-minimal-20090901.iso
  linux (loop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs cdroot cdboot initrd=gentoo.igz vga=791
  initrd (loop)/isolinux/gentoo.igz
}

Note the cdroot option!
I'm not sure about the (hd0,3)-thing... I needed it, otherwise grub hasn't fount the iso... maybe you need to have a search-for-uuid-string! But i'm sure you'll get it, as you could boot other isos... :wink:
_________________
Power to the people!
Back to top
View user's profile Send private message
onkelfusspilz
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2002
Posts: 128
Location: Germany

PostPosted: Thu Sep 03, 2009 8:16 pm    Post subject: Reply with quote

Hello nativemad,

can you really do a complete boot into gentoo from the iso-image on the usb-stick? I still have the same error, even with the "cdroot" option.

But I can get a shell. When the livecd searches for the cd with the message "Looking for the cdrom" it searches a second time and then times out. I can enter "shell" there. Now what I did was mounting the usb-stick and then the iso-image from the usb-stick with the following commands:
Quote:
mkdir /usbstick
mount /dev/sdb1 /usbstick
mount -o loop /usbstick/isoimages/gentoo_install-x86-minimal-20090901.iso /newroot


but how can I continue the boot-process from there? Oh and is it correct to mount the iso-image directly to /newroot so that the boot-script finds the "livecd" flag there and loopmount the image.sqaushfs and continue the boot process? Or should I mount the image.sqashfs myself to /newroot/?

Oh if we get this to work I'd love to see this integrated in the linuxrc or whatever boot-script, maybe feeded by a kernel-parameter. It will make gentoo-installations faster and possible on systems without cd-drives.

Thank you for your help!

Andreas
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Fri Sep 04, 2009 5:49 am    Post subject: Reply with quote

Hi Andreas,
i must admit, that i haven't tested it with a real usb-stick... I just installed grub2 on a VM and placed the iso on the root of that installation and made a second boot-menu-entry for the iso!
That worked out of the box! (ok, almost... watch out that the partition where the iso sits is larger than the possible capacity of the iso-fs! <-Don't use a small boot-partition, even if the gentoo-minimal-cd is quite small!! :wink: )

As i already played quite much with genkernels linuxrc-scripts, i haven't thought, that it would work so easy... but it did! :P
I tried it several times to boot manually up from that emergency-shell... but i always made some mistakes and i ended up every time in an ooops!
-The Iso should be on /newroot/mnt/cdrom, the squash on /newroot/mnt/livecd and /newroot is a ramdrive!

back to you:
i guess that you can see, that it at least searches for the cdrom, if you have the "cdroot" option in place. One line per partition.... Without that kernel-option it just claims something like "unable to determin root in ."!
Is that correct?
As i mentioned earlier somewhere, it could be, that USB takes a bit longer to initialize than my local scsi-disc in the VM... therefore try the "rootdelay=10" option as kernel-parameter! It is made for that! :wink:

Maybe a wiki Article or something like that could be useful?!?

cheers
Andreas
_________________
Power to the people!
Back to top
View user's profile Send private message
onkelfusspilz
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2002
Posts: 128
Location: Germany

PostPosted: Mon Nov 02, 2009 11:03 pm    Post subject: Reply with quote

Hi nativemad,

sorry for coming back to you that late. I experimented with that a while without luck and then gave up on this with the conclusion that I might be able to get gentoo to boot directly from the iso-image with some manual shell-commands but not in a automated "select and forget" manner from the grub-menu without additional interaction. The reason for that is hat gentoo currently does not support something like a "fromiso" boot parameter for the init-rd, yet. At least as far as I know. Let me point to a blog-article which discribes the situation just fine: http://mgerards.net/blog/?p=16

I think you tried something different than me, or at least on a slightly other way. I stumbled upon your line saying
Quote:
watch out that the partition where the iso sits is larger than the possible capacity of the iso-fs! <-Don't use a small boot-partition, even if the gentoo-minimal-cd is quite small!!


I can't find any reason for the "boot" partition to be at least one byte larger than the iso image itself, sinze there is no need to extract the iso-image when using the loopback-option. Anyhow, on my usb-stick is no extra boot partition, I have a single fat32 partition with a folder called "boot" which holds the grub boot-manager. I have created a folder called "iso-images" which holds the iso-images of ubuntu, sidux etc.

Sorry If I have missed something, but it seems to me that you extracted the content of the iso-image to your usb-stick or partition in a VM (or even mounted the iso image inside the vm).

Since the modification to the gentoo-livecd boot-scipts are not that complex (the only thing we need is an additional "fromiso" boot parameter and some mount-commands in the init-script), i hope there will be support for grub2-loopback-booting very soon. Maybe there's somewhere else somebody allready working on that.
Back to top
View user's profile Send private message
Aladar
n00b
n00b


Joined: 06 Nov 2009
Posts: 2

PostPosted: Fri Nov 06, 2009 11:14 am    Post subject: Reply with quote

Hi to everyone,

any progress on this topic? I've also tried to setup booting from ISO. I'd realy love to have the most recent minimal install CD on the hard drive as a backup and be able to boot it directly via Grub 2.
Is someone working on enabling this feature in minimum install CD?

Thanks

Aladar
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Fri Nov 06, 2009 12:53 pm    Post subject: Reply with quote

Hi,

sorry for answereing so late, but i haven't seen the newer posts...

I haven't extractet anything from the iso! Just copied the plain iso file to a ext3 partition!

Quote:
I can't find any reason for the "boot" partition to be at least one byte larger than the iso image itself, sinze there is no need to extract the iso-image when using the loopback-option. Anyhow, on my usb-stick is no extra boot partition, I have a single fat32 partition with a folder called "boot" which holds the grub boot-manager. I have created a folder called "iso-images" which holds the iso-images of ubuntu, sidux etc.

The partition should be at least about 640mb, as that is what a normal cd could hold! Otherwise grub gets into trouble with setting the right geometry.....

There is no "fromiso" boot option! But i don't think that it is necessary, as quite the same is done with the "cdroot" option!
Mine booted quite fine off a partition!? I could try it with an usb-stick... But to be hones: i think your problem relies somwhere else!

Could you please repost the last few lines before an actual error occurs during the bootup?

Cheers
_________________
Power to the people!
Back to top
View user's profile Send private message
sera
Developer
Developer


Joined: 29 Feb 2008
Posts: 993
Location: CET

PostPosted: Fri Nov 06, 2009 2:01 pm    Post subject: Reply with quote

If there is a NIC capabale of PXE[1] in your box this would allow for another nice method to install or rescue a system without a cd drive.

[1] http://en.wikipedia.org/wiki/Preboot_Execution_Environment
Back to top
View user's profile Send private message
paulisdead
Guru
Guru


Joined: 10 Apr 2002
Posts: 510
Location: Seattle, WA

PostPosted: Fri Nov 20, 2009 1:31 am    Post subject: Reply with quote

Has there been any progress on this? I got stuck at the same spot you guys did, and stumbled across this post. Also, if anyone knows how to boot up the ultimate bootcd with Grub2, I'd love to know how it got done.
_________________
"we should make it a law that all geeks have dates" - Linus
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Fri Nov 20, 2009 10:32 am    Post subject: Reply with quote

okokok, i am really sorry!
I have to admit that I've just found out, that i left the actual "cdrom" connected to that test-VM and the linuxrc-scripts found it and booted from there (a mixup actually... Kernel/initrd from the .iso-file, squashfs from cdrom!).
8O

It is really the case, that the initrd-scripts (linuxrc) has to be enhanced somehow to find and mount the actual iso!
Eventually i will spend some time on it over the weekend and see how far i get with it.....
_________________
Power to the people!
Back to top
View user's profile Send private message
Aladar
n00b
n00b


Joined: 06 Nov 2009
Posts: 2

PostPosted: Fri Nov 20, 2009 11:01 am    Post subject: Reply with quote

Not sure if it will help, but anyway, here is the solution on sidux:
http://sidux.com/index.php?module=Wikula&tag=Grub2isofrom
Maybe you can find some hints there.
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Mon Nov 23, 2009 7:06 pm    Post subject: Reply with quote

Ok, it works for me now! :P

http://bugs.gentoo.org/show_bug.cgi?id=294268

Hopefully it will get accepted soon....
_________________
Power to the people!
Back to top
View user's profile Send private message
thegeezer
n00b
n00b


Joined: 11 Jul 2010
Posts: 32

PostPosted: Sun Jul 11, 2010 1:28 pm    Post subject: sorry to awaken a sleeping thread Reply with quote

but... unless i'm very much mistaken (which to be fair, is likely) according to this bug report http://bugs.gentoo.org/294268 the patch for isoboot has been been applied?

however, i'm having problems making this take affect, as it is either
1. isoboot is not actually a mainstream kernel boot option and i have to make my own iso
2. i'm missing a settign to say which disk to find the iso to mount as a cd before hunting for the squashfs and at boot time

i'm using this in my grub2 config:

menuentry "Gentoo Linux minimal install" {
loopback loop /boot/iso/install-amd64-minimal-20100408.iso
linux (loop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=gentoo.igz isoboot=/boot/iso/install-amd64-minimal-20100408.iso
initrd (loop)/isolinux/gentoo.igz
}

does this work for anyone? it would be some kind of genius if we could just download iso direct to usb key and then boot straight for a quick start gentoo install.

TIA,
Back to top
View user's profile Send private message
TimeMaster
n00b
n00b


Joined: 16 May 2004
Posts: 13

PostPosted: Wed Jul 14, 2010 5:38 pm    Post subject: Reply with quote

Hi, have anyone patched minimal live cd iso image for x86 and amd64? The patch is cool but to much work on it for me now :(

I saw, this patch still isn't natively in genkernel from newest install-minimal install cd's :(
Back to top
View user's profile Send private message
onkelfusspilz
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2002
Posts: 128
Location: Germany

PostPosted: Tue Dec 28, 2010 1:43 pm    Post subject: Reply with quote

nativemad wrote:
Ok, it works for me now! :P

http://bugs.gentoo.org/show_bug.cgi?id=294268

Hopefully it will get accepted soon....


Hi nativemad,

The bug has changed its state to RESOLVED/FIXED on 2010-12-25 and your patch seems to be included in genkernel-3.4.10.908. This version is masked, but available in portage.
As I red this, I gave it a new chance to try booting from the very latest minimal install-cd but the parameter "isoboot" still seems to be ignored. I think it will take some time for the patch to arrive at the current gentoo-iso-images.
My question is: How much effort will it take to patch a current iso-image manually with your update? If it is possible to unpack the iso, replace one script-file and pack the iso again, it should'nt be that hard to do, should it?

Since you have made the patch and are the only person I know of which has success booting from the iso: Can you tell how you made your iso?

Thank you in advance!

Andreas Piening
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Sat Mar 19, 2011 4:07 pm    Post subject: Reply with quote

Hi guys,

sorry, i haven't tracked that thread anymore and now just stumbled upon it! :P

The bad news is that we are currently still one genkernel stable-version behind the one with the patch... It will take some more time until it's included in the minimal cds!

Another bad news is that it's not that trivial to patch it manually!
Just a sketch:
install a minimal gentoo with the same kernelversion as on the livecd
install a newer genkernel-package,
copy the /proc/config.gz from the running livecd
`genkernel --menuconfig all` and load the config copied previously.
extract the iso and replace the initrd file and recreate the iso

The good news is that the new complete (software in the making) gentoo livecd 11 uses genkernel-9999!
i haven't tried it, but i suppose it should work with it! :P
_________________
Power to the people!
Back to top
View user's profile Send private message
likewhoa
l33t
l33t


Joined: 04 Oct 2006
Posts: 743
Location: Brooklyn, New York

PostPosted: Sat Mar 19, 2011 7:45 pm    Post subject: Reply with quote

nativemad wrote:
Hi guys,

sorry, i haven't tracked that thread anymore and now just stumbled upon it! :P

The bad news is that we are currently still one genkernel stable-version behind the one with the patch... It will take some more time until it's included in the minimal cds!

Another bad news is that it's not that trivial to patch it manually!
Just a sketch:
install a minimal gentoo with the same kernelversion as on the livecd
install a newer genkernel-package,
copy the /proc/config.gz from the running livecd
`genkernel --menuconfig all` and load the config copied previously.
extract the iso and replace the initrd file and recreate the iso

The good news is that the new complete (software in the making) gentoo livecd 11 uses genkernel-9999!
i haven't tried it, but i suppose it should work with it! :P


Instead of using GRUB2 for your liveusb you could just run 'isohybrid' on the iso which is part of the sys-boot/syslinux package as this is what allows the LiveDVD to boot from USB devices ;)

Also to turn any of the official minimal installcds into a hybrid iso which boots from removable devices i.e USB sticks, just follow this guide i made. http://forums.gentoo.org/viewtopic-t-811070.html
Back to top
View user's profile Send private message
nativemad
Developer
Developer


Joined: 30 Aug 2004
Posts: 833
Location: Switzerland

PostPosted: Sat Mar 19, 2011 11:24 pm    Post subject: Reply with quote

likewhoa wrote:

Instead of using GRUB2 for your liveusb you could just run 'isohybrid' on the iso which is part of the sys-boot/syslinux package as this is what allows the LiveDVD to boot from USB devices ;)

Also to turn any of the official minimal installcds into a hybrid iso which boots from removable devices i.e USB sticks, just follow this guide i made. http://forums.gentoo.org/viewtopic-t-811070.html

Thanks for the hint likewhoa, but it's actually not the same!
Via grub2 it isn't necessary to extract the iso at all! No modification is needed and you can make several bootentries for all iso-files laying around...
Just place the iso on the local disk or usb or wherever grub can read, make a grub entry for it and you are ready to go! :P

[edit] Actually grub starts the syslinux from the iso if i remember right [/edit]
_________________
Power to the people!
Back to top
View user's profile Send private message
likewhoa
l33t
l33t


Joined: 04 Oct 2006
Posts: 743
Location: Brooklyn, New York

PostPosted: Mon Mar 21, 2011 12:58 am    Post subject: Reply with quote

nativemad wrote:
likewhoa wrote:

Instead of using GRUB2 for your liveusb you could just run 'isohybrid' on the iso which is part of the sys-boot/syslinux package as this is what allows the LiveDVD to boot from USB devices ;)

Also to turn any of the official minimal installcds into a hybrid iso which boots from removable devices i.e USB sticks, just follow this guide i made. http://forums.gentoo.org/viewtopic-t-811070.html

Thanks for the hint likewhoa, but it's actually not the same!
Via grub2 it isn't necessary to extract the iso at all! No modification is needed and you can make several bootentries for all iso-files laying around...
Just place the iso on the local disk or usb or wherever grub can read, make a grub entry for it and you are ready to go! :P

[edit] Actually grub starts the syslinux from the iso if i remember right [/edit]


This is handy if that's what you're looking for but for the normal user, one environment is enough and just using isolinux will do. You can even have one 32bit environment with an added 64bit kernel for x86 systems which is more than enough. I'll monitor this thread as i find using grub to chainload isolinux interesting.
Back to top
View user's profile Send private message
Whoo
n00b
n00b


Joined: 25 May 2003
Posts: 20

PostPosted: Sat May 03, 2014 10:23 pm    Post subject: Reply with quote

Hi Guys,

I've got the same trouble but with a working clue:

Code:
menuentry "Gentoo" {
loopback loop /gentoo.iso
linux (loop)/isolinux/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=gentoo.igz isoboot=/gentoo.iso
initrd (loop)/isolinux/gentoo.igz
}


gentoo.iso (is install-x86-minimal-20140415.iso)
Not sure for all parameters ... but it works for qemu with grub2 install.
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