You are not logged in.

#1 2015-07-07 20:22:56

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Why is "archisolabel=..." needed to boot from loopmounted iso?

With the recent finding of probe -u, I am currently successfully using the following grub.cfg to boot loopmounted archlinux iso with grub:

probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"

menuentry '[loopback]archlinux-2015.07.01-dual.iso i686' {
	set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCH_201507 img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/i686/archiso.img
}

menuentry '[loopback]archlinux-2015.07.01-dual.iso x86_64' {
	set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201507 img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/x86_64/archiso.img
}

Still - I wonder why the "archisolabel=ARCH_..." as a kernel parameter is needed. The iso image seems to be perfectly specified with img_dev and img_loop, so this strikes me as an obvious redundancy.

Is there a valid reason for this?

Probably in close relation: the wiki says Do not use the same label as the Arch ISO for the USB device, otherwise the boot process will fail. Which is indeed the case (in the above case, if the label is ARCH_201507, the boot process fails).

Again - wondering why there is (principally) such a limitation.

Could somebody shed some light on this?

EDIT: zapped "earlymodules=loop" (it is not necessary)

Last edited by renergy (2015-07-12 09:13:29)

Offline

#2 2015-07-08 19:20:00

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Re: Why is "archisolabel=..." needed to boot from loopmounted iso?

Actually, the "probe" command in grub can be utilized once more to read the label at boot time:

probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"

menuentry '[loopback]archlinux-2015.07.01-dual.iso i686' {
	set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
	loopback loop $isofile
	probe -l loop --set=isolabel
	linux (loop)/arch/boot/i686/vmlinuz archisolabel=$isolabel img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/i686/archiso.img
}

menuentry '[loopback]archlinux-2015.07.01-dual.iso x86_64' {
	set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
	loopback loop $isofile
	probe -l loop --set=isolabel
	linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=$isolabel img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/x86_64/archiso.img
}

With the above grub.cfg, the only thing (apart from the arbitrary title) left to be set by hand is the iso filename itself.

Still, I'm not overly happy with this solution workaround. Having to pass the archisolabel is just superfluous. Obviously, the boot process relies on the label in some moment. Which I consider suboptimal, but it might be dictated by the possibility to boot from optical drive (just guessing).

EDIT: While updating the wiki, I noticed that archboot does not require "archisolabel=...", and still claims to be bootable from CD, so perhaps there is no reason to rely on the label. Will investigate more and probably file a bug for this, concerning monthly iso.

Last edited by renergy (2015-07-12 09:08:05)

Offline

#3 2015-07-10 09:29:09

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Re: Why is "archisolabel=..." needed to boot from loopmounted iso?

After looking at the init hooks in initramfs (archiso.img) and seeing an older thread, here is a grub.cfg, which does not rely on the label and does not utilize archisolabel:

probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"

menuentry '[loopback]archlinux-2015.07.01-dual.iso i686' {
	set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/i686/vmlinuz archisodevice=/dev/loop0 img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/i686/archiso.img
}

menuentry '[loopback]archlinux-2015.07.01-dual.iso x86_64' {
	set isofile='/boot/iso/archlinux-2015.07.01-dual.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/x86_64/vmlinuz archisodevice=/dev/loop0 img_dev=$imgdevpath img_loop=$isofile
	initrd (loop)/arch/boot/x86_64/archiso.img
}

One line less and functionally better, afaict. With "archisodevice=/dev/loop0", the flashdrive boots even with the "ARCH_201507" label.

Still, it is a half-hack, telling the archiso hook what the archiso_loop_mnt is doing (=mounting the iso image under /dev/loop0), which is odd. The hooks in the boot process have enough information (img_dev, img_loop) to cover this internally. Will try to fix this minor bug in archiso.

Anyhow, for the time being, I consider the above to be an ok solution.

Last edited by renergy (2015-07-12 09:09:06)

Offline

#4 2015-07-10 09:56:12

frostschutz
Member
Registered: 2013-11-15
Posts: 1,166

Re: Why is "archisolabel=..." needed to boot from loopmounted iso?

I have the archisolabel in my grub.cfg because the ISO itself uses archisolabel and I just copied its parameters into my grub.cfg

Now, it may be you don't need it in your specific case. With ISO actually burned to CD media it's a different situation: There may be more than one CD drive and different CDs in them so to identify the correct one you'd have to check the contents of the ISO itself and I guess that is what the label does. When booting from CD there is no identification like "loop mount this particularly named file".

I still think it's a good thing to have in the grub.cfg, after all you could have named it just "archlinux.iso" and in the future you might be replacing it with another version entirely but forget to update your grub.cfg entry, so while your grub entry says it's booting version 2015.07 it's actually booting something else. Unless you want a version-less grub entry (so you never have to edit the grub.cfg whatever archlinux iso version you put on your stick).

Not sure I see the point in probing the label in grub though. It would make sense for a versionless "archlinux.iso" but if you can hardcode archlinux-2015-07.iso you can just as well hardcode the label, no?

Last edited by frostschutz (2015-07-10 10:04:06)

Offline

#5 2015-07-11 13:41:36

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Re: Why is "archisolabel=..." needed to boot from loopmounted iso?

frostschutz wrote:

I have the archisolabel in my grub.cfg because the ISO itself uses archisolabel and I just copied its parameters into my grub.cfg

Now, it may be you don't need it in your specific case. With ISO actually burned to CD media it's a different situation: There may be more than one CD drive and different CDs in them so to identify the correct one you'd have to check the contents of the ISO itself and I guess that is what the label does. When booting from CD there is no identification like "loop mount this particularly named file".

I still think it's a good thing to have in the grub.cfg, after all you could have named it just "archlinux.iso" and in the future you might be replacing it with another version entirely but forget to update your grub.cfg entry, so while your grub entry says it's booting version 2015.07 it's actually booting something else. Unless you want a version-less grub entry (so you never have to edit the grub.cfg whatever archlinux iso version you put on your stick).

Not sure I see the point in probing the label in grub though. It would make sense for a versionless "archlinux.iso" but if you can hardcode archlinux-2015-07.iso you can just as well hardcode the label, no?

Thanks for the feedback, frostschutz.

I'm concerned with booting from the USB drive, with grub, utilizing loopmounted iso file. I'm trying to make the grub.cfg as simple as possible [but not simpler]. In short, I would like the boot from loopmounted iso to work with the kernel line being just

	linux (loop)/arch/boot/i686/vmlinuz img_dev=$imgdevpath img_loop=$isofile

i.e. without any archisodevice or archisolabel. The goal is not a version-less grub entry. I prefer to have the archlinux-2015.07.01-dual.iso type filename. I am completely fine (and prefer) to hand code that file name to grub.cfg. But that's about it. It should be all downhill from there. Having to adjust the label too is just tedious. Sure I could do it, but why should I if there is nothing gained from doing so, and when I'm convinced it's a pleonasm and it's principally suboptimal?

When booting with grub from USB, there is the "luxury" of knowing exactly where the iso image is. The uuid of the partition is known as is the file location. One passes this info to the boot sequence through kernel parameters "img_dev" and "img_loop". That should be enough to finish the booting.

If one unpacks the initramfs /arch/boot/i686/archiso.img, there is a bunch of scripts being run.
archiso_loop_mnt hook uses img_dev and img_loop to mount the iso - this is ok. But archiso hook sets

    [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}"

i.e. (in the case of already loopmounted iso) it uses archisolabel to find the device. Which is not foolproof (it can fail when there is an arbitrary flash labeled "ARCH_201507") and it ignores the info that is already at hand.

Basically, I think the archiso_loop_mnt hook should set archisodevice to the appropriate /dev/loopX when it successfully mounts the image. I'm about to test this change and propose to get it into the next iso images.

Probably when booting from CD, relying on label is the option that makes the most sense, and then - why not. But that is not what I'm discussing here.

Last edited by renergy (2015-07-12 07:15:16)

Offline

#6 2015-07-12 12:27:41

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Re: Why is "archisolabel=..." needed to boot from loopmounted iso?

Suggested a patch to arch-releng mailing list

https://lists.archlinux.org/pipermail/a … 03562.html

I learned that "earlymodules=loop" is no longer necessary, updated all my post and wiki accordingly.

Last edited by renergy (2015-07-12 14:45:40)

Offline

Board footer

Powered by FluxBB