I have been using Windows 8.1 and Kali Linux 3.14 for a while. But upgrading to Windows 10 resulted in installation of MBR instead of GRUB. As I usually do, I used the Boot-Repair Bootable USB to solve the issue. Boot-Repair has Successfully installed GRUB but it is not detecting Windows 10.

I tried the install GRUB manually:

root@Zuhayer:/# grub-install /dev/sda
Installation finished. No error reported.


root@Zuhayer:/# update-grub
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.14-kali1-amd64
Found initrd image: /boot/initrd.img-3.14-kali1-amd64
Found linux image: /boot/vmlinuz-3.12-kali1-amd64
Found initrd image: /boot/initrd.img-3.12-kali1-amd64
Found linux image: /boot/vmlinuz-3.7-trunk-amd64
Found initrd image: /boot/initrd.img-3.7-trunk-amd64
  No volume groups found
Found Windows 8 (loader) on /dev/sda1
Found Windows 8 (loader) on /dev/sda2
error: out of memory.
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 179
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.


Add the following to /etc/default/grub:

# fix broken grub.cfg gen


Change the contents of /etc/grub.d/41_custom to the following and then run update-grub:

cat <<EOF
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;


  • I have added the line at the end of /etc/default/grub, then updated the GRUB. Same Error. – Zuhayer Aug 15 '15 at 10:15

Here is what happened:

Following a article on how to fix my problem, I had added some code in the source file from which grub.cfg is generated at line no: 179.

When I removed that code the grub-update command worked correctly.

P.s. Thanks mchid for the responses

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.