fbpx

Solutions

How to troubleshoot TFTP Error code 2 on RHEL

by ,


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

Operating System and Software

  • Rocky Linux 8

Problem

  • On a default installation of TFTP server, using get to retrieve files fails with Error code 2: xxxx
  • Attempt to retrieve a file using the relative path fails with Error code 2: Only absolute filenames allowed.
# tftp localhost
tftp> get testfile
Error code 2: Only absolute filenames allowed
  • Attempt to retrieve a file using the absolute path fails with Error code 2: Forbidden directory.
tftp> get /var/lib/tftpboot/testfile
Error code 2: Forbidden directory

How to Fix

  • The default installation of tftp-server on Rocky Linux 8 uses systemd instead of xinetd and does not require a config file to run.
  • Inspect any existing config files in /etc/xinetd.d.
  • In this instance, a config file for ftpd was present in /etc/xinetd.d/ftpd. This interfered with tftpd and resulted in the errors displayed.
  • Removing the ftpd config file then restarting xinetd resolved the issue.

Origin of the Problem

  • An existing config file for ftpd was present in /etc/xinetd.d/ftpd.

Diagnostic Steps

  • Install tftp-server and tftp packages on Rocky Linux 8.
# dnf install tftp-server tftp
  • Start tftp server.
# systemctl start tftp

# systemctl status tftp
 tftp.service - Tftp Server
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: disabled)
   Active: active (running) since Thu 2020-07-09 10:46:07 BST; 5min ago
     Docs: man:in.tftpd
 Main PID: 27056 (in.tftpd)
    Tasks: 1 (limit: 11482)
   Memory: 376.0K
   CGroup: /system.slice/tftp.service
           └─27056 /usr/sbin/in.tftpd -s /var/lib/tftpboot

Jul 09 10:46:07 hostname.example.net systemd[1]: Started Tftp Server.
  • Create test file in the default directory /var/lib/tftpboot
# touch /var/lib/tftpboot/testfile
  • Check UDP port for tftpd is listening. This issue will only reproduce if the first entry displays the name of the service in.tftpd and xinetd
# ss -pluton | grep ":69"
udp    UNCONN   0        0                 0.0.0.0:69             0.0.0.0:*      users:(("in.tftpd",pid=10350,fd=0),("xinetd",pid=998,fd=6))
udp    UNCONN   0        0                       *:69                   *:*      users:(("systemd",pid=1,fd=220))
  • Attempt to retrieve a file using the relative path fails with Error code 2: Only absolute filenames allowed.
# tftp localhost
tftp> get testfile
Error code 2: Only absolute filenames allowed
  • Attempt to retrieve a file using the absolute path fails with Error code 2: Forbidden directory.
tftp> get /var/lib/tftpboot/testfile
Error code 2: Forbidden directory

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.