Grub not working

Tom H tomh0665 at gmail.com
Fri May 6 02:50:33 UTC 2011


On Thu, May 5, 2011 at 9:40 PM, dave boland <dboland9 at fastmail.fm> wrote:
> On Thu, 05 May 2011 21:24 -0400, "Tom H" <tomh0665 at gmail.com> wrote:
>> On Thu, May 5, 2011 at 5:31 PM, dave boland <dboland9 at fastmail.fm> wrote:
>> >
>> > I have tried all manner of combinations to get this to work.  Currently,
>> > I get an error in line 147 (of the config file?) when I run update-grub.
>> >  Below is the error and the config file entry starting at line 143.
>> >
>> > Generating grub.cfg ...
>> > Found linux image: /boot/vmlinuz-2.6.38-8-generic
>> > Found initrd image: /boot/initrd.img-2.6.38-8-generic
>> > Found memtest86+ image: /boot/memtest86+.bin
>> > error: syntax error.
>> > error: Incorrect command.
>> > error: syntax error.
>> > error: line no: 147
>> > 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
>> >
>> > ### BEGIN /etc/grub.d/40_custom ###
>> > # 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.
>> > # cat /etc/grub.d/40_custom
>> > #!/bin/sh
>> > echo 'Windows ME'
>> > cat<<EOF
>> > menuentry "WinME" {
>> > chainloader (hd0,1)+1
>> > }
>> > EOF
>> > ### END /etc/grub.d/40_custom ###
>>
>> I don't understand but I don't have the time to check the archive at
>> the moment. I hope that this wasn't what I asked you to do. :(
>>
>> What you need is just:
>>
>> root at nattykdebox:~# cat /etc/grub.d/40_custom
>> #!/bin/sh
>> cat << EOF
>> menuentry "Chainload WinME" {
>> insmod part_msdos
>> insmod fat
>> set root=(hdX,Y) ## where X and Y are correct for your ME partition
>> chainloader +1
>> }
>> EOF
>> root at nattykdebox:~#
>>
>> In the same way, this is a cat of a 40_custom that I've got at the
>> moment to test FreeBSD:
>>
>> root at nattykdebox:~# cat /etc/grub.d/40_custom
>> #!/bin/sh
>>
>> cat <<EOF
>>
>> menuentry "FreeBSD chainload" {
>> insmod part_msdos
>> insmod part_bsd
>> insmod ufs1
>> insmod ufs2
>> set root=(hd1,msdos1,bsd1)
>> chainloader +1
>> }
>>
>> menuentry "FreeBSD loader" {
>> insmod part_msdos
>> insmod part_bsd
>> insmod ufs1
>> insmod ufs2
>> set root=(hd1,msdos1,bsd1)
>> kfreebsd /boot/loader
>> }
>>
>> menuentry "FreeBSD kernel" {
>> insmod part_msdos
>> insmod part_bsd
>> insmod ufs1
>> insmod ufs2
>> set root=(hd1,msdos1,bsd1)
>> kfreebsd /boot/kernel/kernel
>> kfreebsd_loadenv /boot/device.hints
>> set FreeBSD.vfs.root.mountfrom=ufs:/dev/ad6s1a
>> set FreeBSD.vfs.root.mountfrom.options=rw
>> }
>>
>> EOF
>> root at nattykdebox:~#
>
> I have to confess -- I don't quite get what I have to do.  Do I need to
> put all of this in a file?

No. Sorry, I must not have been clear.

I was just showing you with the first "root at nattykdebox:~# cat
/etc/grub.d/40_custom" that you should have that in your 40_custom and
with the second "root at nattykdebox:~# cat /etc/grub.d/40_custom" what I
have on my box to boot FreeBSD.

The structure of 40_custom should be as follows without the lines
starting and ending with parentheses as they are comments for the sake
of this email (I'm assuming that you install grub2 to sda9 and reset
the MBR with "fdisk /mbr"; if "set root=(hd0,1)" after that, try "set
root=(hd0)").

#!/bin/sh
(because this is a script)
cat << EOF
(for the script to start writing to grub.cfg when it's called)
menuentry "Chainload WinME" {
insmod part_msdos
insmod fat
set root=(hd0,1)
chainloader +1
}
(the above's the actual menu title and the stuff that picking'll do)
EOF
(for the script to stop writing to grub.cfg when it's called)




More information about the ubuntu-users mailing list