How to Fix “Fatal: Could not read from boot medium” During PXE Boot in VirtualBox Internal Network Mode


2 views

When setting up PXE boot for VirtualBox guests in internal network mode, you might encounter the frustrating "Fatal: Could not read from the boot medium" error. This typically occurs despite having a properly configured DHCP/TFTP server VM. Let's break down why this happens and how to properly configure the environment.

In my setup, I have:

  • One VM serving as NAT gateway (let's call it router-vm)
  • One VM running DHCP/TFTP services (pxe-server)
  • Multiple client VMs that need to network boot

The error typically stems from these common issues:

1. Incorrect DHCP options configuration
2. TFTP root path permissions
3. VirtualBox network adapter settings
4. PXE boot file naming conventions

Here's a working dhcpd.conf snippet for ISC DHCP Server:

subnet 192.168.15.0 netmask 255.255.255.0 {
    range 192.168.15.100 192.168.15.200;
    option routers 192.168.15.1;
    option domain-name-servers 8.8.8.8;
    filename "pxelinux.0";
    next-server 192.168.15.2; # IP of your TFTP server
}

For each client VM:

  1. Set adapter to Internal Network mode
  2. Use the same network name as your PXE server VM
  3. Enable PXE boot in System → Motherboard settings

Ensure your TFTP root contains these essential files:

/tftpboot/
├── pxelinux.0
├── pxelinux.cfg/
│   └── default
├── ldlinux.c32
└── vmlinuz          # Your kernel image

If you still get the error:

1. Verify network connectivity between VMs using ping
2. Check TFTP server logs (usually /var/log/syslog)
3. Test TFTP transfer manually: 
   tftp 192.168.15.2
   get pxelinux.0
4. Ensure VirtualBox version ≥ 6.1 for best PXE support

Here's a working VirtualBox XML configuration snippet for reference:

<Network>
    <Adapter slot="0" enabled="true" MACAddress="080027B398A5" 
    cable="true" speed="0" type="82540EM">
        <InternalNetwork name="PXENet"/>
        <Boot priority="2"/>
    </Adapter>
</Network>

When setting up a PXE boot environment in VirtualBox using internal networking, you might encounter the frustrating error: Fatal: Could not read from the boot medium! System halted. This typically happens when the client VM fails to fetch the boot files from your TFTP/DHCP server, even though the configuration seems correct.

For PXE booting to work in VirtualBox's internal network mode, you need:

  • A DHCP server with proper PXE boot options (next-server, filename)
  • A TFTP server hosting the boot files (pxelinux.0, kernel, initrd)
  • Correct VirtualBox network adapter settings (PCnet-FAST III or Intel PRO/1000 MT)

Here are the most frequent issues and how to resolve them:

1. DHCP Configuration Issues

Your DHCP server must include these essential options:

subnet 192.168.15.0 netmask 255.255.255.0 {
    range 192.168.15.100 192.168.15.200;
    option routers 192.168.15.1;
    option domain-name-servers 8.8.8.8;
    filename "pxelinux.0";
    next-server 192.168.15.2;  # IP of your TFTP server
}

2. TFTP Server Permissions

The TFTP server must have proper permissions and the files must be accessible. For example, in dnsmasq:

# /etc/dnsmasq.conf
enable-tftp
tftp-root=/var/lib/tftpboot
dhcp-boot=pxelinux.0

3. VirtualBox Network Adapter Settings

Ensure your VMs are using compatible network adapters:

VBoxManage modifyvm "VM Name" --nic1 intnet --nictype1 82545EM --cableconnected1 on

To diagnose where the process fails:

  1. Check if the client gets an IP address (use VBoxManage debugvm)
  2. Verify TFTP requests reach your server (check logs)
  3. Test file transfer manually: tftp 192.168.15.2 -c get pxelinux.0

If internal networking proves problematic, consider using NAT network with port forwarding:

VBoxManage natnetwork add --netname PXENet --network "192.168.15.0/24" --enable
VBoxManage natnetwork modify --netname PXENet --port-forward-4 "tftp:tcp:[]:69:[192.168.15.2]:69"

Here's a complete working configuration example:

# VirtualBox VM Network Settings
Adapter 1: Internal Network ("intnet")
Adapter Type: Intel PRO/1000 MT Desktop (82540EM)

# DHCP Server (dnsmasq) Configuration
interface=eth0
dhcp-range=192.168.15.100,192.168.15.200,12h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/tftpboot

Remember to place all PXE boot files in /tftpboot with correct permissions (typically 755 for directories and 644 for files).