[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help! syntax error when using grub2-mkconfig -o /boot/grub2/grub.cfg in

From: Ford Han
Subject: Help! syntax error when using grub2-mkconfig -o /boot/grub2/grub.cfg in Fedora 17
Date: Wed, 18 Jul 2012 16:44:54 +0800

Hi, I come across syntax error when using grub2-mkconfig -o /boot/grub2/grub.cfg in Fedora 17, pls help!!!

The following is the whole process:

1. I installed Win7 first, and then Ubuntu 12.04 LTS, at this time grub can correctly find win7 and Ubuntu and both can boot.
Finally I installed Fedora 17. Now Grub can now detect Win7 and Fedora and both can boot too. But Ubuntu is not in the boot list. I want to show all of the three systems in the list.

2. I try to boot the Ubuntu with commands in GRUB2 boot prompts following the steps in section Encountering the dreaded GRUB 2 boot prompt at

I used the following commands according to my situation, and all commands succeed and Ubuntu boot normally. (hd0,7) is the root partition for Ubuntu and (hd0,6) is the /boot partition.

set root=(hd0,7)
linux   (hd0,6)/vmlinuz-3.2.0-26-generic-pae root=/dev/sda7 ro quiet splash $vt_handoff
initrd  (hd0,6)/initrd.img-3.2.0-26-generic-pae

3. I want to modify the grub.cfg to show all the three systems in the boot list.

1). I boot into Fedora17, I add one file named 15_Ubuntu in the directory /etc/grub.d. Below is its content. All the commands are same as what I used in grub2 boot prompt above.

#!/bin/sh -e
exec tail -n +3 $0
# 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.

echo "Adding Ubuntu to GRUB 2"
cat << EOF
menuentry "Ubuntu, with Linux 3.2.0-26-generic-pae" {
set root=(hd0,7)
linux   (hd0,6)/vmlinuz-3.2.0-26-generic-pae root=/dev/sda7 ro quiet splash $vt_handoff
initrd  (hd0,6)/initrd.img-3.2.0-26-generic-pae

2). Then I use the grub2-mkconfig command to re-create the grub.cfg file: grub2-mkconfig -o /boot/grub2/grub.cfg

The output says there are errors:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.4.4-5.fc17.i686
Found initrd image: /boot/initramfs-3.4.4-5.fc17.i686.img
Found linux image: /boot/vmlinuz-3.3.4-5.fc17.i686
Found initrd image: /boot/initramfs-3.3.4-5.fc17.i686.img
  No volume groups found
Found Windows 7 (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 175
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/grub2/ file attached.done

These commands have been verified in GRUB 2 boot prompts. I do not know which line is line 175 and where is the specific error.

3). If I remove the newly added file 15_Ubuntu from directory /etc/grub.d and grub2-mkconfig again, the output has no error messages.

FYI, the partition information is as follows (there are two swaps now, just ignore it. I will update later):

address@hidden grub.d]# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x9157ea21

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     3074047     1536000    7  HPFS/NTFS/exFAT
/dev/sda2         3074048   100397055    48661504    7  HPFS/NTFS/exFAT
/dev/sda3       100399102   596467711   248034305    f  W95 Ext'd (LBA)
Partition 3 does not start on physical sector boundary.
/dev/sda4       596467712   625139711    14336000    7  HPFS/NTFS/exFAT
/dev/sda5       100399104   414971903   157286400    7  HPFS/NTFS/exFAT
/dev/sda6       414973952   415948799      487424   83  Linux
/dev/sda7       415950848   425713663     4881408   83  Linux
/dev/sda8       425715712   433526783     3905536   82  Linux swap / Solaris
/dev/sda9       433528832   496889855    31680512   83  Linux
/dev/sda10      496891904   497915903      512000   83  Linux
/dev/sda11      497917952   578033663    40057856   83  Linux
/dev/sda12      578035712   588275711     5120000   83  Linux
/dev/sda13      588277760   596467711     4094976   82  Linux swap / Solaris

Disk /dev/sdb: 2001 MB, 2001731584 bytes
26 heads, 56 sectors/track, 2685 cylinders, total 3909632 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

reply via email to

[Prev in Thread] Current Thread [Next in Thread]