Update-grub does not read /etc/grub.d/40_custom

update-grub does not read /etc/grub.d/40_custom

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

# ajout fl en dessous

# path to the partition holding ISO images (using UUID)
probe -u $root --set=rootuuid
set imgdevpath="/dev/disk/by-uuid/$rootuuid"



menuentry "Porteus5.0 XFCE x86-64 ISO" {
insmod part_msdos
insmod ext2
set root=(hd1,3)
set isofile="/isos/Porteus-XFCE-v5.0-x86_64.iso"
search --no-floppy --file --set=root $isofile
loopback loop $isofile
linux (loop)/boot/syslinux/vmlinuz from=$isofile changes=/50_porteus login=root extramod=/50_porteus/xfce
initrd (loop)/boot/syslinux/initrd.xz
}
menuentry "NEMESIS XFCE x86-64 iso" {
insmod part_msdos
insmod ext2
set root=(hd1,3)
set isofile="/isos/nemesis-xfce-version.iso"
search --no-floppy --file --set=root $isofile
loopback loop $isofile
linux (loop)/boot/syslinux/vmlinuz from=$isofile changes=/1_nemesis login=root extramod=/1_nemesis/modules/
initrd (loop)/boot/syslinux/initrd.xz
}

fl@GL502VMZ:~$ uname -a
Linux GL502VMZ 6.8.0-60-generic #63~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 22 19:00:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
fl@GL502VMZ:~$

Desktop Environment
XFCE

Problem Description:
The menu entries for porteus and nemesis do not show at startup

What I’ve Tried:
I have tried to remove os-prober by changint its file name to .30_custom

Any suggestion would be appreciated.
Thanks.

After creating your custom entries did you make the file executable?

Check with this:
ls -l /etc/grub.d/40_custom

This is not recommended.

I’ll refer you to Welcome To Support And Help or the Start Here page, which states

Your provided paste contains only details of non-Ubuntu systems, so why ask here?

FYI: After changing the file you mention; you need to cause the grub configuration used to boot to be re-created with additional entries you’ve added, I didn’t see where you mention doing this.

You should not remove os-prober to use 40_custom.
For 40_custom I used:

menuentry "Ubuntu 24-04 ISO" {
loopback loop /home/mario/iso/ubuntu-24.04.2-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/home/mario/iso/ubuntu-24.04.2-desktop-amd64.iso noeject noprompt splash --
initrd (loop)/casper/initrd
}

but then I discovered grml-rescueboot: Grub2/ISOBoot - Community Help Wiki
you download the iso in /boot/grml folder. run update-grub and at reboot you find the iso as last entry in grub menu.

2 Likes