Version
7.2.4
Host OS Type
Linux
Host OS name + version
Fedora 42
Host Architecture
x86
Guest OS Type
other
Guest Architecture
x86
Guest OS name + version
OpenBSD 7.8
Component
Network
What happened?
I am using VBoxManage to create a VM that will use a network-based install method. I'm therefore hoping to make use of the built-in TFTP server to get the installation started with the correct boot file e.g.
VBoxManage testvm \
--nat-enable-tftp1 on \
--nat-tftp-prefix1 '/tmp/tftpboot' \
--nat-tftp-file1 'pxeboot'
When the VM starts, the interaction between iPXE and DHCP appears to work as expected as it proceeds to download the pxeboot boot file communicated through the DHCP configuration.
The progress indicator never moves past 0% however and after 10 seconds or so, the error message "Connection Timed Out" appears.
Investigation Steps
I have enabled NIC tracing to capture the requests sent between the TFTP server and any clients. The trace clearly shows that the server receives a file request, correctly determines that file's size, and returns it to the client in an Option Acknowledgement message. This is the first successful response I am referring to in the title.
# nic trace
# TFTP server IP: 10.0.2.2, guest IP: 10.0.2.15
# TFTP server response #12 shows the file size (99588 bytes) could be determined for the file requested in #11
No. Time Source Destination Protocol Length Info
11 12.599922 10.0.2.15 10.0.2.2 TFTP 79 Read Request, File: pxeboot, Transfer type: octet, blksize=1432, tsize=0
12 12.600154 10.0.2.2 10.0.2.15 TFTP 69 Option Acknowledgement, blksize=1428, tsize=99588
13 12.600485 10.0.2.15 10.0.2.2 TFTP 46 Acknowledgement, Block: 0
14 12.600656 10.0.2.2 10.0.2.15 TFTP 61 Error Code, Code: File not found, Message: File not found
15 12.870423 10.0.2.15 10.0.2.2 TFTP 46 Acknowledgement, Block: 0
16 13.420080 10.0.2.15 10.0.2.2 TFTP 46 Acknowledgement, Block: 0
17 14.463211 10.0.2.15 10.0.2.2 TFTP 46 Acknowledgement, Block: 0
18 16.495641 10.0.2.15 10.0.2.2 TFTP 46 Acknowledgement, Block: 0
19 20.560354 10.0.2.15 10.0.2.2 TFTP 46 Acknowledgement, Block: 0
The client then follows this with its own Acknowledgement request, including the name of the same file again. The server responds to this message however with a "File not found (1)" error response instead of any file data.
So at this point I am guessing that the server is configured correctly with respect to the path it should look for files etc. but is failing to open the actual file for reading.
Possible Cause
After some inspection of the code, I believe the issue relates to the tftp_read_data function in libslirp-4.9.1/src/tftp.c. In that function, if the macro VBOX is defined, the opening of the requested file is guarded by a check:
if (spt->hFile != NIL_RTFILE) {
int rc = RTFileOpen(&spt->hFile, spt->filename, ...)
That spt->hFile is initialised to NIL_RTFILE in tftp_session_allocate (if VBOX is defined). I do not see therefore how the call to RTFileOpen can ever happen after the session is allocated.
The code then proceeds to call RTFileReadAt using the bad file descriptor. The -1 error return causes the calling function to generate the File not found error.
I have not compiled the code myself and so have therefore not confirmed my suspicion or whether the VBOX macro is set. I'm presuming these additions have been made to the libslirp code base for a reason however.
How can we reproduce this?
The following outlines the basic steps to trigger the TFTP-based functionality during PXE boot:
- Create a new VM
- Configure NAT network type (
--nic1 nat)
- Enable the TFTP server (
--nat-enable-tftp1)
- Configure a TFTP file prefix (
--nat-tftp-prefix1)
- Configure a TFTP file (
--nat-tftp-file1)
- Configure
net boot method (--boot1 net)
- Boot VM
- Observe iPXE boot screen
- Determine if the boot file shows any progress in downloading from the TFTP server
Did you upload all of your necessary log files, screenshots, etc.?
Version
7.2.4
Host OS Type
Linux
Host OS name + version
Fedora 42
Host Architecture
x86
Guest OS Type
other
Guest Architecture
x86
Guest OS name + version
OpenBSD 7.8
Component
Network
What happened?
I am using
VBoxManageto create a VM that will use a network-based install method. I'm therefore hoping to make use of the built-in TFTP server to get the installation started with the correct boot file e.g.When the VM starts, the interaction between iPXE and DHCP appears to work as expected as it proceeds to download the
pxebootboot file communicated through the DHCP configuration.The progress indicator never moves past
0%however and after 10 seconds or so, the error message "Connection Timed Out" appears.Investigation Steps
I have enabled NIC tracing to capture the requests sent between the TFTP server and any clients. The trace clearly shows that the server receives a file request, correctly determines that file's size, and returns it to the client in an Option Acknowledgement message. This is the first successful response I am referring to in the title.
The client then follows this with its own Acknowledgement request, including the name of the same file again. The server responds to this message however with a "File not found (1)" error response instead of any file data.
So at this point I am guessing that the server is configured correctly with respect to the path it should look for files etc. but is failing to open the actual file for reading.
Possible Cause
After some inspection of the code, I believe the issue relates to the
tftp_read_datafunction inlibslirp-4.9.1/src/tftp.c. In that function, if the macroVBOXis defined, the opening of the requested file is guarded by a check:That
spt->hFileis initialised toNIL_RTFILEintftp_session_allocate(ifVBOXis defined). I do not see therefore how the call toRTFileOpencan ever happen after the session is allocated.The code then proceeds to call
RTFileReadAtusing the bad file descriptor. The-1error return causes the calling function to generate theFile not founderror.I have not compiled the code myself and so have therefore not confirmed my suspicion or whether the
VBOXmacro is set. I'm presuming these additions have been made to thelibslirpcode base for a reason however.How can we reproduce this?
The following outlines the basic steps to trigger the TFTP-based functionality during PXE boot:
--nic1 nat)--nat-enable-tftp1)--nat-tftp-prefix1)--nat-tftp-file1)netboot method (--boot1 net)Did you upload all of your necessary log files, screenshots, etc.?