Installation. After years of user requests, Grub Customizer was added to the Ubuntu repo as of 19.10. Included with 20.04, so presumably will be available for Mint 20. Meanwhile, can install from PPA: ppa:danielrichter2007/grub-customizer. Easy-peasy.
Backup files. Mentioning second, but before installing GC, I took the precaution of backing up etc/default/grub and the /etc/grub.d sub-directory. The former is the main user configuration file, the latter has the scripts update-grub uses to assemble grub.cfg, which is the file used at boot to create the menu. I put the backup in /root (the home folder of user root), but it could have gone anywhere, including a USB drive. Main thing I wanted was a backup stored someplace other than the /etc/grub.d folder. Cheap insurance, I recommend doing it.
Customize Grub. The test box I used has four OSs: Win10, Mate 19.1, Ubuntu 20.04 and MX Linux 19.. To give the app something to do, move Windows to top of list, correct Mate's name (called Ubuntu by scripts), default boot = last-system-used, disable auto-boot, and set a picture. Click Save. Reboot, yup, there's my menu, no countdown. Kinda hard to read, though (because of the picture); edit to use magenta for selection, with white background (masks the picture), then dark grey for the rest of the list; save and reboot. Nice menu. Most of this can be done manually, but a lot easier with GC (and changing boot order is pretty difficult otherwise).* No wonder GC is popular.
* Can be done with a custom.cfg or 40_custom file (see tutorial), but not something most newbies are going to want to tackle.
What happens at file level. Now let's look under the hood. What is GC doing? Need to know, so if uninstall, we can restore the original system (or be confident it has been restored). This is what /etc/grub/d looks like by default, i.e., before installing GC:
Code: Select all
00_header 05_debian_theme 10_linux 20_linux_xen 20_memtest86+ 30_os-prober 30_uefi-firmware 40_custom 41_custom README
Code: Select all
00_header 10_linux_proxy 31_linux_proxy 33_memtest86+_proxy 35_memtest86+_proxy 37_uefi-firmware 41_custom bin README
05_debian_theme 30_os-prober_proxy 32_linux_xen 34_os-prober_proxy 36_os-prober_proxy 40_custom backup proxifiedScripts
Code: Select all
/etc/grub.d/bin:
grubcfg_proxy
/etc/grub.d/proxifiedScripts:
linux memtest86+ os-prober
/etc/grub.d/backup:
boot_grub default_grub etc_grub_d RESTORE_INSTRUCTIONS
/etc/grub.d/backup/boot_grub:
fonts gfxblacklist.txt grub.cfg grubenv i386-pc locale unicode.pf2
/etc/grub.d/backup/boot_grub/fonts:
unicode.pf2
/etc/grub.d/backup/boot_grub/i386-pc:
[omitted, same *.mod files, etc. as usual]
/etc/grub.d/backup/boot_grub/locale:
en_AU.mo en_CA.mo en_GB.mo en@quot.mo
/etc/grub.d/backup/etc_grub_d:
00_header 05_debian_theme 10_linux 20_linux_xen 20_memtest86+ 30_os-prober 30_uefi-firmware 40_custom 41_custom README
Unwind and Uninstall. Suppose I want to uninstall GC. The website is vague on how to handle this and while there is a file in the backup folder called Restore Instructions, it's only six lines long. Common sense says to me, the first step is to revert the Grub menu. That's an option on the Edit menu; also a prominent button on the main dialogue box. As with all changes in GC, only takes effect when saved. Checking /etc/grub.d, I see the proxy scripts have disappeared and the original scripts restored. Makes me feel better. Go ahead and uninstall, apt purge grub-customizer. Reboot.
First thing I notice is that my picture is still on the menu. Turns out this didn't get reverted. Indeed, the original etc/default/grub file wasn't restored. Copy available in the backup folder, so no good reason, just an oversight. Copy the backup to /etc/default and run sudo update-grub. Reboot. Back to pre-GC. Still stuff left behind, especially the backup folder in /etc/grub.d. Delete that manually. Only other holdover file I see is /boot/grub/grubenv, which sets the environment block. Harmless, I leave it alone. All things considered, not as clean an unwind as one would like, but not bad.
Manual Unwind. An important limitation on my test is that I only ran GC once, then more-or-less immediately uninstalled. It's a test box. Where folks report trouble is when using for an extended period of time, through numerous kernel updates and so on. Suppose GC has stopped working. What does one need to do to get back to pre-GC? The backup folder has a file called Restore Instructions. All it says, though, is to restore /etc/default/grub and the original scripts in /etc/grub.d. Both necessary steps, of course, but there's more to it than that. Moreover, instructions say to use gksu, which was deprecated in Ubuntu 18.04, more than two years ago. No mention of deleting the proxy scripts. No mention of update-grub. Worst of all, overlooks that the backup copies of the grub scripts have had their executable flag removed, so they no longer work when restored. Feeble.
I doubt many users in the app's target audience would have any idea how to fix this. These commands, run in Terminal, worked for me:
Code: Select all
apt purge grub-customizer
sudo cp /etc/default/grub /etc/default/grub-customizer
sudo cp /boot/grub/grub.cfg /boot/grub-customizer.cfg
sudo cp /etc/grub.d/backup/default_grub /etc/default/grub
sudo mkdir /etc/temp
sudo cp /etc/grub.d/backup/etc_grub_d/* /etc/temp
sudo rm -r /etc/grub.d/*
sudo cp /etc/temp/* /etc/grub.d/
sudo chmod +x /etc/grub.d/*
sudo rm -r /etc/temp
sudo update-grub
Purge and reinstall Grub. Suppose it's worse than that. Not only has GC stopped working, so has update-grub. Probably doesn't happen often, but know of at least two cases reported on the Forum. Now we have to pull out an advanced tool: purge and reinstall of Grub. See Ubuntu Help. Relatively easy to do, provided you're still able to boot. Exact steps depend on whether using BIOS or UEFI. If not sure, run ls /sys/firmware (those are "Ls"); will report three words or four; if one of them is efi, you're in UEFI, if not you're in BIOS or legacy mode.
BIOS instructions. Run apt purge grub-common; will be prompted to confirm removal of boot loader. Then run apt install grub-pc os-prober. Select destination for boot loader when prompted (tap space key to select). Unless you have a very good reason, install to the device, not the root partition.
os-prober us removed by purge but only a recommended package on reinstall, so specifying additionally. Same with shim-signed for UEFI.
UEFI instructions. Similar, but the packages to install are a little different. Run apt purge grub-common, then apt install grub-efi-amd64-signed os-prober shim-signed. Select destination for boot loader if prompted (but probably won't be).
If all else fails, chroot. This is rare. Indeed, I've only heard of one case. OTOH, not all problems get reported on the Forum and I don't notice all that are. Suppose you can't even boot. Ooh, maybe have to reinstall. Probably not. Again, have to know whether using BIOS or UEFI. If you have a boot partition (why?), that also has to be mounted (sudo mount /dev/sdxn /mnt/boot); add as a second step for BIOS, a third step for UEFI. If not familiar with chroot, just cross your fingers and follow the steps (use copy-and-paste). It's this or reinstall, so might as well give it a shot. Start by booting a live session of the same version of Mint as is installed on the system; set up an internet connection, open Firefox, and open this thread for reference.
BIOS. For illustration, assume system partition is sda1. Modify if yours is different. As with regular purge-and-reinstall, you'll be prompted at some point to confirm the boot loader should be removed, and also where to install the new one.
Code: Select all
sudo mount /dev/sda1 /mnt
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo cp /etc/resolv.conf /mnt/etc
sudo chroot /mnt
apt purge grub-common
apt install grub-pc os-prober
exit
sudo umount -R /mnt
Code: Select all
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo cp /etc/resolv.conf /mnt/etc
modprobe efivars
sudo chroot /mnt
apt purge grub-common
apt install grub-efi-amd64-signed os-prober shim-signed
exit
sudo umount /mnt/boot/efi
sudo umount -R /mnt