You are not logged in.

#1 2012-07-25 16:09:04

bobpaul
Member
From: ND, USA
Registered: 2012-07-25
Posts: 8

Boot directly from ISO? [Solved]

I have Grub2 installed on a thumbdrive. With Arch, I put the following in my grub.cfg and am able to boot directly from the Arch iso without having to extract anything from it

set drive_label=CORSAIR
menuentry "Arch 2012 (i686)" {
  set FILE=/boot/isos/archlinux-2012.07.15-netinstall-dual.iso
  loopback loop $FILE
  linux (loop)/arch/boot/i686/vmlinuz img_loop=$FILE lang=en locale=en_US.UTF-8 img_dev=/dev/disk/by-label/$drive_label archisolabel=ARCH_201207
  initrd (loop)/arch/boot/i686/archiso.img
}

I tried to do the same with archbang and it's not working. For reference, here's what I have in my grub.cfg

set drive_label=CORSAIR
menuentry "Archbang 2012.0-4.30 (x86)" {
  set FILE=/boot/isos/archbang-2012.04.30-i686.iso
  loopback loop $FILE
  linux (loop)/arch/boot/i686/vmlinuz img_loop=$FILE lang=en locale=en_US.UTF-8 img_dev=/dev/disk/by-label/$drive_label archisolabel=ARCHBANG archisobasedir=arch
  # for Vesa mode... add: xorg=visa nomodeset
  initrd (loop)/arch/boot/i686/archiso.img
}

and here's the error I'm getting

Booting the kernel
:: Starting udevd...
done
:: Running Hook [udev]
:: Triggering uevents... done.
:: Running Hook [archiso]
:: Mounting '/dev/disk/by-label/ARCHBANG' to '/run/archiso/bootmnt'
Waiting 30 seconds for device /dev/disk/by-label/ARCHBANG ...
ERROR: '/dev/disk/by-label/ARCHBANG' device did not show up after 30 seconds...
    Falling back to interactive prompt
    You can try to fix the problem manually, log out when you are finished
sh: can't access tty; job control turned off
[rootfs /]#

Looking around after the prompt, I don't see any img_dev folder like I'd get on arch, and no loopback device has been created. Does archbang simply not support this method, or do I have the wrong switches (I know ubuntu uses findiso/scan=/boot/iso/ubuntu.iso, but I figured archbang would work the same as upstream...)

Last edited by bobpaul (2012-07-30 15:07:01)

Offline

#2 2012-07-25 17:52:43

mike4ca
Happy (Arch|Manjaro)[B,b]ang User
From: Iowa, USA
Registered: 2011-10-17
Posts: 435

Re: Boot directly from ISO? [Solved]

Have you seen this http://bbs.archbang.org/viewtopic.php?id=2051?  It has instructions to a similar install on a hard drive (but using grub legacy).  Let us know if you still have questions/problems.


Free Software Foundation member 10865

Offline

#3 2012-07-25 22:07:26

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

This is something I would need to check, your entry is different from Arch Wiki guide on Grub2

https://wiki.archlinux.org/index.php/Gr … From_GRUB2


"Have done an install of archbang while on a bus"

Offline

#4 2012-07-25 23:25:04

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

The one difference between your entry and the entry linked to by Mr. Green is that you lack the "earlymodules=loop" part.

I have found it much easier to just copy the files out of the iso and put them on the hard drive (thumb drive, whatever) and boot them plainly. And I say this for distributions of Linux in general.

Then you just translate from isolinux syntax (same as syslinux syntax) to Grub2 syntax. It's a direct translation, rather than having to figure out how to specify all the iso-related parameters.

Remember that you're not booting the iso. The bootloader in the iso is never executed. It's also important to realize that an optical drive is never emulated. Rather, you are having the bootloader look into the iso file (which requires a bootloader capable of doing so), load the kernel and initrd into RAM, and then pass parameters to the kernel that it's root filesystem is in an iso file rather than a regular partition (which requires a kernel able to do that).

I would imagine that some kind of module needs to be in the kernel image itself or the initial ramdisk (initrd) that would allow the kernel to use the iso as its real root filesystem. That's probably where the need for the "earlymodules=loop" parameter comes from.

If you feel especially lazy, you can just have one installation of Linux on your thumb drive with Qemu installed in that installation of Linux. Then you can just run Qemu as root and have -hda be "/dev/sda" or whatever and -cdrom be your iso file on the thumb drive. That will be 100% identical to using an actual burned-off CD. And it involves no bootloader configuration file work.

Also, if you're in a quick pinch, Unetbootin can help. But that's only good if you only want the thumb drive bootable into one thing. And it uses a mysterious altered version of Syslinux that won't let any customizations to syslinux.cfg work. When I install regular syslinux, those same custom entries work. Maybe that's fixed by now. I've moved on to Grub2 and never looked back.

Jake


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#5 2012-07-25 23:33:07

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

I just tried arch wiki entry [see above] and I could get arch netinstall booting from grub. Archbang failed as it could not find label?

menuentry "ArchBang" {
    set isofile="/iso/archbang-2012.04.30-x86_64.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCHBANG img_dev=/dev/sda1 img_loop=$isofile earlymodules=loop
    initrd (loop)/arch/boot/x86_64/archiso.img
}
file archbang-2012.04.30-x86_64.iso 
archbang-2012.04.30-x86_64.iso: # ISO 9660 CD-ROM filesystem data 'ARCHBANG                        ' (bootable)

Strange!


"Have done an install of archbang while on a bus"

Offline

#6 2012-07-26 00:01:20

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Archbang failed as it could not find label?

I think it'd be more accurate to say that it simply can't find the device all-together because it doesn't exist.
I'm suspecting that "loop" was not put in the initrd (in mkinitcpio.conf), or somehow the module necessary to see a loop device isn't loaded.

I know that ArchBang by default does not load the loop module. If you do "ls /dev/loop*" on a default installation of ArchBang (not tweaked by a user yet), you will only get "loop-control". You must do "sudo modprobe loop" first before you can use any loopback devices. Then "ls /dev/loop*" will yield "loop-control, loop0, loop1, [etc.]", provided more than zero loopback devices are allowed.

So if ArchBang by default does not load the loop module, it doesn't surprise me that the ArchBang Live Installer doesn't either, and thus can't mount an iso file as its real root filesystem.

Jake


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#7 2012-07-26 00:05:23

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

From live iso ....

[live@archbang ~]$ lsmod | grep loop
loop                   18160  6 
[live@archbang ~]$ history
    1  lsmod | grep loop
    2  history
live@archbang ~]$ ls /dev/lo
log           loop1         loop3         loop5         loop7
loop0         loop2         loop4         loop6         loop-control

"Have done an install of archbang while on a bus"

Offline

#8 2012-07-26 00:07:03

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Ok. But is that loaded before or after the real root filesystem is mounted?

Is "loop" in mkinitcpio.conf?


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#9 2012-07-26 00:09:02

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

In mkinitcpio.conf no....


"Have done an install of archbang while on a bus"

Offline

#10 2012-07-26 00:13:22

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Ok. Try this:

Intentionally screw up the boot. Tell it to use a device that doesn't exist or something. Make it get stuck at the initial ramdisk somehow, and drop you to a recovery console.

Run lsmod | grep "loop" there.


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#11 2012-07-26 00:16:56

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

loop  18672

"Have done an install of archbang while on a bus"

Offline

#12 2012-07-26 00:31:55

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Wow. BTW, I tried to do that myself and my USB keyboard wouldn't work at the recovery prompt from an ArchBang Live installer.

Mr. Green, what kind of keyboard were you using? USB? PS/2? PS/1? Telekinesis?


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#13 2012-07-26 00:33:26

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Did you try with the "earlymodules=loop" parameter? Maybe the module _still_ isn't loaded early enough.

Last edited by SpawnHappyJake (2012-07-26 00:34:05)


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#14 2012-07-26 00:41:43

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

#!/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 "Archlinux-2011.08.19-netinstall-x86_64.iso" {
    set isofile="/iso/archlinux-2012.07.15-netinstall-dual.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201207 img_dev=/dev/sda1 img_loop=$isofile earlymodules=loop
    initrd (loop)/arch/boot/x86_64/archiso.img
}

menuentry "ArchBang" {
    set isofile="/iso/archbang-2012.04.30-x86_64.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCHBANG img_dev=/dev/sda1 img_loop=$isofile  earlymodules=loop
    initrd (loop)/arch/boot/x86_64/archiso.img
}

Keyboard is usb....


"Have done an install of archbang while on a bus"

Offline

#15 2012-07-26 01:08:43

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Well, unless it's a problem with the kernel itself, or if the specified label is wrong, I'm out of ideas and here's why:

Following the boot process and thinking of everything needed for each step:

(From power-on to firmware to bootloader to passing control to kernel and getting kernel and initrd in memory obviously work)

Telling the kernel what to mount as it's real filesystem (and everything it would need to see and use it):

You specified the device that contains the iso file. Could it not have the module(s) nessicary to read whatever medium is holding the iso file, by chance?

You specified the image file on the device (and to go into "iso booting mode"). It has the loop module loaded. The iso9660 driver should be loaded as well. (always think: 1. what do I need to get to the drive (usb, sata, etc. drivers) 2. Load ability to understand its partitioning scheme. 3. Specify partition and load ability to use its filesystem)


Notice it looks for the device in /dev/disk/by-label. At least in Mint, when I do "sudo mount -o loop [iso file]", it appears in /dev/disk/by-label, confirmed by doing "sudo blkid /dev/loop[X]" (to see if I got the label right). So it should appear there.

Then it should mount it as the real filesystem.

Jake


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#16 2012-07-26 01:22:54

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Well first entry worked with arch netinstall iso and it has archiso as its base.

Going to try changing iso label just to rule it out.

Will admit I am running this under virtualbox, there is no way I would reboot my desktop this many times smile


"Have done an install of archbang while on a bus"

Offline

#17 2012-07-26 01:38:46

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Wondering if it a problem with archiso hook, as it reaches it before displaying error message.....


"Have done an install of archbang while on a bus"

Offline

#18 2012-07-26 02:21:39

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

This is from archiso git README

archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL>

What on earth is target-fs-label? drive I am booting from?


"Have done an install of archbang while on a bus"

Offline

#19 2012-07-26 03:18:17

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Well, just "target-fs" would be your target filesystem, i.e., the filesystem image, such as an iso file, which is at least an iso9660 filesystem image.

So target-fs-label, I imagine, would be the label of that filesystem according to that filesystem.

Mount the filesystem (the iso) and run:

sudo blkid /dev/loop0

, replacing "/dev/loop0" with the actual loop device you used.

So good job Mr. Green! I think you may have found what we were doing wrong: specifying the name of the iso file, rather than the label of the filesystem therein.

Maybe. I'm on my iPhone right now, which cuts off some of the code sections, so I can't see what was tried right now.

Jake

Last edited by SpawnHappyJake (2012-07-26 03:19:45)


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#20 2012-07-26 04:50:57

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Ok it does look like an ArchBang issue, the error as always was telling us the problem.

/dev/disk/by-label/<foo>

The directory /dev/disk/by-label is not found on ArchBang iso loop, but is present on Arch netinstall. As yet I am not sure if it archiso that needs to be updated then image rebuilt.

Dare not use the word bug until I try a test build possibly a feature.

Not sure as to a work around.....

Double checked and directory is present on ArchBang iso [running live] and in there is ARCHBANG label, issue lies somewhere else.


"Have done an install of archbang while on a bus"

Offline

#21 2012-07-26 12:50:58

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Reminds me of this old bug: http://bbs.archbang.org/viewtopic.php?id=2108

The workaround would be to find which loop device it's using and do:

img_dev=/dev/loop[X]

replacing "[X]" with the number it's using. I suspect it's using number zero.


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#22 2012-07-26 13:30:44

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

In the Archlinux netinstall label is linked to '../../loop0'


"Have done an install of archbang while on a bus"

Offline

#23 2012-07-27 00:46:47

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Ok after much head scratching I have managed to solve the problem.

It is a simple case of adding 'archiso_loop_mnt' hook to build, now works like a charm.

This does mean however that you either have to rebuild iso or wait for me to upload next release.

More likely some time next week I release testing isos.....with minor updates....


"Have done an install of archbang while on a bus"

Offline

#24 2012-07-27 12:19:57

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Awwwwwww! I _thought_ it was something missing from the initial ramdisk! Those errors seem to always be because of that.

What is ".../.../loop0"? Wouldn't there have to be a /dev/loopX?


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#25 2012-07-27 12:32:26

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

ARCHBANG label is linked ../../loop0


"Have done an install of archbang while on a bus"

Offline

#26 2012-07-27 20:18:59

mike4ca
Happy (Arch|Manjaro)[B,b]ang User
From: Iowa, USA
Registered: 2011-10-17
Posts: 435

Re: Boot directly from ISO? [Solved]

Wow, this turned into more than I expected.  I hope bobpaul found the answer in this string.  Good job everyone.


Free Software Foundation member 10865

Offline

#27 2012-07-27 23:21:56

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

I have uploaded a couple of test isos that include archiso_loop_mnt which allows grub2 booting, no so much of a bug more a missing feature!


"Have done an install of archbang while on a bus"

Offline

#28 2012-07-30 10:51:54

bobpaul
Member
From: ND, USA
Registered: 2012-07-25
Posts: 8

Re: Boot directly from ISO? [Solved]

mike4ca wrote:

Wow, this turned into more than I expected.  I hope bobpaul found the answer in this string.  Good job everyone.

Yeah, I was out of town for a long weekend (wedding) and was really only expecting "we don't have init scripts to process any ISO booting" (which I suspected) or "we use different syntax than arch for some reason".

SpawnHappyJake wrote:

The one difference between your entry and the entry linked to by Mr. Green is that you lack the "earlymodules=loop" part.

I have found it much easier to just copy the files out of the iso and put them on the hard drive (thumb drive, whatever) and boot them plainly. And I say this for distributions of Linux in general.

earlymodules has never been necessary for me in the past. (see edit 2) Is there even anything in the initscripts that parses for earlymodules? This sounds more like something that is supposed to be passed to whatever is building the initramfs image, not something you'd pass on the kernel command line. All the modules included in the initramfs are, by definition, "earlymodules".

Edit: Ok. Looks like early modules is handled on line 29 of "init" in the initramfs. But even without it, the loop module is already loaded by the time it quits to the busybox recovery shell...

Edit 2: Wow. And it seems after finding djgera's workaround in august, I never saw he updated the thread earlymodules as a simpler workaround in december... ::facepalm:: Anyway, Gerardo's patch should make "earlymodules" no longer necessary for future ISOs, such as the 2012.07.15 images that were just released.

As for copying, yeah... if I absolutely have to do that, I will. But while it may be easier to setup initially, it's more work to keep up to date in the future. Using the ISO, I just wget the new ISO and change the name in the grub.cfg. Extracting seems like an unnecessary step if grub is happy doing that for me. And if my thumbdrive is getting full, downloading a new ISO and then extracting it doubles the amount of space I need during the process, which means I might not be able to do the procedure while booted from something on the thumbdrive.

Mr Green wrote:

I have uploaded a couple of test isos that include archiso_loop_mnt which allows grub2 booting, no so much of a bug more a missing feature!

Thanks Mr Green! That's exactly what I was hoping for.  Where would I find these? In the mean time, I'm just manually typing the following into the recovery console to duplicate what the initscripts on arch do.

mkdir /img_dev; mount $img_dev /img_dev; losetup -f /img_dev/$img_loop; exit

Last edited by bobpaul (2012-07-30 11:28:59)

Offline

#29 2012-07-30 11:09:16

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Try the test isos, they include hook you need...


"Have done an install of archbang while on a bus"

Offline

#30 2012-07-30 11:20:36

bobpaul
Member
From: ND, USA
Registered: 2012-07-25
Posts: 8

Re: Boot directly from ISO? [Solved]

Mr Green wrote:

Try the test isos, they include hook you need...

Yeah... where do I find those? There's no link on the download page. Sorry; I'm new to archbang.

Edit: Nevermind... Found it!

Last edited by bobpaul (2012-07-30 11:36:03)

Offline

#31 2012-07-30 11:36:24

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]


"Have done an install of archbang while on a bus"

Offline

#32 2012-07-30 11:36:30

mike4ca
Happy (Arch|Manjaro)[B,b]ang User
From: Iowa, USA
Registered: 2011-10-17
Posts: 435

Re: Boot directly from ISO? [Solved]

The test iso is a sticky topic at the top of the Announcement section of this forum.  Here is the link to that topic: http://bbs.archbang.org/viewtopic.php?id=2576


Free Software Foundation member 10865

Offline

#33 2012-07-30 11:40:24

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

I had got to search box then bobpaul beat me to the draw


"Have done an install of archbang while on a bus"

Offline

#34 2012-07-31 07:54:01

caesium
Member
Registered: 2012-07-31
Posts: 5

Re: Boot directly from ISO? [Solved]

This is still not working for me.
It says Waiting 30 seconds for device....
My entry in grub:

menuentry "ArchBang" {
    set isofile="/home/caesium/iso/archbang-2012.04.30-i686.iso"
    loopback loop (hd0,1)$isofile
    linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCHBANG img_dev=/dev/sda1 img_loop=$isofile earlymodules=loop
    initrd (loop)/arch/boot/i686/archiso.img
}

How do I boot an extracted iso?

Last edited by caesium (2012-07-31 08:24:29)

Offline

#35 2012-07-31 09:25:42

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Might help if you use the isos from testing


"Have done an install of archbang while on a bus"

Offline

#36 2012-07-31 09:30:02

caesium
Member
Registered: 2012-07-31
Posts: 5

Re: Boot directly from ISO? [Solved]

I use them...

Offline

#37 2012-07-31 10:10:33

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Err no

archbang-2012.04.30-i686.iso

http://bbs.archbang.org/viewtopic.php?id=2576

Check the post and links to isos you should see they have been updated.


"Have done an install of archbang while on a bus"

Offline

#38 2012-07-31 10:23:16

caesium
Member
Registered: 2012-07-31
Posts: 5

Re: Boot directly from ISO? [Solved]

If I follow that link, the iso´s name or the whole link is:

http://sourceforge.net/projects/archban … o/download

Maybe there is some problem?!
I am from Germany btw.

I tried from the server of the university and its the same...

Last edited by caesium (2012-07-31 10:25:31)

Offline

#39 2012-07-31 10:32:25

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

Try now, looks like they had the wrong urls.

You can of course get files directly from

https://sourceforge.net/projects/archbang/files/

Let me know if it works now


"Have done an install of archbang while on a bus"

Offline

#40 2012-07-31 10:49:42

caesium
Member
Registered: 2012-07-31
Posts: 5

Re: Boot directly from ISO? [Solved]

Thanks a lot.
I will try these isos now.
It works! Thank you!

Last edited by caesium (2012-07-31 11:07:18)

Offline

#41 2012-07-31 11:45:35

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

I am glad to get some feedback smile


"Have done an install of archbang while on a bus"

Offline

#42 2012-08-05 05:39:54

caesium
Member
Registered: 2012-07-31
Posts: 5

Re: Boot directly from ISO? [Solved]

Could anyone tell me, how to mount files, extracted from the iso?
Is there a gain in performance, compared to mounting the iso file directly?

Offline

#43 2012-08-05 09:44:09

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]


"Have done an install of archbang while on a bus"

Offline

#44 2012-08-05 23:23:02

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Ok Caesium, here's the full scoop:


Background info:

Linux creates files called "abstraction files" for mountable things, such as hard drives. For example, the file /dev/sda is the abstraction file for your first internal hard drive.

There's a folder, /dev, and in that folder are files completely made up by Linux. They are not stored on a hard drive anywhere; they're made-up.

Each of these files is zero bytes. When you try to read from one, Linux passes info from the associated device to you, rather than getting nothing. Likewise when you write to them. Linux sends the data you try to write to the file to the actual device. For example, reading and writing to /dev/sda reads and writes to the associated hard drive.

/dev/sda1 is an abstraction file made just for the first partition of /dev/sda. And there could be /dev/sda2 and so on.

Such abstraction files are called block devices. Block devices can be mounted like the following:

sudo mount /dev/sda2 /media/cool-stuff

That mounts the partition associated with /dev/sda2 at /media/cool-stuff. Now when you navigate to /media/cool-stuff, you will see the files stored on the second partition of your hard drive in that directory.

In fact, the method Linux uses to make those abstraction files show up in /dev is by mounting the fictitious filesystem "devtmpfs" at /dev.



It's important to realize you can only mount filesystems. If /dev/sda has three partitions, and each partition is formatted to a filesystem, you can't just mount /dev/sda. Only the individual partitions. /dev/sda isn't a filesystem, rather, it _contains_ filesystems. But if you formatted the entirety of /dev/sda to a filesystem (not a good idea), then you could mount just /dev/sda. That's how floppies are: just one big filesystem. Even if a hard drive only has one partition, there's still stuff that comes before the partition not a part of the filesystem, so you'd still have to mount /dev/sda1 rather than /dev/sda.


Getting on to it:


Typically, mounting an image in Linux is done by connecting that image to a loopback device, and then mounting that loopback device just like a regular block device, such as /dev/sda2.

To connect an image to a loopback device, there must be a loopback device to connect it to.

Do this to see if you have any loopback devices:

ls /dev/loop*

The "*" is a "wild card" and "ls" is the "lister" program.  The above command lists all files whose name begins with "loop" and are in the "/dev" folder.

There should be a "/dev/loop-control" in there. That doesn't count. You need stuff like "/dev/loop0, /dev/loop1, etc.".

If you have no loopback devices in there, you need to insert the loop module into the kernel, which is done by the following:

sudo modprobe loop

Now there should be some loopback devices available. Check to see that there are:

ls /dev/loop*

Now, connect the image to a loopback device:

sudo losetup /dev/loop0 [path to image]

Note the above command is backwards compared to most commands. Usually it's input and then output/the something and then the somewhere. But here, it's almost like the output is first (the target loopback device) and the input is last (the image file). Very rarely is a command backwards like this. I only know of this one in Linux that's backwards, and one other in Mac OS X.

Also note that you need to use an unused loopback device. If /dev/loop0 is in use, you can try /dev/loop1 and so on. Or you can just have it tell you the first unused loopback device:

sudo losetup --find

Now ask yourself, is /dev/loop0 (or whichever one you used) a filesystem, or does it contain filesystems? If /dev/loop0 itself is a filesystem, then you can just directly mount it:

sudo mount /dev/loop0 /media/imaged-cool-stuff

In the case of an iso image, by definition, it is an image of an iso9660 filesystem, therefore the loopback device you connected it to is a filesystem, and you can directly mount it.

If you connected /dev/loop0 to a hard drive image containing partitions, then /dev/loop0 is like /dev/sda. You need something equivalent to /dev/sda1, /dev/sda2, etc.

Linux does not automatically create abstraction files for each partition within a loopback device. This doesn't mean you can't get it to make them.

To do so, first install kpartx:

sudo pacman -S multipath-tools

Now use kpartx to get the kernel to scan the loopback device for partitions and make abstraction files for them:

sudo kpartx -a /dev/loop0

If /dev/loop0 contains partitions, the abstraction files for the individual partitions will now show up under /dev/mapper.

Example:

ls /dev/mapper/loop0*

might yield:

/dev/mapper/loop0p1
/dev/mapper/loop0p2
/dev/mapper/loop0p3

If /dev/loop0 has three partitions.

Now you can mount a partiton that was within the image:

sudo mount /dev/loop0p1 /media/partitioned-imaged-cool-stuff



There is a shortcut command that connects an image file to a loopback device and mounts it all in one command:

sudo mount -o loop [path to image] /media/imaged-cool-stuff

However, note that the above depends on there being available loopback devices, so the loop module must be inserted beforehand.
Also, the image you tell it to mount must be a filesystem, rather than contain one or more filesystems.

You can get away with the above with iso images because they are filesystems.


And a note about audio CD images:

Music CDs contain no filesystems. They only have tracks (and a few other structures), where each track has a song raw-written to it, rather than stored as a file in a filesystem.

Thus it's actually impossible to directly mount audio CDs. Rather, you actually mount a program that generates a fake filesystem with files in it based off the audio CD, where each generated file is the audio of a track. This makes ripping the CD as easy as copying the files off.

However, this has implications for audio CD images. First, it is incorrect to name an audio CD image with the ".iso" file extension, because, by definition, ".iso" image files are images of an iso9660 filesystem, and like I said, audio CDs have no filesystem, so there's no way you can make an iso of an audio CD.

Since an auido CD image has no filesystem, you can't mount it. You can, however, link it to a loopback device:

sudo losetup /dev/loop0 [path to image]

I don't know if that audio-file-generating program scans loopback devices or not, however.




It is also important to realize that mounting an image via a loopback device DOES NOT EMULATE HARDWARE. If you wish to actually emulate a CD drive, use CD Emu.



Extracting Files from iso:
Once the iso is mounted, you can just navigate to where it is mounted and copy files out.

There are also archive programs that allow you to copy files out of the iso directly, as if it were a zip.


Extracting v.s. Not Extracting:
As I understand it, some isos have built-in compression.

If the iso has built in compression, then, theoretically, you can get a performance gain from _NOT_ extracting and using the iso as it is because you will have less data to read off the hard drive or thumb drive. Since the hard drive or thumb drive is the slowest part of the machine, you are minimizing a bottleneck.

To do the decompression, you consume more CPU (and a little more RAM), but there should still be an overall performance increase because the slowness of the storage medium is so great compared to the minor increase in CPU usage.


However, you now are dealing with one big file rather than a bunch of small files. This means fragmentation can become an issue. On ext filesystems, fragmentation should be zero or near zero, provided the drive isn't close to full, because ext spreads files apart from each other in attempts to prevent fragmentation.

If the iso file is very fragmented, you'd be better off just extracting the files and running them normally.

However, when using iso files, everything is contained in one file, which might be easier for you to manage. A previous poster mentioned that isos have the advantage of being wgettable, making updating a one-step process, rather than having to re-extract for each update.


Personally, I have always just extracted. I do this mainly for simplicity. Instead of having to figure out fancy kernel line options to tell the kernel to boot out of an iso, I just boot it plainly. It's a direct translation from syslinux syntax (given in isolinux.cfg, or a linked-to config file) to Grub2 syntax.

As far as organization, I just use folders and/or partitions. A folder is just as easy to manage as a single file, at least when armed with a GUI and a GUI file manager. From commandline, yeah, a single file is easier to deal with than a folder.

Although in theory all Live Linux installers should be able to run out of a folder, 32-bit versions often have a bug where the Live installer demands that it be on the root level, thus requiring its own partition. So for those, I can see an advantage to using the iso. Fortunately with Arch-based distros, I don't have that problem.

The iso file contains a bunch of stuff you don't need, such as syslinux config files, syslinux background images, and perhaps even a syslinux installer and other stuff. When I extract, only what I need is on the thumb drive. This can take up less space on the thumb drive if the iso isn't compressed, and in theory can take up less space than a compressed iso, but I doubt that would ever actually happen, unless they really pack it full of unnesicary stuff.

Cheers,
Jake

Edit: Thank you Mr.Green for the "bold" tip.

Last edited by SpawnHappyJake (2012-08-06 17:57:10)


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

#45 2012-08-06 00:13:25

Mr Green
^! Developer
Registered: 2010-11-07
Posts: 5,379

Re: Boot directly from ISO? [Solved]

There is not much advantage to running poor mans install [frugal] other than either a rescue system or simply testing an iso.

Running an iso via copy2ram whole new ball game.

@Jake [bold] tag should be [ b ] (no spaces)


"Have done an install of archbang while on a bus"

Offline

#46 2012-08-06 11:14:11

mike4ca
Happy (Arch|Manjaro)[B,b]ang User
From: Iowa, USA
Registered: 2011-10-17
Posts: 435

Re: Boot directly from ISO? [Solved]

@Jake, make sure you take the following as a complement.  I would like to call you Professor Jake!  Some of the background information you have provided in recent posts has taught me a lot.  Not just how to get it to work, but what is really going on at a deeper level in the system.


Free Software Foundation member 10865

Offline

#47 2012-08-06 17:47:03

SpawnHappyJake
Member
Registered: 2012-01-13
Posts: 210

Re: Boot directly from ISO? [Solved]

Thank you very much Mike4ca!


WARNING/DISCLAIMER: My posted solutions (or attempts thereof) are usually my attempt at (re)iterating something that worked for _me_. I do not guarantee they will work for you. Use at your own risk.
My solutions may not be the simplest solutions, either. However, I do not intentionally add pointless complications.

Offline

Board footer

Powered by FluxBB