Grub 2/ISO Boot

the distro (bodhi linux which is the enlightenment-forked moksha de on top of an ubuntu base) i predominately use has a support board set up over at linuxquestions (lq). because it is designed to be lightweight, there are plenty of questions about use on older systems with hardware limitations. one recent issue was about wanting to upgrade from bodhi 3 to a newer version. the main problem was that the system only has a cd reader and for whatever reason the usb wouldn’t live boot. because of the expansion of the ubuntu base, the minimal legacy (32-bit) iso weighs in at just over 750 mb = too big for a cd.

the first suggestion to be offered was booting the iso straight from grub either from a usb or from the root partition (/) itself. i had never heard of such a thing so i asked if the image needed to be written to the usb with dd or a program like etcher. if that were so, i wasn’t seeing how that was different from trying to boot the usb itself. the response was that the iso is just copied to either of those locations.

the magic (at least it seemed like it to me at the time) was creating a bootable grub 2 menu entry that pointed to the iso. i tried the one given at lq but it failed to boot for me. it seemed like it began to read the iso, but then i got some kind of kernel panic from trying to boot from both a usb and / a couple different times.

frustrated, i went back to the board to see if i could get some help fixing what was wrong. then i saw the link below that was posted to help guide anyone with questions about the how of it all. the menu entry there was a bit different so i ended up with:

menuentry "bodhi 5.0.0 iso" {
set isofile="/bodhi-5.0.0-legacy.iso"
loopback loop (hd0,1)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject
initrd (loop)/casper/initrd.lz
}

i mounted the iso first via the instructions on the link below to make sure the vmlinuz and initrd.lz files were correct. they were, but in the initial entry suggestion initrd had a .gz file extension so this step saved me from messing up that line. as well, later when i got around to installing lubuntu (both lxde and lxqt) with the same method, it helped me see that initrd didn’t have a file extension in that iso. eventually i copied the iso to /.

i added the menu entry to the very end of my /boot/grub/grub.cfg file (even though that file explicitly warns [“DO NOT EDIT THIS FILE”] against doing so!) as suggested in the lq post even though the ubuntu.com article recommended other locations. i felt like that saved me a few steps in the long run. i did make a system backup with clonezilla before the adding and testing the entry just in case that borked everything.

sure enough the next boot gave me an option at the bottom of my grub menu to boot the iso and it did so. i went ahead and chose to install since the original question was about installation instead of just booting.

after choosing my third partition to install on, i got a warning that the system would need to unmount the disk to rewrite the partition table. i wasn’t sure what to do there since i figured the disk had to be mounted to read the isofile. neither choosing to continue with the install (let the system unmount the disk) or pressing the back button got me any farther down the road so i had to kill ubiquity from the terminal.

luckily ubuntu.com had that one covered as well. a simple sudo umount -l -r -f /isodevice took care of business and the next attempt at install was successful.

i didn’t go back to make sure the same method worked with a usb as stated in the orinal lq response. i figured if it would read and write from /, getting the system to do the same from a usb (by switching the loopback loop to (hd1,1)) should be easy enough (if not redundant). i tested the system a couple more times with lubuntu just because i was interested in seeing them in action.

learning how to get there took a bit of time and it took me a few days to decide i wanted to do so, but in the end i was able to do the second lubuntu install easily. i figure this method is comparably easier (provided a system with grub 2 already exists) to dd’ing an image and then switching boot devices when all is said and done.

i am adding this to the ubuntu category because all three of my installs so far have been either ubuntu flavors or ubuntu based. i still want to try installing debian and antiX on my 32-bit machine just to see how their speed and weight compare. if those work with the same or similar method i will look to switching categories :slight_smile:

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

3 Likes

I had 2 similar experiences.

  1. I was looking for a very easy to use distribution that was similar to Windows, which made me stumble upon Slax, back when it was still based on Slackware. Unfortunately, it was only meant to be used as a live system. So a couple of days later containing a lot of trial and error as well as the corresponding research, I managed to make the installation permanent just from having a medium that was meant only to be used live.
  2. Like a year ago, I wanted Linux on my Laptop, but all it has are 2 USB 3.0 slots and no CD/DVD drive, at all. Luckily, it has an M.2 SSD drive alongside the SSHD (now replaced with an SSD) which allowed me to install the ISO onto the M.2 SSD from which I was able to boot. Without this second storage medium I probably wouldn’t have been able to install Linux, as UEFI has trouble recognizing USB3.0 for installations and the USB ports on this laptop were extremely buggy (and still partially are) when using Linux, anyway.
2 Likes

i find it amazing what a bit of ingenuity and creative thinking mixed with well-reasoned know-how can accomplish. i know i wouldn’t be nearly as far along in my admittedly still limited understanding of linux if it weren’t for communities like these where people can swap helpful (or at the very least, probative) thoughts and ideas.

2 Likes

You have your own Linux distro? I’m impressed.

1 Like

oh, goodness, no. you’re right. the wording on that could have been better :slight_smile: i just meant the distro that i predominantly use.

my initial two tries with antiX were not successful. i will try looking through some more documentation to see if i am missing something about what files aren’t loading correctly.

I have also tried antiX -

Unsucksefully!-!

:expressionless: :upside_down_face: