[systemd-devel] bamboo agent does not start from systemd

Silvio Knizek killermoehre at gmx.net
Wed Jun 16 15:17:18 UTC 2021


Am Mittwoch, dem 16.06.2021 um 10:00 -0400 schrieb vadud3 at gmail.com:
> Bamboo agent install provides bamboo-agent.sh as part of the install.
> It starts the bamboo agent. It works fine provided there is no service
> unit file defined. If I define the service unit file it does not start
> with systemctl. It also fails to start even when executing
> bamboo-agent.sh start as bamboo. This seems very odd. Here are some
> details.
>
> # cat /etc/systemd/system/bamboo-agent.service
> [Unit]
> Description=Atlassian Bamboo Agent
> After=syslog.target network.target
> [Service]
> Type=forking
> User=bamboo
> Group=bamboo
> ExecStart=/bin/bash /opt/atlassian/remote-agent/bin/bamboo-agent.sh start
> ExecStop=/bin/bash /opt/atlassian/remote-agent/bin/bamboo-agent.sh stop
> [Install]
> WantedBy=multi-user.target
>
> [root at bamboo remote-agent]# systemctl start bamboo-agent
> Job for bamboo-agent.service failed because the control process exited
> with error code. See "systemctl status bamboo-agent.service" and
> "journalctl -xe" for details.
>
> [root at bamboo remote-agent]# systemctl status -l bamboo-agent
> ● bamboo-agent.service - Atlassian Bamboo Agent
> Loaded: loaded (/etc/systemd/system/bamboo-agent.service; disabled;
> vendor preset: disabled)
> Active: failed (Result: exit-code) since Tue 2021-06-15 18:59:58 UTC; 12s ago
> Process: 5680 ExecStart=/bin/bash
> /opt/atlassian/remote-agent/bin/bamboo-agent.sh start (code=exited,
> status=1/FAILURE)
> Jun 15 18:59:57 bamboo.example.org systemd[1]: Starting Atlassian
> Bamboo Agent...
> Jun 15 18:59:57 bamboo.example.org bash[5680]: Starting Bamboo Agent
> with systemd...
> Jun 15 18:59:58 bamboo.example.org bash[5680]: Failed to start
> bamboo-agent.service: Interactive authentication required.
> Jun 15 18:59:58 bamboo.example.org bash[5680]: See system logs and
> 'systemctl status bamboo-agent.service' for details.
> Jun 15 18:59:58 bamboo.example.org systemd[1]: bamboo-agent.service:
> control process exited, code=exited status=1
> Jun 15 18:59:58 bamboo.example.org systemd[1]: Failed to start
> Atlassian Bamboo Agent.
> Jun 15 18:59:58 bamboo.example.org systemd[1]: Unit
> bamboo-agent.service entered failed state.
> Jun 15 18:59:58 bamboo.example.org systemd[1]: bamboo-agent.service failed.
>
> As you can see I cannot start manually either when the service unit exist
>
> [root at bamboo remote-agent]# su - bamboo
> [bamboo at bamboo ~]$ /opt/atlassian/remote-agent/bin/bamboo-agent.sh start
> Starting Bamboo Agent with systemd...
> ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
> Authentication is required to manage system services or units.
> Authenticating as: Cloud User (ec2-user)
> Password:
>
> If I remove the service unit I can manually start.
>
> [root at bamboo remote-agent]# mv /etc/systemd/system/bamboo-agent.service /tmp
> [root at bamboo remote-agent]# systemctl daemon-reload
> [root at bamboo remote-agent]# su - bamboo
> [bamboo at bamboo ~]$ /opt/atlassian/remote-agent/bin/bamboo-agent.sh start
> Starting Bamboo Agent...
> Waiting for Bamboo
> Agent...........................................................................................................................
> running: PID:6449
> [bamboo at bamboo ~]$
>
> It seems to me the bamboo-agent.sh that comes with installation has
> bug in it. I am attaching bamboo-agent.sh file here as well.
>
> Any suggestion how to get it running from systemd?
>
> Thanks,
> Asif
Hi Asif,

the wrapper script tries to do what systemd already does. Trash it and
write your own .service. Especially the »su« in such scripts breaks
things, because it creates its own login session via PAM.

Check all the wrapper scripts called and how they interact, so you
actually get to the plain java call.

The file you attached actually has systemd support. Try
»/opt/atlassian/remote-agent/bin/bamboo-agent.sh install«

HTH
Silvio





More information about the systemd-devel mailing list