Skip to content

systemd::user_service broken for puppet running in background #459

@traylenator

Description

@traylenator

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.24
  • Ruby: 2
  • Distribution: RHEL9
  • Module version: 7.0.0

How to reproduce (e.g Puppet code you use)

systemd::user_service { "gitlab-podman-auto-update.timer":
  ensure  => true,
  enable  => true,
  unit    => podman-auto-update.timer,                            
  user    => 'gitlab-runner',
}

Run puppet agent in background, i.e pkill -SIGUSR1 puppet and not puppet agent -t -v

What are you seeing

The service does not start, the type fails to check the status of the service assumes it is not running and then
fails to start it. ( In fact the service is running however that is some what immaterial if puppet can't detect that.

What behaviour did you expect instead

The service should be started and enabled enabled correctly.

Output log

Apr 29 19:38:46 cirunner01.example.ch puppet-agent[1816569]: (/Stage[main]/Hg_punch::Cirunners/Systemd::User_service[gitlab-runner-podman-auto-update.timer]/Exec[Start user service podman-auto-update.timer for user gitlab-runner]/returns) Failed to start transient service unit: Transport endpoint is not connected
Apr 29 19:38:46 cirunner01.example.ch puppet-agent[1816569]: '["systemd-run", "--pipe", "--wait", "--user", "--machine", "gitlab-runner@.host", "systemctl", "--user", "start", "podman-auto-update.timer"]' returned 1 instead of one of [0]
Apr 29 19:38:46 cirunner01.example.ch puppet-agent[1816569]: (/Stage[main]/Hg_punch::Cirunners/Systemd::User_service[gitlab-runner-podman-auto-update.timer]/Exec[Start user service podman-auto-update.timer for user gitlab-runner]/returns) change from 'notrun' to ['0'] failed: '["systemd-run", "--pipe", "--wait", "--user", "--machine", "gitlab-runner@.host", "systemctl", "--user", "start", "podman-auto-update.timer"]' returned 1 instead of one of [0] (corrective)

Note the error:

 Failed to start transient service unit: Transport endpoint is not connected

Any additional information you'd like to impart

Expanding the underlying exec it is:

systemd-run --pipe --wait --user --machine gitlab-runner@.host  systemctl --user   is-active podman-auto-update.timer                                                  

This command is fine from the cmd line:

# systemd-run --pipe --wait --user --machine gitlab-runner@.host  systemctl --user   is-active podman-auto-update.timer                                                  
Running as unit: run-u10229.service
active
Finished with result: success
Main processes terminated with: code=exited/status=0
Service runtime: 7ms
CPU time consumed: 6ms

Just will not run in background puppet exec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions