Skip to main content
Topic: GRUB not processing 40_custom ?_ (Read 686 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

GRUB not processing 40_custom ?_

Hi there!

I use Artix as the main distro in my multiboot machines, meaning that GRUB is installed under Artix.

I am now adding iso files to Artix's partition so they can be loaded via GRUB, something that has been working fine except for the fact that I often have problem with 40_custom. So far I have been circumventing this by editing grub.cfg, but today I decided that I must find a more elegant solution and after my searching did not yield anything useful I  am asking for your kind advice.

Here my 40_custom:
Code: [Select]
  #!/bin/sh
exec tail -n +3 $0
# !!!   redigerat juni 12, 2024   !!!
# 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.
#
### BEGIN /etc/grub.d/40_custom ###
# 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 'Slackware 15.0 x86_64 (on /dev/sda6)' --class slackware --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-be286b94-f51d-4e7f-9b78-0bc55c85c5f0' {
insmod part_msdos
insmod ext2
set root='hd0,msdos6'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 be286b94-f51d-4e7f-9b78-0bc55c85c5f0
else
  search --no-floppy --fs-uuid --set=root be286b94-f51d-4e7f-9b78-0bc55c85c5f0
fi
linux /boot/vmlinuz-generic-5.15.145 root=uuid=be286b94-f51d-4e7f-9b78-0bc55c85c5f0
        initrd /boot/initrd-generic-5.15.145.gz
}
menuentry 'Slackware 15.0 x86_64 (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge-5.15.117--881297f9-271c-4ec0-8d7b-57bb0832f14d' {
insmod part_msdos
insmod ext2
set root='hd0,msdos6'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  881297f9-271c-4ec0-8d7b-57bb0832f14d
else
  search --no-floppy --fs-uuid --set=root 881297f9-271c-4ec0-8d7b-57bb0832f14d
fi
linux /boot/vmlinuz-huge-5.15.145 root=uuid=be286b94-f51d-4e7f-9b78-0bc55c85c5f0
                initrd /boot/initrd-generic-5.15.145.gz
 }
menuentry 'EndeavourOS_Cassini_22_12 by Manoel, modified> uuid>label' {
    set root=(hd0,gpt2)
     set isofile="/EndeavourOS_Cassini_22_12.iso"
    search --no-floppy --set=root --file $isofile
    probe --label $root --set=label
    loopback loop $isofile
    # Add your linux and initrd lines.
    # For reference here's the parameters I have been using:
     linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=/dev/disk/by-label/$label img_loop=$isofile
     initrd  (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}
menuentry '[loopback] vipnix-livecd-20240410-cdroot' {
insmod search_fs_uuid
isouuid=0487743c-9bc8-4ca4-9630-d0d2f73e3420
isopartuuid=490cb987-09
search --no-floppy --set=isopart --fs-uuid $isouuid
insmod loopback
set imgdevpath="/dev/disk/by-uuid/$isouuid"
set root=(hd0,gpt9)
set isofile='/Vipnix_sumverf/vipnix-livecd-20240410-1358.iso'
loopback loop $isofile
        linux /kernel-funtoo root=UUID=0487743c-9bc8-4ca4-9630-d0d2f73e3420 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs  cdroot modprobe.blacklist=pcspkr modprobe.blacklist=matroxfb_base nodhcp overlayfs=1
                initrd /funtoo.igz
}
menuentry "Reboot"{
           reboot
}
menuentry "Shutdown"{
        halt
}
 

and this is the output of mkconfig:
 
Code: [Select]
# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  initramfs-linux-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Artix Linux (rolling) on /dev/sda10
Found Void Linux on /dev/sda11
Found Funtoo Linux on /dev/sda12
Found Linux Mint 21 Vanessa (21) on /dev/sda5
Found Slackware 15.0 x86_64 on /dev/sda6
Adding boot menu entry for UEFI Firmware Settings ...
done

Resulting grub.cfg content enclosed.

If I know myself someone may find a silly typo.


Re: GRUB not processing 40_custom ?_

Reply #2
Quote
@tintin posted:Good morning,
My two files to compare:

Thank you tintin  !

Were you thinking of os-prober?  As the output of grub-mkconfig shows os-prober is performing fine. The problem is with 40_custom  which I suspect is not a subject of os-prober. But I am   not sure ! 

I can't find anything in /etc/default/grub that might affect the processing of 40_custom, but again I may be missing something.

Re: GRUB not processing 40_custom ?_

Reply #3
If I know myself someone may find a silly typo.
Maybe it's just how you formatted the post ?
But in your displayed 40_custom you have whitespace before the shebang
Code: [Select]
  #!/bin/sh
If it exists in the actual file try removing the leading whitespace.

Re: GRUB not processing 40_custom ?_

Reply #4
Quote
Quote from gripped - 14 June 2024, 23:42:07
Thank you gripped!
I was so hopeful you had found THE typo, but unfortunately it was only in the post.
I have had the same problem in a Fujitsu Lifebook - this time is a Fujitsu Esprimo, - lately. Have been editing grub.cfg directly there also.

Re: GRUB not processing 40_custom ?_

Reply #5
Are you aware of rEFInd ?

Though it can't boot from iso's directly you can create a small partition as large as the iso image, dd the iso to the partition and rEFInd will pick it up automatically so long as you enable its ISO-9660 driver.

 

Re: GRUB not processing 40_custom ?_

Reply #6
Quote
posted by @gripped:
Are you aware of rEFInd ? 

Thanks again, gripped !
Yeah, rEFInd is an old acquaitance from the times I was booting linux in old macbooks, but now that I have invested so much in adapting myself to multibooting with GRUB I would rather have this particular machine behaving as my other multiboots. As posted above I can get around by editing grub.cfg but I am sure there must be an explanation and so I would like to find it.