TFTP on Ubuntu 10.04

I'm running 64-bit Ubuntu 10.04. I followed http://processors.wiki.ti.com/index.php/Setting_Up_a_TFTP_Server to set up tftpd-hpa, but haven't been able to get it to work.  No tftp process is running ("netstat -a | grep tftp" returns nothing), but when I use the command:  "sudo service tftpd-hpa start", it says tftpd-hpa is already running.   I edited the /etc/default/tftpd-hpa file as instructed, but I can't ftp files using my custom board or my Windows machine (pinging the Linux Host's IP Address works for both).

Any ideas?

  • Hello,

    The TFTP server is managed by xinetd. You need to make sure xinetd is installed and that you have en entry such as this in /etc/xinet.d/tftp:

    service tftp
    {
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = nobody
    server = /usr/sbin/in.tftpd
    server_args = /tftproot
    disable = no
    }

    Then run /etc/init.d/xinetd restart

    Note that if you use DVSDK 4.00 (announced at the top of this forum) this is done for you by the setup script. Just make sure you have ia32-libs installed on your 64-bit host before installing.

    Regards, Niclas

  • In reply to Niclas:

    The behaviour is different on my Windows machine:  it now times out instead saying that the connection was refused.  The timeout is for GET and PUT.  My custom board has the same behaviour as before: still times out when trying to get uImage.  "Netstat -a | grep tftp" does return a tftp process now.

  • In reply to Inderjit Bains:

    Hi Inderjit,

    I had problems using tftpd in a VMware virtual machine. I solved the problem momentarily making a script that configures TFTP server in a Ubuntu 10.04 live session. I just execute it and then I can download images from the board. Maybe it helps you:

    #!/bin/bash

    # ======================================
    # SCRIPT TO INSTALL AND CONFIGURE UBUNTU
    # TFTP SERVER TO WORK WITH OMAP-L138 EVM
    # ======================================
    #                         By cerilet.com

    # Install TFTP client and server and SSH
    sudo apt-get install tftpd-hpa tftp-hpa ssh

    # Changing permissions of directory /var/lib/tftpboot
    sudo chmod 777 /var/lib/tftpboot

    # Change configuration of tftpd-hpa and add this
    # RUN_DAEMON="yes"
    # OPTIONS="-c -l -s /tftpboot"
    sudo mv /etc/default/tftpd-hpa /etc/default/tftpd-hpa_ORIGINAL
    # Downloading the new configuration file from my server
    sudo wget -O /etc/default/tftpd-hpa http://cerilet.com/omap/tftpd-hpa

    # Start the server
    sudo /etc/init.d/tftpd-hpa start

    # Downloading kernel and filesystem images from server
    wget  -O /var/lib/tftpboot/uImage_arago http://cerilet.com/omap/uImage_arago
    wget  -O /var/lib/tftpboot/uImage_dani http://cerilet.com/omap/uImage_dani
    wget  -O /var/lib/tftpboot/uImage_dani2 http://cerilet.com/omap/uImage_dani2
    wget  -O /var/lib/tftpboot/uImage_DaVinci http://cerilet.com/omap/uImage_DaVinci

    wget  -O /var/lib/tftpboot/arago.ext2.gz http://cerilet.com/omap/arago.ext2.gz
    wget  -O /var/lib/tftpboot/arago.jffs2 http://cerilet.com/omap/arago.jffs2
    wget  -O /var/lib/tftpboot/arago.tar.gz http://cerilet.com/omap/arago.tar.gz

    wget  -O /var/lib/tftpboot/evm-demo-img.ext2.gz http://cerilet.com/omap/evm-demo-img.ext2.gz
    # wget -O /var/lib/tftpboot/evm-demo-img.jffs2 http://cerilet.com/omap/evm-demo-img.jffs2
    # wget -O /var/lib/tftpboot/evm-demo-img.tar.gz http://cerilet.com/omap/evm-demo-img.tar.gz

    # Changing password of the live CD user
    sudo passwd ubuntu

    Regards,

    Cerilet.

  • In reply to cerilet.com:

    Thanks.  I didn't run the full script, just the following:

    sudo apt-get install tftpd-hpa tftp-hpa ssh

    sudo chmod 777 /var/lib/tftpboot

    sudo mv /etc/default/tftpd-hpa /etc/default/tftpd-hpa_ORIGINAL


    sudo wget -O /etc/default/tftpd-hpa http://cerilet.com/omap/tftpd-hpa

    I then rebooted the machine, and the behaviour is the same:  all attempts to use tftp time out.

  • In reply to Inderjit Bains:

    Had you reviewed the iptables configuration? Or maybe if you are using a router have to open the tftp port (69).

    Take a look to this post:

    http://blog.colovirt.com/2009/03/31/linuxnetworkingsecurity-tftp-deamon-setup-and-cisco-configuration-backup/

  • In reply to cerilet.com:

    The settings that work for PC to Linux Box:

    /etc/default/tftpd-hpa:

    #Defaults for tftpd-hpa
    RUN_DAEMON=”yes”
    OPTIONS=”-c -l -s /tftpboot”

    /etc/xinetd.d/tftp

    service tftp
    {
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd
    server_args = -c -s /tftpboot
    disable = no
    per_source = 11
    cps = 100 2
    }

    Commenting out "ftp dgram udp4 wait root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /tftpboot" in  /etc/inetd.conf does not seem to make a difference, and neither does "root" vs. "nobody" as the owner of /tftpboot.  "user = root" in /etc/xinetd.d/tftp vs "nobody" does make a difference:  TFTP does not work on the Window PC to the Linux Host without it.

    For the custom board, I'm getting some results.  Instead of a "*" turning into a series of "T"s (indicating timeouts), I'm now getting some "#"s, but a lot more "T"s.  This may be a hardware or U-Boot issue, but it's odd that the router can assign an IP address to the board (which can be picked up by DCHP on the custom board), and ping works to the Linux Box and Windows PC from the custom board.

  • In reply to Inderjit Bains:

    Not sure why, but it's working on the custom board now.  I set "unsigned int    emac_dbg = 1;" in ether.c (u-boot), and it worked.  Setting it back to 0 also works.  Perhaps I handn't done a full build of u-boot in a while.  One timeout in downloading the root file system - not sure what's causing it.

  • In reply to Inderjit Bains:

    I am having similar issues getting DM355 PSP 3.1 - to TFTP Boot.  I have followed all the items on the wiki, e2e and even some google ubuntu/tftp searches but still stuck.

    Here is my /etc/init.d/xinetd and /etc/default/tftp-hpa files:

    # /etc/default/tftpd-hpa

    RUN_DAEMON="yes"
    USERNAME="tftp"
    # DIRECTORY="/srv/tftp"
    DIRECTORY="/tftpboot"
    ADDRESS="0.0.0.0:69"
    OPTIONS="-c -l -s /tftpboot"

    user@marc-laptop:/etc/xinetd.d$ cat tftp
    service tftp
    {
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd
    server_args = -c -l -s /tftpboot
    per_source = 11
    cps = 100 2
    disable = no
    }

    I keep getting 'Could Not establish Link'


    DM355 EVM > tftp 0x80700000 uImage
    dm9000 i/o: 0x4014000, id: 0x90000a46
    DM9000: running in 16 bit mode
    MAC: 00:0e:99:02:ce:78
    could not establish link
    TFTP from server 192.168.1.2; our IP address is 192.168.1.3
    Filename 'uImage'.
    Load address: 0x80700000
    Loading: T
    Abort
    DM355 EVM >
     CTRL-A Z for help |115200

  • In reply to Marc DAmato:

    Marc,

     

    Can you share your bootargs as well as your environment settings?  I want to see how DHCP or your static IP is setup as well as all the other network and environment settings. 

  • In reply to Jeff Hayes:

    Jeff,

    DM355 EVM > pri
    bootdelay=4
    baudrate=115200
    bootcmd=dhcp;bootm
    serverip=192.168.1.2
    bootfile=uImage
    nfshost=192.168.1.2
    rootpath=/home/user/workdir/filesystem
    ethaddr=00:0e:99:02:ce:78
    bootargs=console=ttyS0,115200n8 rw noinitrd root=/dev/nfs nfsroot=192.168.1.2:/home/user/workdir/filesystem,nolock mem=116M ip=
    dhcp
    stdin=serial
    stdout=serial
    stderr=serial
    videostd=ntsc
    ver=U-Boot 2009.03 (Jun 21 2010 - 15:13:07)
    ipaddr=192.168.1.3
    gatewayip=192.168.1.1
    netmask=255.255.255.0
    dnsip=192.168.1.1

    Environment size: 481/524284 bytes
    DM355 EVM > tftp 0x80700000 uImage
    dm9000 i/o: 0x4014000, id: 0x90000a46
    DM9000: running in 16 bit mode
    MAC: 00:0e:99:02:ce:78
    operating at 100M full duplex mode
    TFTP from server 192.168.1.2; our IP address is 192.168.1.3
    Filename 'uImage'.
    Load address: 0x80700000
    Loading: T T T T T
    Abort

    DM355 EVM > dhcp
    dm9000 i/o: 0x4014000, id: 0x90000a46
    DM9000: running in 16 bit mode
    MAC: 00:0e:99:02:ce:78
    could not establish link
    BOOTP broadcast 1
    BOOTP broadcast 2

    Abort
    DM355 EVM >