LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   Dual Boot OS w/ .iso file (https://www.linuxquestions.org/questions/centos-111/dual-boot-os-w-iso-file-4175574078/)

firejc5 03-05-2016 09:30 PM

Dual Boot OS w/ .iso file
 
I am running CentOS but would like to also be able to run Ubuntu with only the .iso file.

How do you configure the GRUB file on a CentOS system using the .iso file?

Where does you retrieve the kernel/initrd paths?

Ztcoracat 03-05-2016 09:44 PM

Hi & Welcome to LQ-:)

If you want to run Ubuntu on your Centos machine with only the .iso file you will have to take the .iso file and put it on a usb memory stick and make it bootable.

<OR> burn the .iso to a fresh CD/DVD.
Either way go into the BIOS and set the machine to boot to either 'usb' or the 'CD/DVD Drive'

I use Unetbootin to do that.
http://unetbootin.github.io/

ondoho 03-06-2016 03:26 AM

i think it is possible to point grub to an actual .iso file on the hard drive and tell it to boot from that.
it would then boot into a ubuntu live session, i guess.
actually a quick search seems to confirm this: https://duckduckgo.com/?q=grub+boot+.iso+file

yancek 03-06-2016 03:14 PM

A more detailed explanation of the process is at the link to Ubuntu below.

https://help.ubuntu.com/community/Grub2/ISOBoot

I don't have CentOS installed so I can't test it. I believe CentOS defaulted to Grub2 with 7.0. If you still use Grub Legacy with an older CentOS, you would first have to create a mount point for the iso, then loop mount the iso, create a directory in CentOS, copy all the files/folders from the loop mount point to the new directory and then create a menu entry in either Grub Legacy grub.conf/menu.lst or the Grub2 grub.cfg file.

Ztcoracat 03-06-2016 04:53 PM

Yeah, I'm running Centos 7 and it came with Grub 2. ;)

Quote:

you would first have to create a mount point for the iso,
To do that I would just make a directory in my Home right?

I'm assuming the Menu Entry would look something like this?
label = /dev/sdb ubuntu

Ztcoracat 03-06-2016 05:06 PM

Here's a pic of the Grub and Config files in Centos.
http://i1052.photobucket.com/albums/...2017-59-48.png

Yancek the grub config file that you spoke of that we would edit, do you mean the one in the pic that says:
Code:

config-3.10.0-327.10.1.el7.x86_64
That's the file that says not to Edit it-
N/M that file was the kernel config file.
I found the grub2.cfg file however it is broken.

The error message says that the link cannot be used because it's target
./boot/grub2/grub.cfg' doesn't exist.

I'll do what I can to fix it or create another one and explain for OP.
I found the grub.d and the grub2.cfg in /etc/grub.

jefro 03-07-2016 09:05 PM

I'm kind of confused as to the question.

If you mean that you want to boot ubuntu directly from an iso file then you don't configure the kernel options. You boot to the iso. Not even sure if grub2 can boot to an iso, I know they were working on it.

May have to chain to grub4dos,grub4nt or other loader that can boot an iso directly. Not all iso's will boot this way.

Ztcoracat 03-07-2016 09:34 PM

I couldn't find the Grub2 grub.cfg on my Centos box but I found it on my Korora desktop and where the menu entries are.

Code:

menuentry 'Korora (0-rescue-5cd71d3e8e8c4a5cad09e4025c445a49) 23 (Workstation Edition)' --class korora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-5cd71d3e8e8c4a5cad09e4025c445a49-advanced-caf8ef94-ed06-403c-8934-abf6aa39381f' {
This is an old thread but it explains how to create a mnt point.
http://www.linuxquestions.org/questi...-linux-906731/

yancek 03-08-2016 07:45 PM

Quote:

you would first have to create a mount point for the iso,
That wasn't clear. The above statement was in reference to using Grub Legacy to boot an extracted iso file which would then need to be copied to a directory on CentOS and a proper entry made in the grub.conf/menu.lst file.

If you are booting an iso, you just point to it in grub.cfg with Grub2. I usually put it in the / of the filesystem I am booting from but it can also be in the /boot directory and possibly elsewhere. I haven't tried anything else.

Quote:

Yancek the grub config file that you spoke of that we would edit, do you mean the one in the pic that says:
config-3.10.0-327.10.1.el7.x86_64
No. The image you posted shows a Grub directory as well as a Grub2 directory and the grub.cfg file I would expect to find in Grub2.

Grub2 has been able to directly boot iso files for years. I usually boot an iso to install to another partition rather than using a DVD or flash drive. Most any Ubuntu derivative will work and you can also boot a Slackware iso, done that. Probably there are others that I haven't tested but I think there are probably a lot of distributions which cannot be booted directly from iso.

The menuentry below is an example of an entry in the Grub2 grub.cfg file to directly boot the Ubuntu 14.04 iso. It's in the / of the sdb3 partition so that would have to be changed.

Quote:

menuentry "UBUNTU-14.04-iso" {
insmod part_msdos
insmod ext2
set root='hd1,msdos3'
loopback loop (hd1,msdos3)/ubuntu-14.04.2-desktop-i386.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-14.04.2-desktop-i386.iso
initrd (loop)/casper/initrd.lz
}
If you want this on a permanent basis, put the entry in the /etc/grub.d/40_custom file, save the change and run update-grub or grub-mkconfig, depending upon your system.

Ztcoracat 03-10-2016 07:23 PM

Quote:

Grub2 has been able to directly boot iso files for years. I usually boot an iso to install to another partition rather than using a DVD or flash drive.
I've never done that and I'm having trouble understanding how you were able to complete that task.
I'll do some reading online.

jefro 03-10-2016 08:45 PM

Grub doesn't actually boot the iso file directly. You have to peek into the iso and find some files and create a menu. Almost more trouble than it's worth. This is what the OP I now get was originally asking about.

https://help.ubuntu.com/community/Gr...OBoot/Examples

Grub4dos is a slightly more direct approach.

Ztcoracat 03-10-2016 09:01 PM

Quote:

Originally Posted by jefro (Post 5513578)
Grub doesn't actually boot the iso file directly. You have to peek into the iso and find some files and create a menu. Almost more trouble than it's worth. This is what the OP I now get was originally asking about.

https://help.ubuntu.com/community/Gr...OBoot/Examples

Grub4dos is a slightly more direct approach.

Thanks-:)

yancek 03-10-2016 10:23 PM

Quote:

I've never done that and I'm having trouble understanding how you were able to complete that task.
If you are booting Ubuntu or one of its derivatives, the menuentries for all will be identical with the exception of the actual name of the iso file and the menuentry title so you won't need to do a loop mount to see what menuentry you need. If you are trying to boot some other distribution, the kernel and initrd path lines will be different so you would need to loop mount the iso. You would then check the syslinux, isolinux or whatever menu you have and modify it to fit Grub2 entries and put them in the grub.cfg file on your primary boot OS partition. I guess that's what jefro is referring to by "peek into the iso and find some files".

Once you know how to do this, it doesn't take any longer than burning a DVD or putting an iso on a flash drive plus you don't need to be buying DVDs and flash drives for the purpose. As I indicated above, there are a lot of distributions which won't work. Most Ubuntus should and a few others, some of which are listed at the link above.

I'm not sure what part of this you are having trouble with?

Ztcoracat 03-10-2016 11:01 PM

Quote:

If you are booting Ubuntu or one of its derivatives, the menuentries for all will be identical with the exception of the actual name of the iso file and the menuentry title so you won't need to do a loop mount to see what menuentry you need.
In this case the derivative is Black Lab Linux that I can easily transfer to my Centos box from my Slack box with a pendrive.
What configuration file does the .iso of Black Lab Linux go in?

Quote:

If you are trying to boot some other distribution, the kernel and initrd path lines will be different so you would need to loop mount the iso.
I would like to try to boot other distributions as a practice but don't understand how to 'loop mount the iso':study:

-::-I'd be happy not to have to purchase any more flash drives. I stopped burning DVD's a few years ago.-::-

Ztcoracat 03-10-2016 11:15 PM

Quote:

The ISO file may be stored on any partition accessible to GRUB 2. The partition format does not need to be ext3/4.
In that case I can use g-parted to create a new partition.

Ensuring to properly identify the location of the ISO in the menuentry's PATH is what I'm having trouble with.
Once I figure that out the partition will be mounted by Grub2; right?

I'll re-read Grub2/ISOBoot when I have more time.


All times are GMT -5. The time now is 07:36 AM.