I had the same problem with Xubuntu 18.04 but I couldn't find anything wrong in /etc/default/grub/etc/default/grub or the grub.d/etc/grub.d files
Since I was able to access the system despite the error, I didn't have to chroot into it which will be necessary if you cannot boot into the system. What I did was purge and reinstall grub which did the trick.
The steps I used are as follows:
I confirmed that I had an internet connection with
sudo apt-get update # ***I purged grub-pc and grub-common with
sudo apt-get purge grub-pc grub-commonI read the warning about removing the bootloader, hit TAB to highlight "" and pressed ENTER.
I issued the command
apt-get install grub-common grub-pcand when prompted I hit TAB to highlight "" and pressed ENTERWhen presented with the device option, I used the UP/DN keys to select the correct drive (sdX) NOT a partition.
I made sure the installation drive [] /dev/sdX had an asterisk next to it ( in my case: [] /dev/sda ). If it doesn't, highlight it and press the SPACE bar to select it. Then I hit TAB to highlight "" and pressed ENTER
I tested that the installation was complete and working by issuing the command sudo update-grub and everything worked error free as expected.