SOLVED: grub2: problem with loading 40_custom

Kernels & Hardware, configuring network, installing services

SOLVED: grub2: problem with loading 40_custom

Postby francois.e » 2018-01-21 00:10

Using grub2 here is my 40_custom:
Code: Select all
    #!/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.

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

   
    menuentry "porteus PORTEUS 64bit_v40  KDE5-PLASMA sda5" {
    set root=(hd0,5)
    linux /64_V32/boot/syslinux/vmlinuz from=/dev/sda5/64_V32 changes=/64_V32/kde extramod=/64_V32/kde login=root resume=/dev/sda7
    initrd /64_V32/boot/syslinux/initrd.xz
    }
    menuentry "porteus PORTEUS 64bit_v322  KDE5-PLASMA sda5" {
    set root=(hd0,5)
    linux /64_V322/boot/syslinux/vmlinuz from=/dev/sda5/64_V322 changes=/64_V322/kde extramod=/64_V322/kde login=root resume=/dev/sda7
    initrd /64_V322/boot/syslinux/initrd.xz
    }
     menuentry "porteus PORTEUS 64bit_v32  XFCE sda5" {
    set root=(hd0,5)
    linux /64_V32/boot/syslinux/vmlinuz from=/dev/sda5/64_V32 changes=/64_V32/xfce extramod=/64_V32/xfce login=root resume=/dev/sda7
    initrd /64_V32/boot/syslinux/initrd.xz
    }
    menuentry "porteus PORTEUS 1_nemesis  NEMESIS sda5" {
    set root=(hd0,5)
    linux /1_nemesis/boot/syslinux/vmlinuz from=/dev/sda5/1_nemesis changes=/1_nemesis sgnfile=porteus-v3.5-x86_64.sgn login=root
    initrd /1_nemesis/boot/syslinux/initrd.xz
    }
    menuentry "Porteus XFCE x86-64 rc ISO" {
    insmod part_msdos
    insmod ext2
    set root=(hd0,5)
    set isofile="/isos/Porteus-XFCE-v3.2.2-x86_64.iso"
    search --no-floppy --file --set=root $isofile
    loopback loop $isofile
    linux (loop)/boot/syslinux/vmlinuz from=$isofile changes=1_porteus login=root acpi=off
    initrd (loop)/boot/syslinux/initrd.xz
    }


Here is my grub:
Code: Select all
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_DEFAULT=4  #2 pour 40_custom première entrée.

#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/boot/grub/themes/Manjaro-Default/theme.txt"


# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"


How come when I:
update-grub
that it does not take into account the 40_custom file?
Thanks.
Last edited by francois.e on 2018-01-28 00:39, edited 1 time in total.
francois.e
 
Posts: 14
Joined: 2009-03-06 22:03

Re: grub2: problem with loading 40_custom

Postby dotlj » 2018-01-21 02:27

Try
Code: Select all
update-initramfs -u

before
update-grub or grub-mkconfig.
User avatar
dotlj
 
Posts: 591
Joined: 2009-12-25 17:21

Re: grub2: problem with loading 40_custom

Postby p.H » 2018-01-21 12:04

francois.e wrote:Here is my grub:

This looks like the contents of the config file /etc/default/grub.
You want to look at the result of update-grub in /boot/grub/grub.cfg.

Running update-initramfs is irrelevant.
p.H
 
Posts: 220
Joined: 2017-09-17 07:12

Re: grub2: problem with loading 40_custom

Postby francois.e » 2018-01-21 13:03

Code: Select all
update-initramfs -u

before
Code: Select all
update-grub

Did not made a difference. After reboot, I still get a grub menu only for debian and artix.
Thanks.

grub.cfg:
Code: Select all
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e529714f-3ffd-4382-bc74-b5d30da3b4ba
else
  search --no-floppy --fs-uuid --set=root e529714f-3ffd-4382-bc74-b5d30da3b4ba
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=5
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e529714f-3ffd-4382-bc74-b5d30da3b4ba
else
  search --no-floppy --fs-uuid --set=root e529714f-3ffd-4382-bc74-b5d30da3b4ba
fi
insmod png
if background_image /usr/share/desktop-base/softwaves-theme/grub/grub-4x3.png; then
  set color_normal=white/black
  set color_highlight=black/white
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
   set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-e529714f-3ffd-4382-bc74-b5d30da3b4ba' {
   load_video
   insmod gzio
   if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   insmod part_msdos
   insmod ext2
   set root='hd0,msdos1'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e529714f-3ffd-4382-bc74-b5d30da3b4ba
   else
     search --no-floppy --fs-uuid --set=root e529714f-3ffd-4382-bc74-b5d30da3b4ba
   fi
   echo   'Loading Linux 4.9.0-4-amd64 ...'
   linux   /boot/vmlinuz-4.9.0-4-amd64 root=UUID=e529714f-3ffd-4382-bc74-b5d30da3b4ba ro 
   echo   'Loading initial ramdisk ...'
   initrd   /boot/initrd.img-4.9.0-4-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-e529714f-3ffd-4382-bc74-b5d30da3b4ba' {
   menuentry 'Debian GNU/Linux, with Linux 4.9.0-4-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-4-amd64-advanced-e529714f-3ffd-4382-bc74-b5d30da3b4ba' {
      load_video
      insmod gzio
      if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
      insmod part_msdos
      insmod ext2
      set root='hd0,msdos1'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e529714f-3ffd-4382-bc74-b5d30da3b4ba
      else
        search --no-floppy --fs-uuid --set=root e529714f-3ffd-4382-bc74-b5d30da3b4ba
      fi
      echo   'Loading Linux 4.9.0-4-amd64 ...'
      linux   /boot/vmlinuz-4.9.0-4-amd64 root=UUID=e529714f-3ffd-4382-bc74-b5d30da3b4ba ro 
      echo   'Loading initial ramdisk ...'
      initrd   /boot/initrd.img-4.9.0-4-amd64
   }
   menuentry 'Debian GNU/Linux, with Linux 4.9.0-4-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-4-amd64-recovery-e529714f-3ffd-4382-bc74-b5d30da3b4ba' {
      load_video
      insmod gzio
      if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
      insmod part_msdos
      insmod ext2
      set root='hd0,msdos1'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e529714f-3ffd-4382-bc74-b5d30da3b4ba
      else
        search --no-floppy --fs-uuid --set=root e529714f-3ffd-4382-bc74-b5d30da3b4ba
      fi
      echo   'Loading Linux 4.9.0-4-amd64 ...'
      linux   /boot/vmlinuz-4.9.0-4-amd64 root=UUID=e529714f-3ffd-4382-bc74-b5d30da3b4ba ro single
      echo   'Loading initial ramdisk ...'
      initrd   /boot/initrd.img-4.9.0-4-amd64
   }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Artix (rolling) (on /dev/sda6)' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-296135de-0697-4849-98b5-927395f155ff' {
   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  296135de-0697-4849-98b5-927395f155ff
   else
     search --no-floppy --fs-uuid --set=root 296135de-0697-4849-98b5-927395f155ff
   fi
   linux /boot/vmlinuz-linux root=UUID=ad4103fa-d940-47ca-8506-301d8071d467 rw quiet
   initrd /boot/initramfs-linux.img
}
submenu 'Advanced options for Artix (rolling) (on /dev/sda6)' $menuentry_id_option 'osprober-gnulinux-advanced-296135de-0697-4849-98b5-927395f155ff' {
   menuentry 'Artix, with Linux core repo kernel (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--296135de-0697-4849-98b5-927395f155ff' {
      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  296135de-0697-4849-98b5-927395f155ff
      else
        search --no-floppy --fs-uuid --set=root 296135de-0697-4849-98b5-927395f155ff
      fi
      linux /boot/vmlinuz-linux root=UUID=ad4103fa-d940-47ca-8506-301d8071d467 rw quiet
      initrd /boot/initramfs-linux.img
   }
   menuentry 'Artix, with Linux core repo kernel (Fallback initramfs) (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--296135de-0697-4849-98b5-927395f155ff' {
      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  296135de-0697-4849-98b5-927395f155ff
      else
        search --no-floppy --fs-uuid --set=root 296135de-0697-4849-98b5-927395f155ff
      fi
      linux /boot/vmlinuz-linux root=UUID=ad4103fa-d940-47ca-8506-301d8071d467 rw quiet
      initrd /boot/initramfs-linux-fallback.img
   }
}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

It seems that 40_custom is skipped for some reason.

Any additional suggestion?
Thanks.
francois.e
 
Posts: 14
Joined: 2009-03-06 22:03

Re: grub2: problem with loading 40_custom

Postby p.H » 2018-01-21 13:44

Is the file executable ?
p.H
 
Posts: 220
Joined: 2017-09-17 07:12

SOLVED: grub2: problem with loading 40_custom

Postby francois.e » 2018-01-22 01:39

@p.H.:
Right on target. First time there is a need for my 40_custom to be executable. This maybe because I come from an alien distribution called slackware.
Thanks for the tip.
francois.e
 
Posts: 14
Joined: 2009-03-06 22:03

Re: grub2: problem with loading 40_custom

Postby p.H » 2018-01-22 11:29

Weird. Files in /etc/grub.d/ are shell scripts, so they have to be executable.
p.H
 
Posts: 220
Joined: 2017-09-17 07:12

Re: grub2: problem with loading 40_custom

Postby debiman » 2018-01-23 07:39

p.H wrote:Weird. Files in /etc/grub.d/ are shell scripts, so they have to be executable.

not necessarily.
they could be run with 'sh script.sh'.
however, i don't see how slackware's grub version could be different in that respect. but who knows.
User avatar
debiman
 
Posts: 1875
Joined: 2013-03-12 07:18

Re: grub2: problem with loading 40_custom

Postby p.H » 2018-01-23 12:48

debiman wrote:they could be run with 'sh script.sh'.

I don't think grub-mkconfig runs them this way, because they start with a "shebang" #! indicating the interpreter which must be used to run them, which could be different from the default sh shell, such as bash, perl or whatever.
I guess the files in /etc/grub.d could even be binary executables instead of scripts.
p.H
 
Posts: 220
Joined: 2017-09-17 07:12

Re: grub2: problem with loading 40_custom

Postby francois.e » 2018-01-28 00:39

Maybe I should have made the precision that it is a slackware [s]debian[/s] derivative called porteus for which I use a frugal install on hdd. It might not do much difference.

Thanks to all.
Last edited by francois.e on 2018-02-08 01:46, edited 1 time in total.
francois.e
 
Posts: 14
Joined: 2009-03-06 22:03

Re: grub2: problem with loading 40_custom

Postby Thorny » 2018-01-28 07:57

francois.e wrote:Maybe I should have made the precision that it is a debian derivative called porteus for which I use a frugal install on hdd.

Of course you should have mentioned that. Porteus is not Debian and we don't know what changes the Porteus developers might have made unless someone else here is also familiar with it. You really should have asked your question on a Porteus forum.
http://forum.porteus.org/

However, I agree with you that they likely would have not changed GRUB.
User avatar
Thorny
 
Posts: 522
Joined: 2011-02-27 13:40

Re: SOLVED: grub2: problem with loading 40_custom

Postby francois.e » 2018-02-08 01:51

@thorny:
Maybe its old age or some kind of dementia. I should have written slackware derivative. This is corrected in the precedent post.

And no, I should not have asked at the porteus forum but here at the debian forum as the grub installation is performed by the debian install disk, and I am using the debian installation.

Once again thanks all and especially those who have adopted a problem solving attitude. :wink:
francois.e
 
Posts: 14
Joined: 2009-03-06 22:03


Return to System configuration

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable