1

Running up to date Arch Linux ARMv7 (RaspPi 3). I have two systemd service units which I have created. I want foo to start first and then bar. foo starts on boot and bar does not. However bar will start manually from a shell prompt. Here is a copy of the bar unit file:

[Unit]
Requires=foo.service
After=foo.service

[Service]
Type=simple
ExecStart=/usr/bin/setsid /usr/bin/bar >/dev/null 2>&1 < /dev/null
TimeoutSec=0
RemainAfterExit=Yes

[Install]
WantedBy=getty.target

However if I put a pound symbol in front of [Unit] like so:

#[Unit]

Then bar starts at boot in the right order (after foo).

This behaviour and commenting out of the [Unit] line doesn't seem to make sense or fit in with the documentation I can find. So I'm just wondering why it makes the unit start at boot?!

5
  • Someone has downvoted the question... please comment to tell me what I did wrong? I have spend a lot of time going through documentation to find an answer and can't. Commented Dec 14, 2016 at 9:34
  • 1
    Are the four lines above all of the service file? Commented Dec 14, 2016 at 10:59
  • @MariusMatutiae No, sorry - added the whole file now Commented Dec 14, 2016 at 11:18
  • It's circular: you are trying to start /usr/bin/bar but the service file says it requires bar, and must be started after bar. Commented Dec 14, 2016 at 11:23
  • sorry @MariusMatutiae my mistake! edited again... it's because foo and bar are not the real service names. I renamed them for the question and confused myself!! Commented Dec 14, 2016 at 11:24

1 Answer 1

2

Commenting out [Unit] causes the Requires and After directives to be ignored. Removing those directives and removing the comment # gives identical behaviour.

The reason it was not starting at boot without the comment # must be because of an issue with the requirement for the other service.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.