Public bug reported:

The current unit section looks like this:

    [Unit]
    Description=vsftpd FTP server
    After=network.target

So it means the network should exist, but after network.target, it may
not be up and may not have been assigned IP addresses. What works much
better is:

    [Unit]
    Description=vsftpd FTP server
    Wants=network-online.target
    After=network-online.target

This change means:

1. the network is up
2. at least one interface has an IP address (apparently we cannot force all 
interfaces to be ready)
3. the Wants= also ensures that the network-only.target is actually started (in 
case vsftp.service is the only service that needs the network)

In my case, I have a specific IP address because I want FTP only on my
LAN:

    listen=YES
    listen_port=1234
    listen_address=192.168.203.1

The failure is the 192.168.203.1. The corresponding interface is not up
yet so the bind() fails (at least I would imagine that's the point of
failure--I did not confirm that).

There is another case on stackoverflow.com:

https://unix.stackexchange.com/a/729419/57773

That one uses an address for the passive setup:

    pasv_addr_resolve=YES
    pasv_address=xxx.yyy.org

which also fails at boot time because the DNS is not yet ready. In that
case, though, maybe it is necessary to start After= the resolver. That
would probably be this:

    After=network-online.target nss-lookup.target

So the final change would be:

    [Unit]
    Description=vsftpd FTP server
    Wants=network-online.target nss-lookup.target
    After=network-online.target nss-lookup.target

Version: vsftpd_3.0.5-0ubuntu3.1.debian.tar.xz

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.2 LTS
Release:        24.04
Codename:       noble

** Affects: vsftpd (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2107406

Title:
  vsftpd does not start at boot time when some options require IP or DNS
  support

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/vsftpd/+bug/2107406/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to