1

I configured a dhcp and tftp server, for my tests, I used at first time, syslinux to boot over PXE network successfully.

Now I want to use grub instead of syslinux to boot, in order to do that, I issued the command grub-mknetdir --net-directory=<my_tftp_root_dir>, and modified the file to be served in dhcpd.conf.

PXE boot works but I am always getting the error about root variable unset, and I get into grub rescue mode.

If I manually issue the commands:

set root=(tftp,10.50.1.10)
set prefix=(tftp,10.50.1.10)
insmod normal
normal

Then I can correctly see the grub.cfg menu entries and boot whatever is there..

But I want that to be done automatically and get the grub menu without manual intervention.

Already drove myself crazy reading without any positive feedback, so I am out of ideas of how to set, both root and prefix so grub can start correctly.

Thanks for any suggestions/hints, this PXE thing is a new world to me yet.

EDIT: Playing around, the best thing I could do is to generate again the image with: grub-mkimage -O i386-pc-pxe --output /warehouse/TFTProot/boot/grub/i386-pc/core.0 --prefix='(tftp,10.50.1.10)/boot/grub' pxe tftp

And don't rely on the autogenerated one, but isn't there any better solution than to regenerate it manually? As grub-mknetdir generates it already.

StormByte
  • 133
  • 1
  • 2
  • 8

2 Answers2

1

1) You can build the core image, create a configuration file e.g

setvars.conf and reference with the mkimage command -c setvars.conf

grub-mkimage -O i386-pc-pxe --output /warehouse/TFTProot/boot/grub/i386-pc/core.0 --prefix='' -c setvars.conf ppxe tftp

2) save a file named grub.cfg in the root of the tftp-server with the following content:

set root=(tftp) set net_default_server=192.168.x.x set prefix=boot/grub

Stefan
  • 11
  • 1
0

You have to set next-server as 10.50.1.10 in your bootp or dhcp server. This is required by grub2 in order to setup 'root' and 'prefix' vars. Also, be sure you use the right, absolute path to the grub-mknetdir command, also for --subdir param.