Legacy Archive (2015): Originally written in Chinese on doubixie.com and translated into English for this edition. All archive posts · Home

ProFTPD Won't Start: From ServerType to a Surprise DNS Fix

Original Chinese title: Proftpd无法启动

The Problem

  1. This afternoon I suddenly noticed that FTP stopped working on one of our servers. Trying to connect gave this error:

    Proftpd[12087]:waring: unable to determine IP address of 'Adex'.
    Proftpd[12087]:error: no valid servers configured 'Adex'
    Porftpd[12087]:Fatal: error processing configuration file '/etc/proftpd.conf' fail!
  2. The error message was pretty clear, so surely someone before me had already hit this snag.

Searching the Error Code on Baidu

  1. First, I tried the hostname-to-IP resolution mismatch fix, updating proftpd.conf and /etc/hosts.

  2. That immediately led to a second error:

    Proftpd socket operation on non-socket
  3. Nothing on the first three pages of Baidu for this one. WTF.

Turning to Google

  • According to Proftpd error: fatal: Socket operation on non-socket, the issue was ServerType.

  • Checked my conf and sure enough, it was set to inetd instead of standalone.

  • The official docs confirm this:

    5. "Fatal: Socket operation on non-socket"
        You have ProFTPD configured to run in inetd mode rather than standalone. In this mode, ProFTPD expects that it will be run from the inetd super-server, which implies that stdin/stdout will be sockets instead of terminals. As a result, socket operations will fail and the above error will be printed. If you wish to run ProFTPD from the shell, in standalone mode, you'll need to modify your proftpd.conf configuration file and add or edit the ServerType directive to read:
        ServerType standalone
  • After changing it, the errors went away, but nothing happened when I tried to start the service.

    ps aux|grep proftpd
    hostname -f
  • Confirmed there was no running process, and also verified it was bound to the external IP.

    lsof -i:21 
  • Since inetd was still running, I tried restarting the inetd service.

    /usr/sbin/proftpd 
  • Still no response at all.

  • Checked the log:

    vi /var/log/proftpd.log
    No entries at all.
  • Pretty much out of ideas at this point.

Then Out of Nowhere

  • I tried running ping against Baidu from the server, and it couldn’t reach it.

    vi /etc/resolv.conf
    
    # 
    #
    search xxx.com
    nameserver 8.8.8.8
  • Turns out the DNS was set to Google’s, even though the server is in China. So I found a few local ISP DNS servers and swapped them in.

  • Now I could ping Baidu. I tried starting the service again, and it worked right away.

  • I spent a while reading up on /etc/resolv.conf—I understand what it does now, though I still don’t know why it broke ProFTPD like that.

  • Anyway, a weird solution.

Pretty much it.