You are not logged in.

#1 2022-09-14 18:14:17

zaxdan69
Member
Registered: 2016-06-04
Posts: 271

Boot archlinux iso from grub error

I'm trying to add archlinux install iso to boot it from grub, but when it boots drops me to rootfs# with error cannot find device...
I think that the problem is that I keep the iso to ntfs partition. I tried to mount it from rootfs# and I get error: unknown filesystem ntfs
Here is the entry in 40_custom:

menuentry "Archlinux ISO" { 
	insmod ntfs
	insmod search_fs_uuid
	search --no-floppy --set=isopart --fs-uuid 3A0ED42E0ED3E145433
	set isofile="/isos/Linux/archlinux-2021.06.03-x86_64.iso" 
	loopback loop ($isopart)$isofile
	linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=/dev/disk/by-uuid/3A0ED42E0ED3E145433 img_loop=$isofile earlymodules=loop,ntfs
	initrd (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/amd-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}

Any idea what is wrong?

Last edited by zaxdan69 (2022-09-14 18:14:59)

Offline

#2 2022-09-14 18:55:07

itdoesntwork
Member
Registered: 2022-09-14
Posts: 6

Re: Boot archlinux iso from grub error

If think #rootfs is the "emergency" shell from the initramfs.
It could be that your initramfs image is missing the ntfs3 module or the is an error while loading it.
Try to run modprobe ntfs3 in the initramfs shell to see if it loads. If it doesn't you might have to re-create the initramfs image to add the module.
Also, I'm not sure about this but try to change in the linux line of grub earlymodules=loop,ntfs to earlymodules=loop,ntfs3 (I could not find the a module named ntfs on my machine but there is one named ntfs3).
I would also run dmesg to gather more information.

Offline

#3 2022-09-14 19:05:07

zaxdan69
Member
Registered: 2016-06-04
Posts: 271

Re: Boot archlinux iso from grub error

Thanks, I already tried the ntfs3 which didn't work. I didn't try modprobe ntfs but I will.

Offline

#4 2022-09-14 19:12:50

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

Re: Boot archlinux iso from grub error

there is no ntfs module (anymore), it's ntfs3 now, for both linux and linux-lts

$ gunzip < /proc/config.gz | grep -i ntfs
# CONFIG_NTFS_FS is not set
CONFIG_NTFS3_FS=m

but then again it looks like you are using an iso that is one and a half years old... not sure when the change was made

another option would be to create a dedicated partition for the iso file. at that point no loop mounting is required at all (provided the initramfs is capable of finding its iso by UUID or similar)

support for loop mounting iso is unfortunately, not very wide spread, lots of ISOs have issues with it

Offline

#5 2022-09-15 06:33:05

zaxdan69
Member
Registered: 2016-06-04
Posts: 271

Re: Boot archlinux iso from grub error

I was thinking to try with latest iso too. I'm downloading it now.
What you mean about create a partition for iso? To extract the iso contents there? Can you give more info about it?
EDIT:
Same problem with the new iso. I ended up by creating a small(1.2G) partition, formated it to ext4 and I put the iso there.

Last edited by zaxdan69 (2022-09-15 08:17:12)

Offline

#6 2022-09-16 10:22:24

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

Re: Boot archlinux iso from grub error

zaxdan69 wrote:

What you mean about create a partition for iso? To extract the iso contents there? Can you give more info about it?

Create a partition of exactly the same size as the ISO then dd / cp the ISO to it. No other filesystem involved.

cp archlinux-2022.09.03-x86_64.iso /dev/sdx3
# parted /dev/sdx print
Model: Samsung Flash Drive (scsi)
Disk /dev/sdx: 64.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End     Size    File system  Name                              Flags
 2      32.8kB  1049kB  1016kB               bar-grub                          bios_grub
 1      1049kB  34.4GB  34.4GB               bar-data
 3      34.4GB  35.2GB  833MB                bar-iso-ARCH_202209               lvm
 4      35.2GB  35.9GB  753MB                bar-iso-RESCUE904                 lvm
 5      35.9GB  39.8GB  3827MB               bar-iso-Ubuntu-22.04.1-LTS-amd64  lvm
 6      39.8GB  40.6GB  795MB                bar-iso-RESCUE903-i686            lvm
[...]

Grub:

menuentry "archlinux-2022.09.03-x86_64.iso" {
  echo -n archlinux-2022.09.03-x86_64.iso...
    search --set=root --label ARCH_202209 --hint hd0,gpt3
  echo -n linux...
    linux /arch/boot/x86_64/vmlinuz-linux archisobasedir=arch archisolabel=ARCH_202209 $kernelparameter
  echo -n initrd...
    initrd /arch/boot/x86_64/initramfs-linux.img
  echo done. Booting...
}

Downside is that if you delete an iso (a partition) you might not be able to fit another iso in the same gap. I basically append new isos at the end, by the time it's full the iso in the first partition is probably outdated anyway, so you can treat the whole thing as a kind of ring buffer where new isos overwrite old ones. Worst case you'll just have to re-write the same iso again. Alternatively you can just make each partition somewhat larger than necessary, but then you have overhead for each iso and waste space.

It's more difficult to set up partitions than just writing iso files to filesystems, but in return you no longer depend on the loop mounting. It's a hassle to find out which parameters are necessary to make the loop mounting work for each iso... with partition iso you just boot the iso in KVM, grab whatever is in /proc/cmdline and put that in your grub.conf. And it works as long as the iso already uses uuid or label for mounting. It then just mounts /dev/sdx3 instead of /dev/sdy (some USB stick) or /dev/sr0 (some DVD drive).

Offline

#7 2022-09-16 11:32:20

kermit63
Member
Registered: 2018-07-04
Posts: 174

Re: Boot archlinux iso from grub error

Here's my working grub menu entry:

menuentry "Arch ISO" {
    set isofile="/iso/arch.iso"
    search --no-floppy -f --set=root $isofile
    probe -u $root --set=aaa
    set zzz="/dev/disk/by-uuid/$aaa"
    loopback loop $isofile
    linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=$pqr  img_loop=$isofile copytoram archisobasedir=arch earlymodules=loop keytable=us
    initrd   (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}

Note:
1. Replace arch.iso with the actual name of the arch iso.
2. You can take out the copytoram option if your computer has limited amount of memory.
3. The iso file is contained in a folder (in this case /iso) which in turn is in a non-lvm partition. So far I can't get this to work if the iso is within an lvm partition.
4. Change keytable=us to your specific setting. It may also run without it.

Offline

Board footer

Powered by FluxBB