Recent merges have "somewhat" fixed this issue, but only if upstart is not 
installed.
And @Robie - yes it was related to bug 1495853

Tested in Wily&Xenial containers with:
apt-get install openssh-server
apt-get install puppet
puppet resource --debug --param provider --param enable service ssh
puppet resource --debug --param provider service ssh ensure=stopped
puppet resource --debug --param provider service ssh enable=false
puppet resource --debug --param provider service ssh enable=true

Just one snippet of these how things now work:
puppet resource --debug --param provider service ssh enable=true
Debug: Runtime environment: puppet_version=3.7.2, ruby_version=2.1.5, 
run_mode=user, default_encoding=US-ASCII
Debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not 
exist
Debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not 
exist
Debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
Debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not 
exist
Debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not 
exist
Debug: Puppet::Type::Service::ProviderOpenrc: file /bin/rc-status does not exist
Debug: Puppet::Type::Service::ProviderUpstart: file /sbin/start does not exist
Debug: Loaded state in 0.00 seconds
Debug: Executing '/usr/sbin/service ssh status'
Debug: Executing '/bin/systemctl show -pSourcePath ssh'
Debug: Executing '/bin/systemctl is-enabled ssh'
Debug: Finishing transaction 27170800
Debug: Storing state
Debug: Stored state in 0.01 seconds
Debug: Executing '/usr/sbin/service ssh status'
Debug: Executing '/bin/systemctl show -pSourcePath ssh'
Debug: Executing '/bin/systemctl is-enabled ssh'
service { 'ssh':
  ensure   => 'running',
  enable   => 'true',
  provider => 'debian',
}

As pitti suggested it uses the service wrapper now.

To be 100% sure that we have no issue with an 14.04->16.04 upgrade path leaving 
stale files that might affect this I tested that as well.
One could nicely see that before the upgrade it was upstart
[...]
Debug: Executing '/sbin/status ssh'
[...]
  provider => 'upstart',

$ do-release-upgrade -d
+ Same puppet commands again

There things got interesting.
While still having the new puppet version it is now running into mentioned 
issues:
Debug: Executing '/sbin/status ssh'
Error: /Service[ssh]: Could not evaluate: Execution of '/sbin/status ssh' 
returned 1: status: Unable to connect to Upstart: Failed to connect to socket 
/com/ubuntu/upstart: Connection refused

The difference seems to be the existance of /sbin/start in the system that got 
upgraded 14.04 -> 16.04.
The clean 16.04 has:
Debug: Puppet::Type::Service::ProviderUpstart: file /sbin/start does not exist
But the upgraded system has upstart installed, and due to that runs into the 
issues.
Just having it installed does not mean it IS the current init system.

Removing upstart on the 14.04->16.04 upgraded system resolves the situation.
It detects it as provider => debian then and works.
Vice versa if you install the upstart package on the clean 16.04 it runs into 
the same issues.

So TL;DR
- puppets detection which provider to use seems to base on file checking
- newer puppet versions have fixes for systemd
- but upstart seems to have precedence - as soon as package upstart is 
installed it switches from provider 'debian' to 'upstart'
  Debug: Executing '/sbin/status ssh'
  Error: /Service[ssh]: Could not evaluate: Execution of '/sbin/status ssh' 
returned 1: status: Unable to connect to Upstart: Failed to connect to socket 
/com/ubuntu/upstart: Connection refused
- Root cause: /sbin/start being installed does not mean upstart is the one 
being used

Simplified Testcase:
in Xenial container
$ apt-get install openssh-server
$ apt-get install puppet
Switch between good/bad case by installing/removing "upstart"

GOOD CASE - these are working
  $ puppet resource --debug --param provider --param enable service ssh
  $ puppet resource --debug --param provider service ssh enable=true

BAD CASE - these are failing
  $ puppet resource --debug --param provider --param enable service ssh
  [...]
  Debug: Executing '/sbin/initctl list'
  Error: Could not run: #<IO:0x00000001efdd68>
  $ puppet resource --debug --param provider service ssh enable=true
  [...]
  Error: /Service[ssh]: Could not evaluate: Execution of '/sbin/status ssh' 
returned 1: status: Unable to connect to Upstart: Failed to connect to socket 
/com/ubuntu/upstart: Connection refused

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

Title:
  puppet uses upstart for service status checks in vivid

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

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

Reply via email to