Trying to get puppet service running on Raspberry PI (Buster)

Problem:
I’ve installed puppet per the steps in the link below but have not been successful at getting the service to run. I can run the agent manually, or get it to stay running by calling puppet service --no-daemonize , but i’ve not been successful at getting the service to load automatically.

I’ve tried to force it to run using systemd, however it really seems to want to use init

root@octopi:~# puppet resource service puppet enable=true ensure=running provider=systemd
Warning: Found multiple default providers for service: init, systemd; using init
Warning: Found multiple default providers for service: init, systemd; using init
Error: /Service[puppet]: Could not evaluate: Could not find init script for ‘puppet’
Error: Could not run: Could not find init script for ‘puppet’

I tried transplanting a init.d script for puppet 5.5 but it seems to just call “puppet agent”, and attempts to add --no-daemonize haven’t really been sucesfull.

start_puppet_agent() {
start-stop-daemon --start --quiet --pidfile $PIDFILE
–startas $DAEMON – $NAME $DAEMON_OPTS
}

Expected outcome:

The puppet agent automatically starts at boot .

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

Have you tried directly using systemctl instead of the puppet resource command?

It looks like the resource command is doing something wrong by ignoring the provider setting, but the service file for puppet looks good, so I would think systemctl start puppet.service && systemctl enable puppet.service should work fine.

1 Like

Looking at the instructions, this looks wrong:

cat << EOF > /etc/systemd/system/multi-user.target.wants/puppet.service

By placing it directly in multi-user.target.wants you break enable/disable functionality.

I’d expect it to be /etc/systemd/system/multi-user.target.wants/puppet.service. Then you use:

systemctl daemon-reload

(which I also think is missing in the current instructions)

Then use systemctl enable puppet.service to enable it at boot. You can also use systemctl enable --now puppet.service to start it immediately (instead of also calling systemctl start).

The second path should be /etc/systemd/system/puppet.service (good catch, ignoring the copy&paste error) and the systemctl daemon-reload is missing but it should only be necessary with later changes and work fine when a unit file is placed there for the first time.

1 Like

Did you mean for it to be up a level and placed in /etc/systemd/puppet as dirk mentioned?

after changing the code to
cat << EOF > /etc/systemd/system/puppet.service

and running
systemctl enable --now puppet.service

Things appear to be good now and the service stays actively running and automatically did a report.

Thank you very much!

1 Like

Would be that kind and convert the whole procedure to a tutorial in our tutorial section? I have a feeing more people woupd like to do the same :slight_smile:

Sure, I have a secondary RPI I could use for that purpose, I should hopefully have some time to get to that this weekend.

1 Like

You ask and receive,

3 Likes