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,
set prefix=(tftp,
insmod 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,' 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.


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


You have to set next-server as 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.

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.