You are not logged in.

#1 2014-01-01 20:39:53

vibee
Member
Registered: 2013-06-15
Posts: 38

[Solved] vsftpd not starting on boot

Hi,

I have problems running vsftpd via systemd on boot.

What I did: Install vsftpd, configure it properly, enable and start vsftpd.service. It works fine, but it won't start on boot; I need to start it manually.

This is what systemctl status vsftpd sais:

$ systemctl status vsftpd.service 
vsftpd.service - vsftpd daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
   Active: failed (Result: exit-code) since Wed 2014-01-01 21:28:21 CET; 7s ago
  Process: 866 ExecStart=/usr/bin/vsftpd (code=exited, status=2)
 Main PID: 866 (code=exited, status=2)
   CGroup: /system.slice/vsftpd.service

However, starting it manually works fine and vsftpd is running then. I already read another topic, where a user had exactly the same problem. Unfortunately, that solution (adding network.target to service file) does not work for me. (topic: https://bbs.archlinux.org/viewtopic.php?pid=1251823)

This is what my vsftpd.service file looks like:

$ cat  /usr/lib/systemd/system/vsftpd.service 
[Unit]
Description=vsftpd daemon
Requires=network.target
After=network.target

[Service]
ExecStart=/usr/bin/vsftpd
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process

[Install]
WantedBy=multi-user.target

I recently added the Requires= field, it did not change anything. Further I tried adding NetworkManager.service and NetworkManager-wait-online.service, it did not change anything as well.  Any idea how I might fix that?

Last edited by vibee (2014-01-09 12:31:21)

Offline

#2 2014-01-01 20:54:08

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: [Solved] vsftpd not starting on boot

After boot, does the service show up in the output of systemctl at all? 
Anything interesting in the journal?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-01-02 08:32:37

vibee
Member
Registered: 2013-06-15
Posts: 38

Re: [Solved] vsftpd not starting on boot

Hm, I was not able to find related entries in journalctl. How can I check if the service shows up in the output of systemctl and what would it mean?

Offline

#4 2014-01-02 09:27:39

IncredibleLaser
Member
From: Germany, NRW
Registered: 2008-07-16
Posts: 158

Re: [Solved] vsftpd not starting on boot

Have you looked at your vsftpd log files yet?

Offline

#5 2014-01-02 09:32:26

vibee
Member
Registered: 2013-06-15
Posts: 38

Re: [Solved] vsftpd not starting on boot

It seems like the vsftpd log files do not contain startup information. Only information about connected users, transfered files and enteres promps are included.

Offline

#6 2014-01-02 15:56:20

vibee
Member
Registered: 2013-06-15
Posts: 38

Re: [Solved] vsftpd not starting on boot

After boot:

$ systemctl list-units
  vsftpd.service              loaded failed failed    vsftpd daemon
$ systemctl list-unit-files
  vsftpd-ssl.service                          disabled
  vsftpd-ssl@.service                         static  
  vsftpd.service                              enabled 
  vsftpd@.service                             static  

I am wondering that network.target is not shown when doing systct list-dependencies; vsftpd.service only depends on default.target and multi-user.target. Why is network.target not shown?

$ systemctl list-dependencies 
default.target
├─gdm.service
└─multi-user.target
  ├─avahi-daemon.service
  ├─cpupower.service
  ├─cronie.service
  ├─cups.path
  ├─dbus.service
  ├─dkms.service
  ├─hddtemp.service
  ├─httpd.service
  ├─iked.service
  ├─mysqld.service
  ├─NetworkManager-wait-online.service
  ├─NetworkManager.service
  ├─radicale.service
  ├─rpc-mountd.service
  ├─rpc-statd.service
  ├─smbd.service
  ├─sshd.service
  ├─svnserve.service
  ├─systemd-ask-password-wall.path
  ├─systemd-logind.service
  ├─systemd-user-sessions.service
  ├─verynice.service
  ├─vsftpd.service
  ├─basic.target
  │ ├─alsa-restore.service
  │ ├─alsa-state.service
  │ ├─paths.target
  │ ├─slices.target
  │ │ ├─-.slice
  │ │ └─system.slice
  │ ├─sockets.target
  │ │ ├─avahi-daemon.socket
  │ │ ├─cups.socket
  │ │ ├─dbus.socket
  │ │ ├─dmeventd.socket
  │ │ ├─lvmetad.socket
  │ │ ├─systemd-initctl.socket
  │ │ ├─systemd-journald.socket
  │ │ ├─systemd-shutdownd.socket
  │ │ ├─systemd-udevd-control.socket
  │ │ └─systemd-udevd-kernel.socket
  │ ├─sysinit.target
  │ │ ├─dev-hugepages.mount
  │ │ ├─dev-mqueue.mount
  │ │ ├─kmod-static-nodes.service
  │ │ ├─proc-sys-fs-binfmt_misc.automount
  │ │ ├─sys-fs-fuse-connections.mount
  │ │ ├─sys-kernel-config.mount
  │ │ ├─sys-kernel-debug.mount
  │ │ ├─systemd-ask-password-console.path
  │ │ ├─systemd-binfmt.service
  │ │ ├─systemd-journal-flush.service
  │ │ ├─systemd-journald.service
  │ │ ├─systemd-modules-load.service
  │ │ ├─systemd-random-seed.service
  │ │ ├─systemd-sysctl.service
  │ │ ├─systemd-tmpfiles-setup-dev.service
  │ │ ├─systemd-tmpfiles-setup.service
  │ │ ├─systemd-udev-trigger.service
  │ │ ├─systemd-udevd.service
  │ │ ├─systemd-update-utmp.service
  │ │ ├─systemd-vconsole-setup.service
  │ │ ├─cryptsetup.target
  │ │ ├─local-fs.target
  │ │ │ ├─-.mount
  │ │ │ ├─mnt-serverdisk.mount
  │ │ │ ├─mnt-windows.mount
  │ │ │ ├─systemd-remount-fs.service
  │ │ │ └─tmp.mount
  │ │ └─swap.target
  │ │   ├─dev-disk-by\x2did-ata\x2dST3000DM001\x2d1CH166_Z1F23A7C\x2dpart2.swap
  │ │   ├─dev-disk-by\x2did-wwn\x2d0x5000c5004f7babf3\x2dpart2.swap
  │ │   ├─dev-disk-by\x2dpartuuid-e8647b5a\x2de808\x2d41a8\x2d86e7\x2d353410f0a4bb.swap
  │ │   ├─dev-disk-by\x2duuid-3a4d745f\x2d7d88\x2d48ad\x2dba59\x2d261410fcbb8a.swap
  │ │   ├─dev-disk-by\x2duuid-3a4d745f\x2d7d88\x2d48ad\x2dba59\x2d261410fcbb8a.swap
  │ │   └─dev-sdb2.swap
  │ └─timers.target
  │   └─systemd-tmpfiles-clean.timer
  ├─getty.target
  │ └─getty@tty1.service
  └─remote-fs.target

And one more strange thing: If I want to start vsftpd manually by hitting systemctl start, vsftpd.service does not appear via auto-completion.

Last edited by vibee (2014-01-02 15:59:08)

Offline

#7 2014-01-04 14:30:10

vibee
Member
Registered: 2013-06-15
Posts: 38

Re: [Solved] vsftpd not starting on boot

Any other idea how I can determine why it doesn't work? How can I log error messages which might occur when vsftpd is started by systemd?

Offline

#8 2014-01-04 16:17:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] vsftpd not starting on boot

Do you get any output if you try to simply start the process from the command line?  Maybe there is a switch to make things verbose or put it in debug mode?  Unfortunately, I don't use vsftp at all, so I probably can't help mush more than this.  But that is the route I would take in debugging things.

Also, I see that there is a vsftpd.service and a vsftpd@.service (as well as the ssl ones).  Are you sure that you are using the right service to do this?

Offline

#9 2014-01-05 19:31:19

vibee
Member
Registered: 2013-06-15
Posts: 38

Re: [Solved] vsftpd not starting on boot

I was able to determine to cause of vsftpd startup problem.

This is part of my vsftpd.conf file:

pasv_addr_resolve=YES
pasv_address=xxx.dyndns.com

I need to add the pasv_adress as a dyn ip so that passive mode works fine via WAN, as I have a dynamic WAN IP adress which changes each 24 hours.

The problem is that if WAN is not ready and the url can not be resolved, vsftpd fails starting. It also fails when I disable internet access and try to manually start the service.

So what I need is to ensure that LAN is up and WAN access is availible (my server is connected to a router which is always connected to the internet). Any idea if there is a way to do so by adding an After= statement?

Last edited by vibee (2014-01-05 19:31:58)

Offline

#10 2014-01-05 20:40:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] vsftpd not starting on boot

If you continue to use networkmanager, then you can probably ensure an IP is present by using After=NetworkManager-wait-online.service.  But otherwise, the other network management solutions report reaching the network.target only after the service itself has been started.  There is the exception of the dhcpcd@.service, which does not complete until the IP is resolved. 

Programs these days tend to try to handle this better.  That is, if network connectivity is intermittent, they are able to gracefully deal with this situation.  So with a service that is not able to handle this well, the only real solutions (other than NetworkManager-wait-online.target) is to use a hack of some kind.  A while back, there was someone asking about this, and wrote up a service that would simply run a script that loops ping until it succeeds. So you could have the vsftp.service ordered after that.

Alternatively, you could use a systemd.timer to have this service started at a specific point in time after the boot process has completed.  As long as you have a rough idea of how long it typically takes to get an IP, this would probably be pretty reliable.

Offline

#11 2014-01-09 12:30:36

vibee
Member
Registered: 2013-06-15
Posts: 38

Re: [Solved] vsftpd not starting on boot

I finally got it fixed. There was no chance running vsftpd on startup using NetworkManager; even NetworkManager-wait-online.service did not work.

It's working now using dhcpcd instead of NetworkManager. I disabled NetworkManager, enabled dhcpcd and added After=dhcpcd@enp2s0.service. Hooray, vsftpd does not fail running on boot any more. Thanks for the hint!

Offline

#12 2014-01-10 01:50:23

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] vsftpd not starting on boot

Yeah, honestly, if you are going to be using wired ethernet anyway, I see no point in using a full network management utility anyway.  I think the only advantage is that the startup is faster because dhcpcd@.service actually waits until it has an address before reporting completion.  But in this case, that is exactly what you want.

Offline

Board footer

Powered by FluxBB