1

Following this blog post about administering a RPi with AWS Systems Manager:

https://aws.amazon.com/blogs/mt/manage-raspberry-pi-devices-using-aws-systems-manager/

...I have installed and enabled the service with systemd:

$ sudo systemctl enable amazon-ssm-agent.service
$ systemctl status amazon-ssm-agent.service
● amazon-ssm-agent.service - amazon-ssm-agent
   Loaded: loaded (/lib/systemd/system/amazon-ssm-agent.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
$ sudo systemctl start amazon-ssm-agent.service
$ systemctl status amazon-ssm-agent.service
● amazon-ssm-agent.service - amazon-ssm-agent
   Loaded: loaded (/lib/systemd/system/amazon-ssm-agent.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-05-07 14:56:49 BST; 3s ago
 Main PID: 3357 (amazon-ssm-agen)
   CGroup: /system.slice/amazon-ssm-agent.service
           └─3357 /usr/bin/amazon-ssm-agent

May 07 14:56:49 raspberrypi systemd[1]: Started amazon-ssm-agent.
May 07 14:56:49 raspberrypi amazon-ssm-agent[3357]: Initializing new seelog logger
May 07 14:56:49 raspberrypi amazon-ssm-agent[3357]: New Seelog Logger Creation Complete

The service starts, runs, works (in that I can remotely admin the box) - but when I come to reboot the RPi, the service does not get started on startup- even though it's enabled:

$ systemctl status amazon-ssm-agent.service
● amazon-ssm-agent.service - amazon-ssm-agent
   Loaded: loaded (/lib/systemd/system/amazon-ssm-agent.service; enabled; vendor preset: enabled)
   Active: inactive (dead)

This is the systemd definition (defined by the Amazon .deb package install):

$ cat /lib/systemd/system/amazon-ssm-agent.service
[Unit]
Description=amazon-ssm-agent
After=network-online.target

[Service]
Type=simple
WorkingDirectory=/usr/bin/
ExecStart=/usr/bin/amazon-ssm-agent
KillMode=process
Restart=on-failure
RestartSec=15min

[Install]
WantedBy=network-online.target

Note that network-online.target stuff - that target doesn't seem to be getting activated, even though ethernet is active and works:

$ systemctl status network-online.target
● network-online.target - Network is Online
   Loaded: loaded (/lib/systemd/system/network-online.target; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd.special(7)
           http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

What's the 'right' way to get this service running on startup?

System information

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"

I also have a PCF8523 RTC installed so that the RPi always has the right time.

1

I have only a vague idea. The network-online.target is a static service. That means it does not start by itself on boot up. It must be pulled in with Wants=. This is not the case within amazon-ssm-agent.service.

In man systemd.special you can find some information to network-online.target:

Units that strictly require a configured network connection should pull in network-online.target (via a Wants= type dependency) and order themselves after it. This target unit is intended to pull in a service that delays further execution until the network is sufficiently set up.
[..]
All mount units for remote network file systems automatically pull in this unit, and order themselves after it. Note that networking daemons that simply provide functionality to other hosts generally do not need to pull this in.

I don't know something about your installation so it may be possible that network-online.target isn't pulled in before amazon-ssm-agent.service. I would test with a drop in file:

rpi ~$ sudo systemctl edit amazon-ssm-agent.service

In the empty editor insert these statements, save them and quit the editor:

[Unit]
Wants=network-online.target

In addition maybe you will find some more information with:

rpi ~$ journalctl --unit=network-online.target
rpi ~$ journalctl --unit=amazon-ssm-agent.service
0

If it is the same problem I am having, the service is actually starting, but getting a termination signal and shutting itself down shortly after. Like you, after starting the service manually it works fine.

Check the log file at /var/log/amazon/ssm/amazon-ssm-agent.log

The problem starts at: "INFO Got signal:terminated value:0x633ba4" and eventually outputs: "INFO Bye."

Unfortunately I have not found a solution yet, but maybe this additional info will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.