fails if network is not yet configured at runlevel 2 (i.e. no ifupdown-managed network connection)

Bug #972845 reported by Jon Smirl
66
This bug affects 13 people
Affects Status Importance Assigned to Milestone
tftp-hpa (Ubuntu)
Medium
Unassigned

Bug Description

I had this service running under oneiric. After upgrade to precise it didn't start. Trying to start it manually:

jonsmirl@terra:/etc/init.d$ service tftpd-hpa start
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.94" (uid=1000 pid=6233 comm="start tftpd-hpa ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

I then removed the package and reinstalled it. And the service now starts and works ok.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: tftpd-hpa 5.2-1ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-21.34-generic 3.2.13
Uname: Linux 3.2.0-21-generic x86_64
ApportVersion: 2.0-0ubuntu3
Architecture: amd64
Date: Tue Apr 3 16:51:10 2012
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
SourcePackage: tftp-hpa
UpgradeStatus: Upgraded to precise on 2012-04-02 (1 days ago)

Revision history for this message
Jon Smirl (jonsmirl) wrote :
Revision history for this message
Jon Smirl (jonsmirl) wrote :

This service is not starting correctly at boot every time. A restart will fix it.

jonsmirl@terra:~$ sudo service tftpd-hpa restart
tftpd-hpa stop/waiting
tftpd-hpa start/running, process 4178
jonsmirl@terra:~$

This is probably the problem I experienced on upgrade.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hi Jon, thanks for taking the time to file this report.

Can you look for a /var/log/upstart/tftpd-hpa.log file, and attach it? Also examine the file /etc/default/tftpd-hpa and be sure that there is a setting for TFTP_DIRECTORY, and that the directory is on a filesystem that will be mounted automatically (so, not one that is marked as 'nowait' in /etc/fstab).

Changed in tftp-hpa (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Jon Smirl (jonsmirl) wrote :

No log file.

jonsmirl@terra:/etc/default$ cat tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /tftpboot"

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
jonsmirl@terra:/etc/default$

Is this config file right? This machine has been in used for a number of years and has gone through many Ubuntu upgrades. There are two different directories, but it uses /srv/tftp.

The serving directory is on my main root volume.
The files in it are symlinks onto a raid volume which is mounted at boot.

jonsmirl@terra:/etc/default$ ls /srv/tftp -l
total 0
lrwxrwxrwx 1 root root 51 Apr 3 16:15 ea3131.dtb -> /home/apps/florida/lpc31xx/arch/arm/boot/ea3131.dtb
lrwxrwxrwx 1 root root 47 Apr 3 16:16 uImage -> /home/apps/florida/lpc31xx/arch/arm/boot/uImage
jonsmirl@terra:/etc/default$

/dev/md2p1 on /home type ext4 (rw,noatime,nodiratime)

It must have come up and exited..... No log file and I also greped in the log directory. System thinks it is running but it really isn't. No pid file either.

jonsmirl@terra:/etc/default$ sudo service tftpd-hpa start
start: Job is already running: tftpd-hpa
jonsmirl@terra:/etc/default$

 service --status-all
 [ ? ] tftpd-hpa

jonsmirl@terra:/etc/init.d$ sudo service tftpd-hpa stop
tftpd-hpa stop/waiting
jonsmirl@terra:/etc/init.d$ sudo service tftpd-hpa start
tftpd-hpa start/running, process 11479
jonsmirl@terra:/etc/init.d$

Maybe confusing between starting as a process vs inetd? I don't care which way it runs.

Revision history for this message
Jon Smirl (jonsmirl) wrote :

I switched over to the default config file and get the same behavior.

jonsmirl@terra:/etc/default$ cat tftpd-hpa
# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
jonsmirl@terra:/etc/default$

Revision history for this message
Nikolay Shopik (nshopik) wrote :

Actuall problem is tftpd-hpa trying start before any interface have IP address, so if you look closely at syslog you will find such messages. "cannot resolve local IPv4 bind address: 0.0.0.0, Name or service not known".
So only workaround so far is change /etc/init/tftpd-hpa.conf to add sleep 10 before it start, but for me this breake upstart script somewhat thus it hang durring shutdown.

Revision history for this message
Jon Smirl (jonsmirl) wrote :

Nikolay has spotted the problem, same here...
terra in.tftpd[1397]: cannot resolve local IPv4 bind address: 0.0.0.0, Name or service not known

I though upstart was supposed to have a dependencies system that prevents things like this.

Revision history for this message
Nikolay Shopik (nshopik) wrote :

There some works been done before bug 522509, maybe related

Changed in tftp-hpa (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Eric Biggers (ebiggers3) wrote :

I am experiencing this problem in Ubuntu 12.04 Desktop (package: tftpd-5.2-1ubuntu1). The tftpd daemon does not start when the computer starts up, even though the tftpd-hpa job starts. As far as I can tell, the problem is that the tftpd service is starting before the network is properly configured. The problem seemed to go away when I changed the line

start on runlevel [2345]

in /etc/init/tftpd-hpa.conf to

start on (local-filesystems and net-device-up IFACE!=lo)

However, I am not an expert with Upstart and this may not necessarily be the best way to fix the problem.

Here is part of the system log. Note: there are 2 ethernet interfaces on the computer, and NetworkManager is being used:

Sep 18 11:06:31 server NetworkManager[952]: <info> (eth1): now managed
Sep 18 11:06:31 server NetworkManager[952]: <info> (eth1): device state change: unmanaged -> unavailable (
reason 'managed') [10 20 2]
Sep 18 11:06:31 server NetworkManager[952]: <info> (eth1): bringing up device.
Sep 18 11:06:31 server kernel: [ 19.320069] e1000e 0000:00:19.0: irq 49 for MSI/MSI-X
Sep 18 11:06:31 server kernel: [ 19.320257] ADDRCONF(NETDEV_UP): eth0: link is not ready
Sep 18 11:06:31 server kernel: [ 19.320555] ADDRCONF(NETDEV_UP): eth0: link is not ready
Sep 18 11:06:31 server acpid: starting up with proc fs
Sep 18 11:06:31 server cron[1063]: (CRON) INFO (pidfile fd = 3)
Sep 18 11:06:31 server acpid: 35 rules loaded
Sep 18 11:06:31 server acpid: waiting for events: event logging is off
Sep 18 11:06:31 server NetworkManager[952]: <info> (eth1): preparing device.
Sep 18 11:06:31 server NetworkManager[952]: <info> (eth1): deactivating device (reason 'managed') [2]
Sep 18 11:06:31 server kernel: [ 19.337830] ADDRCONF(NETDEV_UP): eth1: link is not ready
Sep 18 11:06:31 server kernel: [ 19.338129] ADDRCONF(NETDEV_UP): eth1: link is not ready
Sep 18 11:06:31 server in.tftpd[1065]: cannot resolve local IPv4 bind address: 0.0.0.0, Name or service no
t known
Sep 18 11:06:31 server kernel: [ 19.343687] init: tftpd-hpa main process (1065) terminated with status 6
6
Sep 18 11:06:31 server kernel: [ 19.343706] init: tftpd-hpa main process ended, respawning

Revision history for this message
Jon Smirl (jonsmirl) wrote :

Eric's fix works for me.

Steve Langasek (vorlon)
summary: - after upgrade to precise, service did not start
+ fails if network is not yet configured at runlevel 2 (i.e. no ifupdown-
+ managed network connection)
Revision history for this message
Kastor Stein (kk-ss) wrote :

Still tricky 14.04 LTS and upstart because the tftp...-upstart.conf contains some 'sleep 10' which confuses upstart's PID management (https://bugs.launchpad.net/upstart/+bug/406397).

http://upstart.ubuntu.com/cookbook/#start-on with suggested 'start on (local-filesystems and net-device-up IFACE!=lo)' in /etc/init/tftp...conf and no 'sleep 10' works.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers