I'm runnung Ubuntu 12.04 in a VirtualBox VM. I've installed the tftpd-hpa package. I'm using this to boot an embedded Linux system, and I've noticed that on first boot of my VM, it wouldn't work, but restarting the tftpd-hpa service made it work every time, until next boot.

Today, I ran a shell script from Texas Instruments that may have mucked with my tftpd configuration, and now I cannot get it to work at all. I'm able to connect, but transfers timeout, even to localhost (I also tried 127.0.0.1):

steve@steve-VirtualBox:~$ tftp
tftp> connect localhost
tftp> status
Connected to localhost.
Mode: netascii Verbose: off Tracing: off
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> get zImage
Transfer timed out.

tftp> 

Note that /var/lib/tftpboot/zImage does exist, however I get the exact same behavior for a file that doesn't exist.

Here are the contents of /etc/default/tftpd-hpa:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

Here is /etc/xinetd.d/tftp:

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /var/lib/tftpboot
disable = no
}
up vote 2 down vote accepted

Seems you're starting tftpd-hpa from xinetd and as a standalone service at the same time. Please choose one and disable the other.

E.g. set disable = yes in /etc/xinetd.d/tftp and restart xinetd. Then restart the standalone service service tftpd-hpa restart and try the connection again.

  • It seems like this has resolved my new problem, but I still have to restart tftpd-hpa after a reboot before it will work (which wasn't what this question was about). Thank you! – Steve May 28 '14 at 14:32
  • For the follow on question to hopefully resolve the other part, see serverfault.com/questions/599126/… – Steve May 28 '14 at 14:40

Setting TFTP_ADDRESS="0.0.0.0:69" didn't work for me, at least for both interfaces. Setting TFTP_ADDRESS=":69" did the job

  • Can you clarify your OS and its version? – chicks Mar 31 '17 at 14:43
  • It's Debian Jessie – meresgr Apr 5 '17 at 19:13

1) uninstall/re-install tftpd-hpa

2) add to /etc/default/tftpd-hpa

RUN_DAEMON="yes"

You may need to poke a hole in the firewall. From step 4 of http://www.thelinuxdaily.com/2010/02/guide-on-tftp-server-setup-in-fedora/:

Insert the following line before the “COMMIT” line of /etc/sysconfig/iptables and then restart the service with ‘service iptables restart':

-A INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT

See this answer.

I had to edit /etc/default/tftpd-hpa and set the IP address in the TFTP_ADDRESS= variable.

That was on Debian Jessie, but it may be the same on Ubuntu.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.