For those who sometimes suffer from a broken Grub menu...
Grub Customizer is a powerful tool to adjust and modify the GRUB menu.
Due to it's complex nature of how GRUB generates the GRUB menu it
happens sometimes after using Grub Customizer the generation of grub menu
through update-grub fails. The grub menu script itself are generated through
meta-scripts. There seem to be no easy way to fix or to find out the
reason for those failure.
Grub Customizer itself comes with a "Revert" option. The first stepp to
recover from a failed grub-menu generation might be to revert to the
original state using the build in Revert-option with Grub Customizer.
In the case when the provided "Revert"-option still can not solve the
create failure situation the following script may help to restore to
the GRUB defaults.
script file : restore-grub.sh
Code: Select all
#!/bin/bash
# fehlix - 2019-10-23
#
# restore GRUB defaults from Grub Customizer backup
echo "${0##*/} : restoring GRUB defaults from Grub Customizer backup"
[ ! -d /etc/grub.d/backup ] && echo "Grub Customizer Backup not found! - exit " && exit 1
# sanity checks
[ -z "${BASH_VERSION-}" ] && exec /bin/bash $0
[ "$(id -u)" != 0 ] && sudo -k && exec sudo /bin/bash $0
# backup GC
BACKUP=GC_$(date +%Y-%m-%d_%H.%M.%S).bak
cp -a /boot/grub /boot/grub.${BACKUP}
cp /etc/default/grub /etc/default/grub.${BACKUP}
mv /etc/grub.d /etc/grub.d.${BACKUP}
mkdir /etc/grub.d
# restore GRUB
set -x
cp -a /etc/grub.d.${BACKUP}/backup/boot_grub/* /boot/grub
cp /etc/grub.d.${BACKUP}/backup/default_grub /etc/default/grub
cp /etc/grub.d.${BACKUP}/backup/etc_grub_d/* /etc/grub.d
chmod +x /etc/grub.d/??_*
echo "Done."
