Adding submenu 'appears' to make save fail because of syntax error

Asked by RonCam

I'm entering this so future searches for this problem may come up with an explanation for how to work around it.

I was repeatedly trying to put my Mint recovery and two memory tests into a submenu. Making repeated edits, then trying to eliminate what was causing this, I found simply inserting the submenu line was causing the failure, in a previously good menu list.

This may already be in the Answers, but maybe not clearly enough that I could understand.

The trick is -- collapse the menu just before the save. Then it went to completion. I'm hoping all is OK on my next boot?? If the menu fails, I'll come back and edit this. But, the save appeared to complete flawlessly.

At least I can do a save without the error message saying the save failed due to a syntax error.

Great utility, and I hope this may be helpful to others who come accross this 'glitch'.

Question information

Language:
English Edit question
Status:
Answered
For:
Grub Customizer Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Daniel Richter (danielrichter2007) said :
#1

This sounds very strange to me. I'm pretty sure it's not relevant whether the submenu is collapsed on the configuration window…

Revision history for this message
RonCam (rac2) said :
#2

Probably peculiar to my set-up -- which is:
Linux Mint Rosa/17.3/KDE.

It's reproducible here, but maybe not on other desktop environments/distros?

I came across this when my reconfigured menu's 'save' started aborting with a syntax error, and giving a specific line number. I searched on the message, and found someone with a nearly-identical error plus the refusal to save. The poster said he got grub to save just by undoing the changes. I did that, and it worked. Then I started adding the changes back, one by one, and found the problems began after I inserted the divider.

This may be helpful. I don't recall seeing this 'sensitivity' of Grub Customizer before I upgraded from Mint 17.0 to 17.3. Before the upgrade, I would just edit, put everything as I wanted, save, and it always went to completion, without any errors.

Revision history for this message
RonCam (rac2) said :
#3

Hmmm ... now it's not reproducible.

I did a save with the section, below the divider left 'open', hoping to get the error message again, to paste it here.

However, this time the save was error-free.

No explanation, except I'm constantly installing software updates from the Mint repo, and I wonder if anything came through that affects grub?

In any event, if anyone else encounters this, there's an easy work-around. If it returns, I'll post again. Thanks again for a great utility, and keeping it so nicely updated!

Revision history for this message
RonCam (rac2) said :
#4

It's happening again, and this time I couldn't 'fix' it by collapsing the submenu below the divider. Here's the error message:
-----------------------------------------
<code>
Please take a look at the command line output below. If you think this is a bug of Grub Customizer, please create one at https://launchpad.net/grub-customizer! Generally Grub Customizer should prevent errors like this.

failed running 'grub-mkconfig -o "/boot/grub/grub.cfg"' output:
Generating grub configuration file ...
File descriptor 10 (/proc/8466/mounts) leaked on lvs invocation. Parent PID 14350: /bin/sh
  No volume groups found
Found Windows 7 (loader) on /dev/sdb1
Found Windows 7 (loader) on /dev/sdb2
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
error: syntax error.
error: Incorrect command.
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 216
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.
done
</code>

Revision history for this message
Daniel Richter (danielrichter2007) said :
#5

I need your /boot/grub/grub.cfg.new

Revision history for this message
RonCam (rac2) said :
#6

#
# 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="${saved_entry}"
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
}

insmod part_msdos
insmod ext2
set root='hd1,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos3 --hint-efi=hd1,msdos3 --hint-baremetal=ahci1,msdos3 f47158fc-9387-461f-a5c0-48c86e436a44
else
  search --no-floppy --fs-uuid --set=root f47158fc-9387-461f-a5c0-48c86e436a44
fi
if loadfont /grub/unicode.pf2 ; 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=10
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=10
  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 0,0,0; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_mint_theme ###
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
### END /etc/grub.d/06_mint_theme ###

### 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 "Linux Mint 17.3 KDE 32-bit, 3.13.0-24-generic (/dev/sda3)" --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 savedefault
 # gfxmode $linux_gfx_mode
 insmod gzio
 insmod part_msdos
 insmod ext2
 set root='hd0,msdos3'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 f47158fc-9387-461f-a5c0-48c86e436a44
 else
   search --no-floppy --fs-uuid --set=root f47158fc-9387-461f-a5c0-48c86e436a44
 fi
 linux /vmlinuz-3.13.0-24-generic root=UUID=28deacb3-4205-4e72-9ff6-774d12a5b9e9 ro quiet splash $vt_handoff
 initrd /initrd.img-3.13.0-24-generic
}
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_os-prober_proxy ###
menuentry "Windows 7 Professional" --class windows --class os $menuentry_id_option 'osprober-chain-3491141700F8E204' {
 savedefault
 insmod part_msdos
 insmod ntfs
 set root='hd1,msdos2'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2 3491141700F8E204
 else
   search --no-floppy --fs-uuid --set=root 3491141700F8E204
 fi
 parttool ${root} hidden-
 chainloader +1
}
set timeout_style=menu
if [ "${timeout}" = 0 ]; then
  set timeout=10
fi
menuentry "Windows 2000 Professional" --class windows --class os $menuentry_id_option 'osprober-chain-9FBC4CE0B0A0F34A' {
 savedefault
 insmod part_msdos
 insmod ntfs
 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 9FBC4CE0B0A0F34A
 else
   search --no-floppy --fs-uuid --set=root 9FBC4CE0B0A0F34A
 fi
 parttool ${root} hidden-
 chainloader +1
}
### END /etc/grub.d/41_os-prober_proxy ###

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

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

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

### BEGIN /etc/grub.d/44_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/44_custom ###

### BEGIN /etc/grub.d/48_memtest86+_proxy ###
submenu "Memory Tests -- Recovery Mode"{
menuentry "Memory test (memtest86+)" {
 insmod part_msdos
 insmod ext2
 set root='hd1,msdos3'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos3 --hint-efi=hd1,msdos3 --hint-baremetal=ahci1,msdos3 f47158fc-9387-461f-a5c0-48c86e436a44
 else
   search --no-floppy --fs-uuid --set=root f47158fc-9387-461f-a5c0-48c86e436a44
 fi
 knetbsd /memtest86+.elf
}
menuentry "Memory test (memtest86+, serial console 115200)" {
 insmod part_msdos
 insmod ext2
 set root='hd1,msdos3'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos3 --hint-efi=hd1,msdos3 --hint-baremetal=ahci1,msdos3 f47158fc-9387-461f-a5c0-48c86e436a44
 else
   search --no-floppy --fs-uuid --set=root f47158fc-9387-461f-a5c0-48c86e436a44
 fi
 linux16 /memtest86+.bin console=ttyS0,115200n8
}
menuentry "Recovery Mode -- Linux Mint 17.3 KDE" --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod gzio
 insmod part_msdos
 insmod ext2
 set root='hd1,msdos3'
 if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos3 --hint-efi=hd1,msdos3 --hint-baremetal=ahci1,msdos3 f47158fc-9387-461f-a5c0-48c86e436a44
 else
   search --no-floppy --fs-uuid --set=root f47158fc-9387-461f-a5c0-48c86e436a44
 fi
 echo 'Loading Linux 3.13.0-24-generic ...'
 linux /vmlinuz-3.13.0-24-generic root=UUID=28deacb3-4205-4e72-9ff6-774d12a5b9e9 ro recovery nomodeset
 echo 'Loading initial ramdisk ...'
 initrd /initrd.img-3.13.0-24-generic
}
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
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
}
### END /etc/grub.d/48_memtest86+_proxy ###

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Daniel Richter (danielrichter2007) said :
#8

reopened

Revision history for this message
Daniel Richter (danielrichter2007) said :
#9

Sorry for late answer.

It's the same problem like here (with solution): https://bugs.launchpad.net/grub-customizer/+bug/1561813/

Can you help with this problem?

Provide an answer of your own, or ask RonCam for more information if necessary.

To post a message you must log in.