ProFTPD Won't Start: From ServerType to a Surprise DNS Fix
Original Chinese title: Proftpd无法启动
The Problem
-
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! -
The error message was pretty clear, so surely someone before me had already hit this snag.
Searching the Error Code on Baidu
-
First, I tried the hostname-to-IP resolution mismatch fix, updating
proftpd.confand/etc/hosts. -
That immediately led to a second error:
Proftpd socket operation on non-socket -
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
confand sure enough, it was set toinetdinstead ofstandalone. -
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
pingagainst 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
DNSwas set to Google’s, even though the server is in China. So I found a few local ISPDNSservers and swapped them in. -
Now I could
pingBaidu. 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.
问题
-
下午的时候突然发现一个服务器上FTP没办法使用了。连接时提示
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! -
错误还是看的很清楚的嘛,肯定有前辈踩过的坑。
大百度输入错误的代码
-
先实验了主机名和IP解析没有对应这个办法。修改了
proftpd.confand/etc/hosts。 -
然后开始了第二个错误。
Proftpd socket operation on non-socket -
大百度前三页都没有这个错误。wtf
google一下
-
Proftpd error: fatal: Socket operation on non-socket按照这篇blog说问题出在
ServerType -
查看了一下自己的
conf确实模式也是inetd。而不是standalone -
官方文档确实也说道这一点
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 -
然后倒是不报错了,但是启动之后什么反应都没有了。
ps aux|grep proftpd hostname -f -
确认已经没有进程,并且已经确认已经bind了
对外IP.lsof -i:21 -
看到inetd 还在,就尝试重启inetd服务。
/usr/sbin/proftpd -
仍旧没有任何反应。
-
查日志
vi /var/log/proftpd.log 没有任何记录。 -
基本束手无策
然后突然间
-
尝试在服务器上
ping了百度。结果发现不同。vi /etc/resolv.conf # # search xxx.com nameserver 8.8.8.8 -
DNS竟然是google的。服务器在国内。然后找了几个运行商的DNS换了一下。 -
能
ping百度。然后尝试着启动下服务,结果就好了。 -
/etc/resolv.conf看了半天,也只知道它的用处,但是还是不知道为啥。
-
总之,一个奇怪的solution