PXE booting .IMG and .DD images

ddpxe-boot

I have read many forum posts but still can't PXE boot image files.

usb-image.dd is my image file. Instead of using USB sticks I would like to boot live Linux by using PXE.

DEFAULT menu.c32
PROMPT 0
timeout 300

MENU TITLE PXE Menu

LABEL memtest86
 MENU LABEL Memtest86+ 5.01
 KERNEL /memtest/memtest86+-5.01

LABEL Live Linux
 MENU LABEL Live Linux test
 KERNEL memdisk
 APPEND initrd=/test/usb-image.dd

PXE Menu is working and I can boot Memtest86+ but Live Linux test fails and I can't see why. Menu is reloaded instantly.

I'm using Ubuntu 16.04 LTS.

How should I proceed?

Edit 1:
Information about my usb-image.dd.

user@PXE-server:/var/lib/tftpboot/test$ fdisk -l usb-image.dd
Disk usb-image.dd: 3 GiB, 3270508544 bytes, 6387712 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 597F78FB-1090-4C9B-A779-1DC99DDAC259

Laite           Start   Loppu Sektorit  Size Tyyppi
usb-image.dd1    2048  450559   448512  219M EFI System
usb-image.dd2  450560 6371327  5920768  2,8G Microsoft basic data
usb-image.dd3 6371328 6385663    14336    7M Linux filesystem

Edit 2:

I disabled the menu and saw the error message.

Loading /test/usb-image.dd...failed: Bad file number

Best Answer

First of all, ensure memdisk is actually present on your TFTP server and can be served to clients. It's not a magic invocation, memdisk is a separate component of syslinux.

Secondly, loading ISOs in this way usually requires that you pass more parameters to the memdisk kernel, specifically the "iso" and often also the "raw" parameters. Try the following:

KERNEL memdisk
INITRD /test/usb-image.dd
APPEND iso raw

If your image is an isohybrid image (which it presumably is in order to load from a USB stick) and therefore has an MBR, you can probably treat it as a hard disk, as well:

KERNEL memdisk
INITRD /test/usb-image.dd
APPEND harddisk

Thirdly, consider that TFTP is very inefficient and may not necessarily support serving large files (which your image of a Linux LiveUSB certainly is). If the blocksize negotiation is not supported by your TFTP server, it cannot serve anything larger than 32MB - it is possible you are using an implementation, or an old version of an implementation, which does not support this. Consider replacing pxelinux with the lpxelinux variant instead, which supports loading additional resources over HTTP, and serve your kernel/image files from a webserver. It will be considerably faster.

KERNEL http://webserver.mydomain/memdisk
INITRD http://webserver.mydomain/test/usb-image.dd
APPEND harddisk