Jira (PUP-10016) Systemd provider is not correctly selected as the service provider if puppet is run as non root

27 views
Skip to first unread message

Gheorghe Popescu (JIRA)

unread,
Sep 10, 2019, 9:17:03 AM9/10/19
to puppe...@googlegroups.com
Gheorghe Popescu created an issue
 
Puppet / Bug PUP-10016
Systemd provider is not correctly selected as the service provider if puppet is run as non root
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2019/09/10 6:16 AM
Priority: Normal Normal
Reporter: Gheorghe Popescu

Puppet Version: 6.8.1

It seems that this change breaks a few things when Puppet is not being run as root, for example during spec tests (i.e. pdk test unit).

At least under Ubuntu 16.04 and 18.04 the file /proc/1/exe is not accessible by regular users, so Puppet::FileSystem.exist?('/proc/1/exe') returns false and Puppet::FileSystem.readlink('/proc/1/exe').include?('systemd') fails with Errno::EACCES. ls also fails, obviously:

 
$ ls /proc/1/exe
ls: cannot read symbolic link '/proc/1/exe': Permission denied
lrwxrwxrwx 1 root root 0 Sep  7 00:13 /proc/1/exe
This has interesting implications in that now Puppet no longer recognizes that systemd is the correct service provider for recent Debian and Ubuntu releases. Thus spec tests for services fail with cryptic error messages like this:

$ pdk test unit
...
failed: rspec: ./spec/classes/service_spec.rb:9: Could not find the daemon directory (tested [/etc/sv,/var/lib/service])

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Gheorghe Popescu (JIRA)

unread,
Sep 10, 2019, 9:20:03 AM9/10/19
to puppe...@googlegroups.com

Gheorghe Popescu (JIRA)

unread,
Sep 10, 2019, 9:27:02 AM9/10/19
to puppe...@googlegroups.com

Gheorghe Popescu (JIRA)

unread,
Sep 10, 2019, 9:27:02 AM9/10/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Sep 10, 2019, 1:33:03 PM9/10/19
to puppe...@googlegroups.com

Nirupama Mantha (JIRA)

unread,
Sep 10, 2019, 5:33:03 PM9/10/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Sep 10, 2019, 5:58:05 PM9/10/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Sep 10, 2019, 6:00:03 PM9/10/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Sep 10, 2019, 6:01:03 PM9/10/19
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10016

Since PUP-7312 was never released in 5.5-6.4, then this "fix" only applies to 6.9.0

Josh Cooper (JIRA)

unread,
Sep 10, 2019, 6:04:03 PM9/10/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes Summary: PUP-7312 (released in 6.8.0) introduced a regression that prevented puppet's systemd provider from working when running as non-root. For example, the command "puppet resource service" did not include systemd services.
Release Notes: Bug Fix

Josh Cooper (JIRA)

unread,
Sep 11, 2019, 1:27:03 AM9/11/19
to puppe...@googlegroups.com

Jean Bond (JIRA)

unread,
Sep 13, 2019, 3:28:03 PM9/13/19
to puppe...@googlegroups.com

Andreas Ntaflos (JIRA)

unread,
Sep 18, 2019, 1:48:05 PM9/18/19
to puppe...@googlegroups.com
Andreas Ntaflos commented on Bug PUP-10016
 
Re: Systemd provider is not correctly selected as the service provider if puppet is run as non root

Gheorghe Popescu Thank you for creating a ticket for this!

Since commenting in https://tickets.puppetlabs.com/browse/PUP-7312 I have not been able to reliably reproduce the issue I was having using Vagrant. I have created a minimal Puppet module for this at https://github.com/antaflos/puppet-foobar. On our in-house built Ubuntu 18.04 Vagrant boxes the spec tests would reliably fail with the aforementioned error message, but on the official ubuntu/bionic64 boxes (https://app.vagrantup.com/ubuntu/boxes/bionic64) the spec tests would reliably pass. I have no idea why and still cannot figure it out. Drives me crazy

I am glad this issue got attention and a fix so quickly! Thanks to all involved!

Not that it matters much now, and just out of curiosity: couldn't Puppet also just look at /sbin/init, much like it looked at /proc/1/exe and read the symlink target? This works for regular users, not just root. As in:

confine :true => Puppet::FileSystem.exist?('/sbin/init') && Puppet::FileSystem.readlink('/sbin/init').include?('systemd')

Maybe in addition to looking at /proc/1/exe, i.e.:

confine :true => (Puppet::FileSystem.exist?('/proc/1/exe') && Puppet::FileSystem.readlink('/proc/1/exe').include?('systemd')) || 
    (Puppet::FileSystem.exist?('/sbin/init') && Puppet::FileSystem.readlink('/sbin/init').include?('systemd'))

Mihai Buzgau (JIRA)

unread,
Sep 26, 2019, 6:08:02 AM9/26/19
to puppe...@googlegroups.com

Jean Bond (JIRA)

unread,
Sep 27, 2019, 1:08:03 PM9/27/19
to puppe...@googlegroups.com

Jean Bond (JIRA)

unread,
Sep 27, 2019, 1:08:03 PM9/27/19
to puppe...@googlegroups.com
Jean Bond commented on Bug PUP-10016
 
Re: Systemd provider is not correctly selected as the service provider if puppet is run as non root

This ticket is marked with 6.9 and 6.10; did something new happen to this ticket for 6.10?

George Mrejea (JIRA)

unread,
Oct 3, 2019, 6:46:03 AM10/3/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Oct 3, 2019, 5:16:03 PM10/3/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 6.10.0
Fix Version/s: PUP 6.4.4
Fix Version/s: PUP 5.5.17

Christoph Maser (JIRA)

unread,
Oct 28, 2019, 3:45:03 AM10/28/19
to puppe...@googlegroups.com
Christoph Maser commented on Bug PUP-10016
 
Re: Systemd provider is not correctly selected as the service provider if puppet is run as non root

IMHO this is not sufficient for docker testing environments, there PID1 is not systemd, systemd might not even be installed, which is totally acceptable for the catalogue tests.

Reply all
Reply to author
Forward
0 new messages