<div dir="ltr"><div dir="ltr">I have a follow-up question inline. Thanks.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 28, 2021 at 10:47 PM Han <<a href="mailto:keepsimple@gmail.com">keepsimple@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 28, 2021 at 10:25 PM Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com" target="_blank">arvidjaar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 29.10.2021 04:54, Han wrote:<br>
> Hi,<br>
> <br>
> I'm a newbie to systemd. I encountered a strange problem when using<br>
> systemd user<br>
> service in Debian 10 (hardware: Raspberry Pi 4), systemd version 241.<br>
> <br>
> I posted this question on stackoverflow but didn't get answers yet. Hence<br>
> trying to ask here. My apologies if this is too basic.<br>
> <br>
>    1. I created a new service unit file at here:<br>
>    /home/pi/.config/systemd/user/foo.service<br>
> <br>
> its content looks like this:<br>
> <br>
> [Service]<br>
> ExecStart=/home/pi/test/foo<br>
> WorkingDirectory=/home/pi/test<br>
> <br>
> <br>
>    1. I tried to start this service, but it failed:<br>
> <br>
> $ systemctl --user start foo<br>
> Failed to start foo.service: Unit <a href="http://foo.se" rel="noreferrer" target="_blank">foo.se</a><br>
<br>
Does it work after<br>
<br>
systemctl --user daemon-reload<br>
<br>
?<br></blockquote><div><br></div><div>Yes, it worked after `daemon-reload`.  Thank you so much!</div></div></div></blockquote><div><br></div><div><br></div><div>"daemon-reload" reloads all unit files in the system.  It seems to me such a big remedy for starting a single service.  Is this the expected workflow or a workaround?  </div><div><br></div><div>Also I tried to add a 2nd service "foo2.service" in the same way,  now I don't have to run "daemon-reload" and it can start.  I'm wondering why.</div><div><br></div><div>Thanks</div><div>Han</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Han</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
rvice not found.<br>
> <br>
> However, systemd can list this unit file when doing this:<br>
> <br>
> $systemctl --user list-unit-files --type service | grep foo<br>
> foo.service                      static<br>
> <br>
> Moreover, when I added [Install] section in the unit file:<br>
> <br>
> [Install]<br>
> WantedBy=multi-user.target<br>
> <br>
<br>
User instance does not have this target.<br>
<br>
> and run $systemctl --user enable foo , it worked.<br>
> <br>
> Even more, after that I removed the unit file, and recreated the unit file<br>
> without the [Install] section, now I start the service and the original<br>
> problem is no longer seen.<br>
> <br>
> So it seems like only when I try to create a new user service for the first<br>
> time on the system, without using [Install], it will fail to start.<br>
> <br>
> Any ideas why this is happening? (btw, I don't want to have [Install] for<br>
> this service.)<br>
> <br>
> Or is this a known issue fixed in a later release?<br>
> <br>
> Thanks<br>
> <br>
> Han<br>
> <br>
<br>
</blockquote></div></div>
</blockquote></div></div>