upgrade-grub causing errors in Grub Config File

Asked by Matt Melton

Just ran:
apt upgrade
grub was upgraded and it caused syntax errors when it ran update-grub:
############# Errors

Found linux image: /boot/vmlinuz-4.10.0-33-generic
Found initrd image: /boot/initrd.img-4.10.0-33-generic
Found linux image: /boot/vmlinuz-4.10.0-32-generic
Found initrd image: /boot/initrd.img-4.10.0-32-generic
Found linux image: /boot/vmlinuz-4.10.0-30-generic
Found initrd image: /boot/initrd.img-4.10.0-30-generic
Found linux image: /boot/vmlinuz-4.10.0-28-generic
Found initrd image: /boot/initrd.img-4.10.0-28-generic
Found linux image: /boot/vmlinuz-4.10.0-26-generic
Found initrd image: /boot/initrd.img-4.10.0-26-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Found Windows 10 on /dev/sda1
Found Slackware 14.2 on /dev/sdc1
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 513
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
##################### End of errors

my /etc/default/grub file looks like this:
###################### /etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOOUT_STYLE=countdown
GRUB_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset nosplash"
#GRUB_CMDLINE_LINUX=""

#fix broken grub.cfg gen
#GRUB_DISABLE_SUBMENU=true #or y does not help

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=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=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

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

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

################# end of /etc/default/grub
not sure what to change next
the slackware install is the only thing that is different

line 513 is a close curly brace in the file /boot/grub/grub.cfg.new:
##########
#
# 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 recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; 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='hd1,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
else
  search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
fi
    font="/grub/unicode.pf2"
fi

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

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30,0; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
 set gfxpayload="${1}"
 if [ "${1}" = "keep" ]; then
  set vt_handoff=vt.handoff=7
 else
  set vt_handoff=
 fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-44a4297e-fcc3-45d5-bb17-b55874680197' {
 recordfail
 load_video
 gfxmode $linux_gfx_mode
 insmod gzio
 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
 insmod part_msdos
 insmod ext2
 set root='hd1,msdos1'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
 else
   search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
 fi
        linux /vmlinuz-4.10.0-33-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash
 initrd /initrd.img-4.10.0-33-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-44a4297e-fcc3-45d5-bb17-b55874680197' {
 menuentry 'Ubuntu, with Linux 4.10.0-33-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-33-generic-advanced-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-33-generic ...'
         linux /vmlinuz-4.10.0-33-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-33-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-33-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-33-generic-init-upstart-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-33-generic ...'
         linux /vmlinuz-4.10.0-33-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-33-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-33-generic-recovery-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-33-generic ...'
         linux /vmlinuz-4.10.0-33-generic root=/dev/mapper/ubuntu--vg-root ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-33-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-32-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-32-generic-advanced-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-32-generic ...'
         linux /vmlinuz-4.10.0-32-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-32-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-32-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-32-generic-init-upstart-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-32-generic ...'
         linux /vmlinuz-4.10.0-32-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-32-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-32-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-32-generic-recovery-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-32-generic ...'
         linux /vmlinuz-4.10.0-32-generic root=/dev/mapper/ubuntu--vg-root ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-32-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-30-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-30-generic-advanced-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-30-generic ...'
         linux /vmlinuz-4.10.0-30-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-30-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-30-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-30-generic-init-upstart-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-30-generic ...'
         linux /vmlinuz-4.10.0-30-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-30-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-30-generic-recovery-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-30-generic ...'
         linux /vmlinuz-4.10.0-30-generic root=/dev/mapper/ubuntu--vg-root ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-30-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-28-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-28-generic-advanced-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-28-generic ...'
         linux /vmlinuz-4.10.0-28-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-28-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-28-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-28-generic-init-upstart-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-28-generic ...'
         linux /vmlinuz-4.10.0-28-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-28-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-28-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-28-generic-recovery-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-28-generic ...'
         linux /vmlinuz-4.10.0-28-generic root=/dev/mapper/ubuntu--vg-root ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-28-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-26-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-26-generic-advanced-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-26-generic ...'
         linux /vmlinuz-4.10.0-26-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-26-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-26-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-26-generic-init-upstart-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  gfxmode $linux_gfx_mode
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-26-generic ...'
         linux /vmlinuz-4.10.0-26-generic root=/dev/mapper/ubuntu--vg-root ro nomodeset nosplash init=/sbin/upstart
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-26-generic
 }
 menuentry 'Ubuntu, with Linux 4.10.0-26-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.10.0-26-generic-recovery-44a4297e-fcc3-45d5-bb17-b55874680197' {
  recordfail
  load_video
  insmod gzio
  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
  insmod part_msdos
  insmod ext2
  set root='hd1,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  else
    search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
  fi
  echo 'Loading Linux 4.10.0-26-generic ...'
         linux /vmlinuz-4.10.0-26-generic root=/dev/mapper/ubuntu--vg-root ro recovery nomodeset
  echo 'Loading initial ramdisk ...'
  initrd /initrd.img-4.10.0-26-generic
 }
}

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

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

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

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry 'Memory test (memtest86+)' {
 insmod part_msdos
 insmod ext2
 set root='hd1,msdos1'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
 else
   search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
 fi
 knetbsd /memtest86+.elf
}
menuentry 'Memory test (memtest86+, serial console 115200)' {
 insmod part_msdos
 insmod ext2
 set root='hd1,msdos1'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1 22e14210-7621-4d3e-a77b-d7d71d7d1c19
 else
   search --no-floppy --fs-uuid --set=root 22e14210-7621-4d3e-a77b-d7d71d7d1c19
 fi
 linux16 /memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 10 (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-16A8EC59A8EC393F' {
 insmod part_msdos
 insmod ntfs
 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 16A8EC59A8EC393F
 else
   search --no-floppy --fs-uuid --set=root 16A8EC59A8EC393F
 fi
 parttool ${root} hidden-
 drivemap -s (hd0) ${root}
 chainloader +1
}
menuentry 'Slackware 14.2 (on /dev/sdc1)' --class slackware --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-ac93c5e5-9901-4d22-a600-da6e0de5f30e' {
 insmod part_msdos
 insmod ext2
 set root='hd2,msdos1'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1 ac93c5e5-9901-4d22-a600-da6e0de5f30e
 else
   search --no-floppy --fs-uuid --set=root ac93c5e5-9901-4d22-a600-da6e0de5f30e
 fi
 linux /boot/vmlinuz ro vt.default_utf8=0 vga = normal root=PARTUUID=345215fe-01"
}
submenu 'Advanced options for Slackware 14.2 (on /dev/sdc1)' $menuentry_id_option 'osprober-gnulinux-advanced-ac93c5e5-9901-4d22-a600-da6e0de5f30e' {
 menuentry 'Linux (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz--ac93c5e5-9901-4d22-a600-da6e0de5f30e' {
  insmod part_msdos
  insmod ext2
  set root='hd2,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1 ac93c5e5-9901-4d22-a600-da6e0de5f30e
  else
    search --no-floppy --fs-uuid --set=root ac93c5e5-9901-4d22-a600-da6e0de5f30e
  fi
  linux /boot/vmlinuz ro vt.default_utf8=0 vga = normal root=PARTUUID=345215fe-01"
 }
 menuentry 'Linux-no-uuid (on /dev/sdc1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz--ac93c5e5-9901-4d22-a600-da6e0de5f30e' {
  insmod part_msdos
  insmod ext2
  set root='hd2,msdos1'
  if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1 ac93c5e5-9901-4d22-a600-da6e0de5f30e
  else
    search --no-floppy --fs-uuid --set=root ac93c5e5-9901-4d22-a600-da6e0de5f30e
  fi
  linux /boot/vmlinuz root=/dev/sda1 ro vt.default_utf8=0 vga = normal
 }
}

set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
### 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/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.
### END /etc/grub.d/40_custom ###

### 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 ###

############end of grub.cfg.new

Any help what to look at next to get the new config installed would be great.

Thanks all the best

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Matt Melton
Solved:
Last query:
Last reply:
Revision history for this message
Matt Melton (hairy-marmite) said :
#1

$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

What is the output of

can -n /etc/grub.d/41_custom

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

Oops, typo error

cat -n /etc/grub.d/41_custom

Revision history for this message
Matt Melton (hairy-marmite) said :
#4

Hi there

cat -n /etc/grub.d/41_custom

gives:

     1 #!/bin/sh
     2 cat <<EOF
     3 if [ -f \${config_directory}/custom.cfg ]; then
     4 source \${config_directory}/custom.cfg
     5 elif [ -z "\${config_directory}" -a -f \$prefix/custom.cfg ]; then
     6 source \$prefix/custom.cfg;
     7 fi
     8 EOF
     9

thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

This look correct. I assume that the error is caused earlier, but is detected only when processing /etc/grub.d/41_custom.

Maybe the problem is caused by the quote at the end of the line for slackware:
 linux /boot/vmlinuz ro vt.default_utf8=0 vga = normal root=PARTUUID=345215fe-01"

What output do you get for the commands
blkid
sudo linux-boot-prober /dev/sdc1

Revision history for this message
Matt Melton (hairy-marmite) said :
#6

Hi there

blkid

/dev/mapper/sda5_crypt: UUID="VEcZmg-YPnP-PRcF-yPQP-gTeC-qRVP-rqKYPF" TYPE="LVM2_member"
/dev/mapper/ubuntu--vg-root: UUID="44a4297e-fcc3-45d5-bb17-b55874680197" TYPE="ext4"
/dev/mapper/cryptswap1: UUID="febdc4d4-e349-4df9-9dc8-9553c5afc8f7" TYPE="swap"
/dev/sda1: LABEL="System Reserved" UUID="16A8EC59A8EC393F" TYPE="ntfs" PARTUUID="00066186-01"
/dev/sda2: UUID="B864EE7964EE39B0" TYPE="ntfs" PARTUUID="00066186-02"
/dev/sdb1: UUID="22e14210-7621-4d3e-a77b-d7d71d7d1c19" TYPE="ext4" PARTUUID="67e5cf13-01"
/dev/sdb5: UUID="652e62e6-2e26-44e7-8f0d-060fb6e944e4" TYPE="crypto_LUKS" PARTUUID="67e5cf13-05"
/dev/sdc1: UUID="ac93c5e5-9901-4d22-a600-da6e0de5f30e" TYPE="ext4" PARTUUID="345215fe-01"
/dev/sdc2: UUID="7040ae94-828a-46e7-93a3-9beea9532959" TYPE="swap" PARTUUID="345215fe-02"
/dev/mapper/ubuntu--vg-swap_1: UUID="24e06fc5-66a1-4963-b24e-1ce33b04578e" TYPE="swap"

sudo linux-boot-prober /dev/sdc1

/dev/sdc1:/dev/sdc1:Linux:/boot/vmlinuz::ro vt.default_utf8=0 vga = normal root=PARTUUID=345215fe-01"
/dev/sdc1:/dev/sdc1:Linux-no-uuid:/boot/vmlinuz::root=/dev/sda1 ro vt.default_utf8=0 vga = normal

That looks like a suspect " from a laymans point of view.
The slackware boot lilo config is the partuuid is needed since uuid doesn't work wityhout an initrd (in out of the boix slackware at least)

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
# Append any additional kernel parameters:
append=" vt.default_utf8=0"
#boot = /dev/sda
boot = /dev/disk/by-id/ata-ST3500630AS_6QG37PMM

#compact # faster, but won't work on all systems.

# Boot BMP Image.
# Bitmap in BMP format: 640x480x8
  bitmap = /boot/slack.bmp
# Menu colors (foreground, background, shadow, highlighted
# foreground, highlighted background, highlighted shadow):
  bmp-colors = 255,0,255,0,255,0
# Location of the option table: location x, location y, number of
# columns, lines per column (max 15), "spill" (this is how many
# entries must be in the first column before the next begins to
# be used. We don't specify it here, as there's just one column.
  bmp-table = 60,6,1,16
# Timer location x, timer location y, foreground color,
# background color, shadow color.
  bmp-timer = 65,27,0,255

# Standard menu.
# Or, you can comment out the bitmap menu above and
# use a boot message with the standard menu:
#message = /boot/boot_message.txt

# Wait until the timeout to boot (if commented out, boot the
# first entry immediately):
prompt
# Timeout before the first entry boots.
# This is given in tenths of a second, so 600 for every minute:
timeout = 1200
# Override dangerous defaults that rewrite the partition table:
change-rules
  reset
# Normal VGA console
vga = normal
# Ask for video mode at boot (time out to normal in 30s)
#vga = ask
# VESA framebuffer console @ 1024x768x64k
#vga=791
# VESA framebuffer console @ 1024x768x32k
#vga=790
# VESA framebuffer console @ 1024x768x256
#vga=773
# VESA framebuffer console @ 800x600x64k
#vga=788
# VESA framebuffer console @ 800x600x32k
#vga=787
# VESA framebuffer console @ 800x600x256
#vga=771
# VESA framebuffer console @ 640x480x64k
#vga=785
# VESA framebuffer console @ 640x480x32k
#vga=784
# VESA framebuffer console @ 640x480x256
#vga=769
# End LILO global section
# Linux bootable partition config begins
image = /boot/vmlinuz
  append="root=PARTUUID=345215fe-01"
  label = Linux
  read-only
# Linux bootable partition config ends
image = /boot/vmlinuz
  root = /dev/sda1
  label = Linux-no-uuid
  read-only

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

"That looks like a suspect " from a laymans point of view."
This was my suspicion in comment #5 and now seems to be confirmed by your output.

For diagnostic purposes you could try running the script with xtrace enabled for debugging:

sudo sh -x /usr/bin/linux-boot-prober /dev/sdc1

(In case that the output is very long, you probably better upload the output to http://pastebin.ubuntu.com and just post the link that you get in this question document.)

Revision history for this message
Matt Melton (hairy-marmite) said :
#8

OK thanks for the help so far

I've managed to set

GRUB_OS_PROBER_SKIP_LIST="ac93c5e5-9901-4d22-a600-da6e0de5f30e@/dev/sdc1" in /etc/default/grub
which then skips the uuid and the drive during the probe
update-grub then works as expected without the slackware item in the menu.

I will investigate further following your suggestion.

Thanks for your help so far.

Revision history for this message
Matt Melton (hairy-marmite) said :
#9

sudo sh -x /usr/bin/linux-boot-prober /dev/sdc1

+ . /usr/share/os-prober/common.sh
+ cleanup_tmpdir=false
+ progname=
+ type mapdevfs
+ set -e
+ newns /dev/sdc1
+ [ ]
+ exec /usr/lib/os-prober/newns /usr/bin/linux-boot-prober /dev/sdc1
/dev/sdc1:/dev/sdc1:Linux:/boot/vmlinuz::ro vt.default_utf8=0 vga = normal root=PARTUUID=345215fe-01"
/dev/sdc1:/dev/sdc1:Linux-no-uuid:/boot/vmlinuz::root=/dev/sda1 ro vt.default_utf8=0 vga = normal

Thanks

Revision history for this message
Matt Melton (hairy-marmite) said :
#10
Revision history for this message
Manfred Hampl (m-hampl) said :
#11

Turning xtrace on for the script has not helped, because most of the work is done in a binary.
I am running out of ideas. You might consider creating a bug report.

Revision history for this message
Matt Melton (hairy-marmite) said :
#12

Hi thanks again. I think it is in the newns binary for sure.

I brute forced the debug function in /usr/share/os-prober/common.sh
to echo to the terminal:

sudo sh -x /usr/bin/linux-boot-prober /dev/sdc1
+ . /usr/share/os-prober/common.sh
+ cleanup_tmpdir=false
+ progname=
+ type mapdevfs
+ set -e
+ newns /dev/sdc1
+ [ ]
+ exec /usr/lib/os-prober/newns /usr/bin/linux-boot-prober /dev/sdc1
debug: running /usr/lib/linux-boot-probes/mounted/40grub on mounted /dev/sdc1
debug: running /usr/lib/linux-boot-probes/mounted/40grub2 on mounted /dev/sdc1
debug: running /usr/lib/linux-boot-probes/mounted/50lilo on mounted /dev/sdc1
debug: parsing lilo.conf
debug: parsing: # LILO configuration file
debug: parsing: # generated by 'liloconfig'
debug: parsing: #
debug: parsing: # Start LILO global section
debug: parsing: # Append any additional kernel parameters:
debug: parsing: append=" vt.default_utf8=0"
debug: parsing: #boot = /dev/sda
debug: parsing: boot = /dev/disk/by-id/ata-ST3500630AS_6QG37PMM
debug: parsing:
debug: parsing: #compact # faster, but won't work on all systems.
debug: parsing:
debug: parsing: # Boot BMP Image.
debug: parsing: # Bitmap in BMP format: 640x480x8
debug: parsing: bitmap = /boot/slack.bmp
debug: parsing: # Menu colors (foreground, background, shadow, highlighted
debug: parsing: # foreground, highlighted background, highlighted shadow):
debug: parsing: bmp-colors = 255,0,255,0,255,0
debug: parsing: # Location of the option table: location x, location y, number of
debug: parsing: # columns, lines per column (max 15), "spill" (this is how many
debug: parsing: # entries must be in the first column before the next begins to
debug: parsing: # be used. We don't specify it here, as there's just one column.
debug: parsing: bmp-table = 60,6,1,16
debug: parsing: # Timer location x, timer location y, foreground color,
debug: parsing: # background color, shadow color.
debug: parsing: bmp-timer = 65,27,0,255
debug: parsing:
debug: parsing: # Standard menu.
debug: parsing: # Or, you can comment out the bitmap menu above and
debug: parsing: # use a boot message with the standard menu:
debug: parsing: #message = /boot/boot_message.txt
debug: parsing:
debug: parsing: # Wait until the timeout to boot (if commented out, boot the
debug: parsing: # first entry immediately):
debug: parsing: prompt
debug: parsing: # Timeout before the first entry boots.
debug: parsing: # This is given in tenths of a second, so 600 for every minute:
debug: parsing: timeout = 1200
debug: parsing: # Override dangerous defaults that rewrite the partition table:
debug: parsing: change-rules
debug: parsing: reset
debug: parsing: # Normal VGA console
debug: parsing: vga = normal
debug: parsing: # Ask for video mode at boot (time out to normal in 30s)
debug: parsing: #vga = ask
debug: parsing: # VESA framebuffer console @ 1024x768x64k
debug: parsing: #vga=791
debug: parsing: # VESA framebuffer console @ 1024x768x32k
debug: parsing: #vga=790
debug: parsing: # VESA framebuffer console @ 1024x768x256
debug: parsing: #vga=773
debug: parsing: # VESA framebuffer console @ 800x600x64k
debug: parsing: #vga=788
debug: parsing: # VESA framebuffer console @ 800x600x32k
debug: parsing: #vga=787
debug: parsing: # VESA framebuffer console @ 800x600x256
debug: parsing: #vga=771
debug: parsing: # VESA framebuffer console @ 640x480x64k
debug: parsing: #vga=785
debug: parsing: # VESA framebuffer console @ 640x480x32k
debug: parsing: #vga=784
debug: parsing: # VESA framebuffer console @ 640x480x256
debug: parsing: #vga=769
debug: parsing: # End LILO global section
debug: parsing: # Linux bootable partition config begins
debug: parsing: image = /boot/vmlinuz
debug: parsing: append="root=PARTUUID=345215fe-01"
debug: parsing: label = Linux
debug: parsing: read-only
debug: parsing: # Linux bootable partition config ends
debug: parsing: image = /boot/vmlinuz
/dev/sdc1:/dev/sdc1:Linux:/boot/vmlinuz::ro vt.default_utf8=0 vga = normal root=PARTUUID=345215fe-01"
debug: parsing: root = /dev/sda1
debug: parsing: label = Linux-no-uuid
debug: parsing: read-only
debug: parsing:
debug: parsing:
debug: parsing:
/dev/sdc1:/dev/sdc1:Linux-no-uuid:/boot/vmlinuz::root=/dev/sda1 ro vt.default_utf8=0 vga = normal
debug: /usr/lib/linux-boot-probes/mounted/50lilo succeeded

So it definitely appears to be tripping up there

Revision history for this message
Matt Melton (hairy-marmite) said :
#13

I'm just looking at the

debug: running /usr/lib/linux-boot-probes/mounted/50lilo on mounted /dev/sdc1

and having a look in there.

I have my grub installed now so am reasonabbly happy now.
Will consider a bug report once I've taken a look in here....

This line:

append)
                                addparams "$(dequote "${line#append=}")"

seems to build the params.....using dequote

Revision history for this message
Matt Melton (hairy-marmite) said :
#14

Right think I have found the problem....

the append line has a space after the last quote so it was not being snipped by the dequote function.......

Thanks for all your help.
Not really a bug. But something lilo doesn't care about but grub does.
Perhaps the dequote function should trim spaces at the front and rear as well?

Another lesson learned.

Thanks again.

Matt