Services start/stop multiple times during boot

Bug #1158708 reported by Thilo Uttendorfer
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
New
Medium
Unassigned

Bug Description

I'm running a fresh installation of Ubuntu 12.04.2 LTS with all updates from security/updates applied. While everything works as expected after boot, I see that several services are started and stopped multiple times. After adding "--verbose" to the kernel command line in grub, I see the following in /var/log/dmesg (grep on "ssh", but other services look similar):

[ 15.448785] init: ssh goal changed from stop to start
[ 15.448977] init: ssh state changed from waiting to starting
[ 15.722522] init: ssh state changed from starting to pre-start
[ 15.740479] init: ssh pre-start process (412)
[ 15.892560] init: ssh pre-start process (412) exited normally
[ 15.892697] init: ssh state changed from pre-start to spawned
[ 15.900573] init: ssh main process (427)
[ 15.900877] init: ssh state changed from spawned to post-start
[ 15.912513] init: ssh state changed from post-start to running
[ 18.292483] init: ssh goal changed from start to stop
[ 18.292723] init: ssh state changed from running to pre-stop
[ 18.292826] init: ssh state changed from pre-stop to stopping
[ 18.293129] init: ssh state changed from stopping to killed
[ 18.293236] init: Sending TERM signal to ssh main process (427)
[ 18.296505] init: ssh main process (427) exited normally
[ 18.296683] init: ssh state changed from killed to post-stop
[ 18.297359] init: ssh state changed from post-stop to waiting
[ 18.344245] init: ssh goal changed from stop to start
[ 18.344378] init: ssh state changed from waiting to starting
[ 18.344801] init: ssh state changed from starting to pre-start
[ 18.356479] init: ssh pre-start process (593)
[ 18.414658] init: ssh pre-start process (593) exited normally
[ 18.415023] init: ssh state changed from pre-start to spawned
[ 18.424710] init: ssh main process (596)
[ 18.424886] init: ssh state changed from spawned to post-start
[ 18.429089] init: ssh state changed from post-start to running

You can see that SSH is started 4 times. This seems unnecessary and looks like a bug to me. I see this behaviour on other Ubuntu 12.04 systems as well.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: upstart 1.5-0ubuntu7.2
ProcVersionSignature: Ubuntu 3.5.0-26.42~precise1-generic 3.5.7.6
Uname: Linux 3.5.0-26-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.1
Architecture: amd64
Date: Fri Mar 22 11:20:16 2013
InstallationMedia: Ubuntu-Server 12.04.2 LTS "Precise Pangolin" - Release amd64 (20130214)
MarkForUpload: True
ProcEnviron:
 SHELL=/bin/bash
 TERM=xterm
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
SourcePackage: upstart
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Thilo Uttendorfer (t-lo) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu):
status: New → Confirmed
Revision history for this message
Steve Langasek (vorlon) wrote :

This only shows the ssh service stopping and restarting once during boot.

[ 15.912513] init: ssh state changed from post-start to running
[ 18.292483] init: ssh goal changed from start to stop

So roughly 2 seconds after ssh starts, something else stops it. But this "something else" is not upstart. What other services do you see this happening for? Does it happen on every boot?

I've never seen any behavior like this on any system; I think there must be something particular to your environment that's triggering these service restarts.

Changed in upstart (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Thilo Uttendorfer (t-lo) wrote :

Hi Steve,

thanks for having a look at this issue. I just did two tests:
1) Ubuntu 12.04 Desktop with NetworkManager: Everything works as expected, ssh starts only once
2) Ubuntu 12.04.2 Server without NetworkManager, /etc/network/interfaces only configures lo and eth0 with dhcp (server is a fresh minimal installation, just installed openssh-server additionally) : Similar behavior as in my original report.

I'll attach /var/log/dmesg with "--verbose" enabled.

Revision history for this message
Steve Langasek (vorlon) wrote :

Ok, that explains. The openssh-server package ships /etc/network/if-up.d/openssh-server, which exists precisely to restart the service when a network interface comes up. And NetworkManager does not use the normal ADDRFAM==inet[6] convention, so this isn't triggered on the desktop.

[ 10.978364] init: Connection from private client
[ 10.982980] init: ssh goal changed from start to stop

I don't know why this ssh service restart is needed/wanted when a network interface comes up. It may be vestigial. Reassigning to the openssh package.

Whatever the right answer is here, the behavior should probably be consistent between NetworkManager and !NetworkManager uses.

affects: upstart (Ubuntu) → openssh (Ubuntu)
Changed in openssh (Ubuntu):
status: Incomplete → New
Robie Basak (racb)
Changed in openssh (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.