0

Ahoy friends. Some time ago i had a similar question but now im closer to the solution. I set up a simple grub menu on my tftp/pxe server. I want clients to be able to boot iso files in efi as well as legacy mode! So i decided to use GRUB instead of SYSLINUX. But now i ran into a problem. I have to mount a nfs share to be able to load the initrd right? I spent hours of time but unfortunately only a few people tried to perform this. Furthermore i got no issues running linux16 images like memtest. They work fine without any problem.

So that's my current grub.cfg menu entry to boot my clonezilla live iso file from pxegrub.

menuentry "Netroot" {
   echo 'Trying to boot via nfs ...'
   load_video
   insmod gzio
   if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   insmod part_msdos
   insmod ext2
   echo 'Loading Linux ...'
   linux /programs/clonezilla/live/vmlinuz root=/dev/nfs netboot=nfs nfsroot=192.168.2.55:/var/lib/tftpboot/programs/clonezilla/live/ rw  quiet
   echo 'Loading initial ramdisk ...'
   initrd initrd.img
}

And my exports file

/etc/exports

/var/lib/tftpboot/programs/clonezilla/live 192.168.2.55/(rw,no_root_squash,sync,no_subtree_check)

Unfortunately it's unable to set the correct root, so i can't load the initrd yet. Whats the problem in here? Can someone help me to get it running through grub? I found a few examples for SYSLINUX but is it possible to get them running in grub?

DEFAULT ubuntu
LABEL ubuntu
KERNEL /vmlinux-4.8.17-040817-generic
APPEND ip=dhcp rw root=/dev/nfs nfsroot=192.168.1.254:/diskless/ubuntu/0185 raid=noautodetect quiet splash amdgpu.vm_fragment_size=9
INITRD /initrd.img-4.8.17-040817-generic

I prefer grub over syslinux and it's a little bit more advanced.

I hope someone can help me. Maybe it's some issue with my nfs share? I never used them before.

0

No, GRUB does not support NFS at all.

Even though the linux line contains the NFS mount parameters, GRUB won't act on those; it just passes the parameters to the Linux kernel when the kernel is actually booted. Once the kernel has started up and is executing initramfs, it will use those parameters to set up a NFS-mounted root filesystem.

GRUB loads the initrd.img using precisely the same mechanism as it uses to load the kernel file. In your "simple tftp/pxe" solution the mechanism will most likely be TFTP. (Newest versions of UEFI may also support HTTP, but I'm not sure if GRUB can use UEFI's HTTP features yet.)

Once GRUB has loaded the kernel, initramfs and the boot options string into the PXE client's RAM, it transfers the control of the system to the kernel: GRUB will not be involved in any actions beyond that point.

In order to handle both legacy and UEFI PXE boot, your DHCP server must read the PXE architecture option, use it to identify whether the PXE client is legacy or UEFI, and then pass an appropriate boot file path to either a legacy PXE bootloader (e.g. a GRUB PXE image created with grub-mkimage --format=i386-pc-pxe) or a UEFI bootloader (e.g. a grub.efi image created with grub-mkimage --format=x86_64-efi).

For booting Clonezilla Live over PXE, you don't need nfsroot options. Instead, your linux line might be something like this:

linux /programs/clonezilla/live/vmlinuz boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales=en_US.UTF-8 keyboard-layouts=us ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=http://URI_path_on_your_server_containing/filesystem.squashfs

Obviously replace the http://URI_path_on_your_server_containing/filesystem.squashfs part with an actual URL pointing to a HTTP server from which the Clonezilla initramfs will be able to download the Clonezilla filesystem.squashfs file. If you prefer a non-US keyboard, you can also change the keyboard-layouts=us part. This option string was originally written by following the instructions:

and the Clonezilla boot option reference at:

I used it with SYSLINUX on legacy PXE boot and iPXE.org bootloader on UEFI, and when I tested it with clonezilla-live-20191024-eoan-amd64.zip it worked.

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.