You are not logged in.
Hi,
I recently completely reinstalled Arch. Everything works fine like before excepted for grub. When I launch the command grub-mkconfig -o /boot/grub/grub.cfg, I get this error:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
error: out of memory.
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 162
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.
After installation I edited the config to make it more comfortable so I first thought it was my config that was buggy.
But after a pacman -Rs grub and pacman -S grub to clear the config, the error still persists.
I tested each file in /etc/grub.d/ and no one is faulty neither /etc/default/grub.
Line 162 points to the last line of /boot/grub/grub.cfg.new which is the part included from /etc/grub.d/41_custom
I read on many topics that adding GRUB_DISABLE_SUBMENU=y at the end of /etc/default/grub resolves the issue but it does not works for me
All the grub configs are the default ones.
EDIT:
Here's /boot/grub/grub.cfg.new's content:
#
# 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 ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
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_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 bc5f1815-0da6-4d75-815a-f10f84e5f536
else
search --no-floppy --fs-uuid --set=root bc5f1815-0da6-4d75-815a-f10f84e5f536
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=fr_FR
insmod gettext
fi
terminal_input console
terminal_output gfxterm
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
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bc5f1815-0da6-4d75-815a-f10f84e5f536' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 bc5f1815-0da6-4d75-815a-f10f84e5f536
else
search --no-floppy --fs-uuid --set=root bc5f1815-0da6-4d75-815a-f10f84e5f536
fi
echo 'Chargement de Linux linux…'
linux /boot/vmlinuz-linux root=UUID=bc5f1815-0da6-4d75-815a-f10f84e5f536 rw quiet
echo 'Chargement du disque mémoire initial…'
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
submenu 'Options avancées pour Arch Linux' $menuentry_id_option 'gnulinux-advanced-bc5f1815-0da6-4d75-815a-f10f84e5f536' {
menuentry 'Arch Linux, avec Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-bc5f1815-0da6-4d75-815a-f10f84e5f536' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 bc5f1815-0da6-4d75-815a-f10f84e5f536
else
search --no-floppy --fs-uuid --set=root bc5f1815-0da6-4d75-815a-f10f84e5f536
fi
echo 'Chargement de Linux linux…'
linux /boot/vmlinuz-linux root=UUID=bc5f1815-0da6-4d75-815a-f10f84e5f536 rw quiet
echo 'Chargement du disque mémoire initial…'
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-bc5f1815-0da6-4d75-815a-f10f84e5f536' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt2' --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 bc5f1815-0da6-4d75-815a-f10f84e5f536
else
search --no-floppy --fs-uuid --set=root bc5f1815-0da6-4d75-815a-f10f84e5f536
fi
echo 'Chargement de Linux linux…'
linux /boot/vmlinuz-linux root=UUID=bc5f1815-0da6-4d75-815a-f10f84e5f536 rw quiet
echo 'Chargement du disque mémoire initial…'
initrd /boot/initramfs-linux-fallback.img
}
}
### 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 ###
### END /etc/grub.d/30_os-prober ###
### 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/40_custom.pacsave ###
# 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 "System shutdown" {
echo "System shutting down..."
halt
}
menuentry "System restart" {
echo "System rebooting..."
reboot
}
if [ ${grub_platform} == "efi" ]; then
menuentry "Firmware setup" {
fwsetup
}
fi### END /etc/grub.d/40_custom.pacsave ###
### 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 ###
Thank for helping !
Last edited by Paragoumba (2019-03-28 16:14:48)
Offline
report with /boot/grub/grub.cfg.new file attached.
I assume it would be really helpful to see that file …
Offline
Yes, that's true. I edited my post.
Offline
Add a trailing newline to /etc/grub.d/40_custom
Offline
Ok that's just that
I've seen it earlier but don't thought it might be that
Also when I reinstalled grub, pacman copied 40_custom to 40_custom.pacsave so it continued to make grub-mkconfig fail.
Thank you seth
Offline
"fi#foo" is not a valid token, so the branch isn't closed and the script shits itself.
Better editors (and emacs ;-) can handles that for you - some even do it by default.
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
I use nano (sometimes vim ) to edit files and I've seen earlier that it appends a newline automatically so it's weird that it didn't do it here
Offline