You are not logged in.

#1 2022-10-15 04:24:23

aphx
Member
Registered: 2022-10-15
Posts: 5

[SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

Been trying to boot an iso from grub for days now. I've tried so many things. lots of copying and pasting and asking for assistance from others. I can't get it to work. Here is my lsblk -f output:

NAME        FSTYPE FSVER LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1                                                                               
├─nvme0n1p1 vfat   FAT32          6BCE-EC40                             439.8M    14% /boot
├─nvme0n1p2 ext4   1.0   isostore e9402ac3-ee36-4488-ad8e-eb88fcda9794    6.6G    10% /boot/iso
├─nvme0n1p3 ext4   1.0   rootpart f5d4cba4-de33-43be-8455-e845ba57650a   62.2G    15% /
└─nvme0n1p4 ext4   1.0   homepart 99a7f715-f5a7-4022-9467-2fd6e535413a  133.6G     4% /home

here is my 40_custom in grub.d:

#!/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.

insmod search_fs_uuid
search --no-floppy --set=isopart --fs-uuid e9402ac3-ee36-4488-ad8e-eb88fcda9794

menuentry '[loopback]archlinux-2022.10.01-x86_64.iso' {
	insmod loopback
	set imgdevpath="/dev/disk/by-uuid/$isopart"
	set root=($isopart)/
	set isofile=$root'archlinux-2022.10.01-x86_64.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
	initrd (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}

I got this script from reading the wiki but I feel like I'm just not understanding...

What I've been reading:

https://wiki.archlinux.org/title/Multiboot_USB_drive
https://wiki.archlinux.org/title/GRUB/Tips_and_tricks
https://wiki.archlinux.org/title/GRUB


I just want to boot an iso from the partition that is holding isos which is the second partition.

Thank you for reading.

EDIT: updated the script and lsblk -f output

Last edited by aphx (2022-10-22 18:26:17)

Offline

#2 2022-10-15 08:15:51

aphx
Member
Registered: 2022-10-15
Posts: 5

Re: [SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

https://i.ibb.co/C2Kjp8N/AC43-BEB6-D991 … C552-E.jpg
here is the error I get when loading up.


Mod Edit - Replaced oversized image with link.
CoC - Pasting pictures and code

sorry for the oversized image

EDIT: here is the text output now:

:: running early hook [udev]
starting version 251.4-1-arch
:: running early hook [archiso_pxe_nbd]
:: running hook [udev]
:: Triggering uevents...
:: running hook [memdisk]
:: running hook [archiso]
:: running hook [archiso_loop_mnt]
:: running hook [archiso_pxe_common]
:: running hook [archiso_pxe_nbd]
:: running hook [archiso_pxe_http]
:: running hook [archiso_pxe_nfs]
:: Setup a loop device from (hd0,gpt2)/archlinux-2022.10.01-x86_64.iso located at device /dev/disk/by-uuid/hd0,gpt2
:: Mounting '/dev/disk/by-uuid/hd0,gpt2' to '/run/archiso/img_dev'
Waiting 30 seconds for device /dev/disk/by-uuid/hd0,gpt2 ...
ERROR: '/dev/disk/by-uuid/hd0,gpt2' 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 ]#

I typed it out best I could from the screen itself. I made some adjustments the 40_custom script which I will add very shortly. Thank you.

Last edited by aphx (2022-10-15 11:44:52)

Offline

#3 2022-10-15 11:54:40

aphx
Member
Registered: 2022-10-15
Posts: 5

Re: [SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

You can see my updated script above and I really feel like I am on the edge of figuring this problem out! As you can see from my last attempt it says when loading

:: Mounting '/dev/disk/by-uuid/hd0,gpt2' to '/run/archiso/img_dev'
Waiting 30 seconds for device /dev/disk/by-uuid/hd0,gpt2 ...

Which seems like a step in the right direction however it makes no sense as to why it is checking for hd0,gpt2 when I specify in the script to use the uuid... These snippets from the script above I would think would tell grub that I am trying to point to the uuid... in fact I never type out (hd0,gpt2) in my new version of the script at all! which is bewildering as to why it is spitting that out:

search --no-floppy --set=isopart --fs-uuid e9402ac3-ee36-4488-ad8e-eb88fcda9794
set imgdevpath="/dev/disk/by-uuid/$isopart"
set root=($isopart)/

I really think I am sooo close. any ideas?

PS: it is now 5:15am. I should sleep. I have read a lot about the subject and my brain feels like spaghetti code. Thanks for reading and or responding if you do. Greatly appreciated.

Sincerely,
a struggling but ambitious noob.

Last edited by aphx (2022-10-15 12:17:51)

Offline

#4 2022-10-15 12:15:43

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

Re: [SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

well, your variables are all set wrong. you're mixing grub device names with kernel ones.

insmod search_fs_uuid
search --no-floppy --set=isopart --fs-uuid e9402ac3-ee36-4488-ad8e-eb88fcda9794

if you need that uuid later, it should be a variable instead, like so:

isouuid=e9402ac3-ee36-4488-ad8e-eb88fcda9794
search --no-floppy --set=isopart --fs-uuid $isouuid

then 'isopart' is for grub use only. and if you need to pass the uuid to the kernel, use the $isouuid variable (instead of putting $isopart into $imgdevpath, which can not work as $imgdevpath will be passed to kernel, but $isopart is for grub only)

same here:

set isofile=$root'archlinux-2022.10.01-x86_64.iso'
loopback loop $isofile
linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=$imgdevpath img_loop=$isofile earlymodules=loop

$root is for grub only, but you're setting it as part of isofile, and then use it in both grub (loopback) and pass it as kernel parameter as img_loop=$isofile.

don't put $root in $isofile. leave grub's naming scheme to grub, and the kernel's to the kernel. you can't mix them.

if you do mix them you get this result of looking for /dev/disk/by-uuid (only available in linux/initrd, not grub) /hd0,gpt2 (a grub device notation, not available in linux) and that's where things stop working for sure

Last edited by frostschutz (2022-10-15 12:25:56)

Offline

#5 2022-10-15 20:39:20

aphx
Member
Registered: 2022-10-15
Posts: 5

Re: [SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

frostschutz wrote:

well, your variables are all set wrong. you're mixing grub device names with kernel ones.

insmod search_fs_uuid
search --no-floppy --set=isopart --fs-uuid e9402ac3-ee36-4488-ad8e-eb88fcda9794

if you need that uuid later, it should be a variable instead, like so:

isouuid=e9402ac3-ee36-4488-ad8e-eb88fcda9794
search --no-floppy --set=isopart --fs-uuid $isouuid

then 'isopart' is for grub use only. and if you need to pass the uuid to the kernel, use the $isouuid variable (instead of putting $isopart into $imgdevpath, which can not work as $imgdevpath will be passed to kernel, but $isopart is for grub only)

same here:

set isofile=$root'archlinux-2022.10.01-x86_64.iso'
loopback loop $isofile
linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=$imgdevpath img_loop=$isofile earlymodules=loop

$root is for grub only, but you're setting it as part of isofile, and then use it in both grub (loopback) and pass it as kernel parameter as img_loop=$isofile.

don't put $root in $isofile. leave grub's naming scheme to grub, and the kernel's to the kernel. you can't mix them.

if you do mix them you get this result of looking for /dev/disk/by-uuid (only available in linux/initrd, not grub) /hd0,gpt2 (a grub device notation, not available in linux) and that's where things stop working for sure

Is there a nice list of all the grub and kernel device names? somewhere I can understand the distinction? I'd like to further my education on the subject. I think I am just confused on how this system works.

Thank you for the guidance.

Offline

#6 2022-10-15 20:53:00

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

Re: [SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

https://www.gnu.org/software/grub/manua … ntion.html
https://www.gnu.org/software/grub/manua … yntax.html

basically all this (device) style with parentheses is grub only. linux won't understand it. linux uses /dev/sdx instead, or UUID= LABEL= ...

'search' returns a grub device. so grub can use it. passing it to the linux as kernel parameter won't work.

filesystem paths and filenames and uuids are identical for both grub and linux, but only if you make a dedicated variable. if you set a variable with mixed contents (grub device followed by path) then linux still can't use it.

filesystem paths as in relative to the filesystem... linux has mount points, grub does not, so a path like /home/user/file does not exist to grub if /home is a separate partition. grub will see it as /user/file on the /home partition

Last edited by frostschutz (2022-10-15 20:55:40)

Offline

#7 2022-10-22 18:25:23

aphx
Member
Registered: 2022-10-15
Posts: 5

Re: [SOLVED] (GRUB) Booting arch installer iso from a partition on ssd.

This is what finally got everything working. Thank you so much frostschutz for your assistance and guidance. I learned a ton about grub and shell scripting while reading and experimenting.

If someone out there is trying to boot an iso from the hdd or sdd hopefully this can help you out.

#!/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.

insmod search_fs_uuid
isouuid=e9402ac3-ee36-4488-ad8e-eb88fcda9794
isopartuuid=194e6f60-8183-784d-aa88-37e76dbbc936

search --no-floppy --set=isopart --fs-uuid $isouuid

menuentry '[loopback]archlinux-2022.10.01-x86_64.iso' {
	insmod loopback
	set imgdevpath="/dev/disk/by-uuid/$isouuid"
	set root=(hd0,gpt2)
	set isofile=/'archlinux-2022.10.01-x86_64.iso'
	loopback loop $isofile
	linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=$imgdevpath img_loop=$isofile root=PARTUUID=$isopartuuid earlymodules=loop
	initrd (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}

Ultimately I am unsure exactly what here might be unnecessary but regardless it works. I am able to mount and launch the installer iso successfully.

Offline

Board footer

Powered by FluxBB