markyb73
May 2nd, 2011, 12:22 PM
Hi,
I did a clean install of Natty and as per Maverick etc i like to set up grub to point to other bootloaders on other partitions, which used to work fine but now i get an error. I have several partitions on a second hard drive which run other distros and windows 7.
What i do is in /etc/grub.d is make 30_os-prober non executable so it doesn't look for other operating systems.
sudo chmod -x /etc/grub.d/30_os-prober
Then i edit /etc/grub.d/40_custom and add the following to the bottom of the file.
#! /bin/sh -e
echo "Adding Windows 7" >&2
cat << EOF
menuentry "/dev/sda3 Windows 7 Enterprise OX" {
set root=(hd0,3)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb2" >&2
cat << EOF
menuentry "/dev/sdb2 Natty Test-Partition" {
set root=(hd1,2)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb3" >&2
cat << EOF
menuentry "/dev/sdb3 Kubuntu" {
set root=(hd1,3)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb5" >&2
cat << EOF
menuentry "/dev/sdb5 Fedora" {
set root=(hd1,5)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb6" >&2
cat << EOF
menuentry "/dev/sdb6 Arch Linux" {
set root=(hd1,6)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb7" >&2
cat << EOF
menuentry "/dev/sdb7 Spare" {
set root=(hd1,7)
chainloader +1
}
EOF
Finally i run
sudo update-grub
Then i can normally boot and see the kernels in my primary os and select another bootloader on another partion.
When i run sudo update-grub i get:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-8-generic-pae
Found initrd image: /boot/initrd.img-2.6.38-8-generic-pae
Found memtest86+ image: /boot/memtest86+.bin
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 143
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.
done
Line 143 in /boot/grub/grub.cfg shows the following:
### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
I am a bit stuck as this used to work fine on Maverick and Lucid, just wondering whether something has changed and i need to modify something.
Any advice would help :D
Thanks!
I did a clean install of Natty and as per Maverick etc i like to set up grub to point to other bootloaders on other partitions, which used to work fine but now i get an error. I have several partitions on a second hard drive which run other distros and windows 7.
What i do is in /etc/grub.d is make 30_os-prober non executable so it doesn't look for other operating systems.
sudo chmod -x /etc/grub.d/30_os-prober
Then i edit /etc/grub.d/40_custom and add the following to the bottom of the file.
#! /bin/sh -e
echo "Adding Windows 7" >&2
cat << EOF
menuentry "/dev/sda3 Windows 7 Enterprise OX" {
set root=(hd0,3)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb2" >&2
cat << EOF
menuentry "/dev/sdb2 Natty Test-Partition" {
set root=(hd1,2)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb3" >&2
cat << EOF
menuentry "/dev/sdb3 Kubuntu" {
set root=(hd1,3)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb5" >&2
cat << EOF
menuentry "/dev/sdb5 Fedora" {
set root=(hd1,5)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb6" >&2
cat << EOF
menuentry "/dev/sdb6 Arch Linux" {
set root=(hd1,6)
chainloader +1
}
EOF
#! /bin/sh -e
echo "Adding /dev/sdb7" >&2
cat << EOF
menuentry "/dev/sdb7 Spare" {
set root=(hd1,7)
chainloader +1
}
EOF
Finally i run
sudo update-grub
Then i can normally boot and see the kernels in my primary os and select another bootloader on another partion.
When i run sudo update-grub i get:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-8-generic-pae
Found initrd image: /boot/initrd.img-2.6.38-8-generic-pae
Found memtest86+ image: /boot/memtest86+.bin
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 143
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.
done
Line 143 in /boot/grub/grub.cfg shows the following:
### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
I am a bit stuck as this used to work fine on Maverick and Lucid, just wondering whether something has changed and i need to modify something.
Any advice would help :D
Thanks!