Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › booting a linux ISO from grub2
New Posts  All Forums:Forum Nav:

booting a linux ISO from grub2

post #1 of 2
Thread Starter 
To any one already running a linux distro this might come in handy. I for one dislike have to tinker around with my usb drive or burn a cd each time i want to upgrade my Distro or to try out a new one. So I went on a mission today, browsing grub2's documentation. Discovered a way to boot an actual ISO image from the harddrive .

not sure how useful this actual knowledge is, or how many will use it, but if you were ever wondering, and it is good to be armed with as much knowledge as possible, here goes nothing .

1. sudo mkdir /boot/iso
2. sudo mv ~/Downloads/*.iso /boot/iso

these two steps you can change to wherever you want, it is not so much vital where they go as long as you know what are you doing, so to make this as simple as possible, I will use static variables . instead of using mv, you could cp, but why have two files of the same thing eh?

now here comes the fun part,adding the entry to grub2 . there are a few ways to do this, i will do it the way suggested by the grub2 documentation.

3. open up terminal, navigate to /etc/grub.d (i'm not a 100% sure if it is like this in all distro's, i use ubuntu mainly.)
4. issue the ls command, find the #_custom file, and open it with root privileges.

sudo nano 40_custom

^that is what it is for me, might be a different number for other distros.

once open, add the following information. i will be using ubuntu 11.04 x64 iso as an example.

menuentry "ISO - ubuntu 11.04 64" {
set isofile="/boot/ISO/ubuntu-11.04-desktop-amd64.iso"
loopback loop (hd0,msdos1)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile nomodeset
initrd (loop)/casper/initrd.lz
}

note: the items in red, are the changeable content. menuentry can be anything you want it to be as long as it is inside the quotes. set isofile=, has to be the path and name of the iso file, so if it is a different iso and path to mine, please adjust.

the loopback loop section, the red part, is kinda tricky, you might need to adjust that a bit. i checked out /boot/grub/grub.cfg, and all the entries for my install, had (hd0,msdos1), so i added that when it failed to boot from just having (hd0) there.

now save the file, ctrl+o, and exit, ctrl+x.

one last command:

sudo update-grub

if all went as planned, when you restart, you should be greeted by a new entry at the bottom to your grub menu. now see if you can boot to it .

the only problem i ran into, and it was simply the location at which i chose to boot the iso from. i wanted to resize my / partition, but it had been mounted as /isolinux in the live installer, and i was unable to unmount it, to resize it, so an easy fix was making the changes to 40_custom in /etc/grub.d and moving the iso to another partition and booting from there.

like i said before, not sure what help this will be to anyone, but i found it useful.
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
Bazinga Punk
(12 items)
 
ooh shiny!
(6 items)
 
 
CPUMotherboardGraphicsRAM
Intel Xeon 3440 AsRock P55 extreme Evga 8800 GT 512 MB Gskill Ripjaws 
Hard DriveCoolingOSMonitor
Western Digital Blue Antec Khuler 620 Ubuntu 11.10 Asus vw264H 
KeyboardPowerCaseMouse
GIGABYTE KM7600 CORSAIR TX 650 Cooler Master 590 GIGABYTE GM-M6800 
CPUMotherboardGraphicsRAM
Intel Core I5 6500 Gigabyte z170xp-SLI Nvidia 970gtx Corsair 16gb ddr4 2666mhz  
Hard DriveOS
250gb Samsung Evo 850 Windows 10 & Ubuntu 15.10 
  hide details  
Reply
post #2 of 2
Yes this is great for using the alternate CD ISO to do an upgrade, good 'tinkerin there trans
Torch's Rig
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6750 w/G0 ASUS P5KC Sapphire HD5770 1GB 4 GB G.Skill DDR3 1333 
Hard DriveOptical DriveOSMonitor
ADATA S510 120GB SSD, (2)Samsung F3 1TB, Seaga... Asus SATA DVD LinuxMint 13 x86 w/Mate Asus 23" HD 1080p HDMI LED LCD 
KeyboardPowerCaseMouse
Microsoft Sidewinder X4 610w PC Power & Cool Silencer Rosewill Blackbone Logitech G400 
Mouse Pad
DOLICA 
  hide details  
Reply
Torch's Rig
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6750 w/G0 ASUS P5KC Sapphire HD5770 1GB 4 GB G.Skill DDR3 1333 
Hard DriveOptical DriveOSMonitor
ADATA S510 120GB SSD, (2)Samsung F3 1TB, Seaga... Asus SATA DVD LinuxMint 13 x86 w/Mate Asus 23" HD 1080p HDMI LED LCD 
KeyboardPowerCaseMouse
Microsoft Sidewinder X4 610w PC Power & Cool Silencer Rosewill Blackbone Logitech G400 
Mouse Pad
DOLICA 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › booting a linux ISO from grub2