On Thu, Oct 28, 2021 at 10:25 PM Andrei Borzenkov <arvidj...@gmail.com> wrote:
> On 29.10.2021 04:54, Han wrote: > > Hi, > > > > I'm a newbie to systemd. I encountered a strange problem when using > > systemd user > > service in Debian 10 (hardware: Raspberry Pi 4), systemd version 241. > > > > I posted this question on stackoverflow but didn't get answers yet. Hence > > trying to ask here. My apologies if this is too basic. > > > > 1. I created a new service unit file at here: > > /home/pi/.config/systemd/user/foo.service > > > > its content looks like this: > > > > [Service] > > ExecStart=/home/pi/test/foo > > WorkingDirectory=/home/pi/test > > > > > > 1. I tried to start this service, but it failed: > > > > $ systemctl --user start foo > > Failed to start foo.service: Unit foo.se > > Does it work after > > systemctl --user daemon-reload > > ? > Yes, it worked after `daemon-reload`. Thank you so much! Han > > rvice not found. > > > > However, systemd can list this unit file when doing this: > > > > $systemctl --user list-unit-files --type service | grep foo > > foo.service static > > > > Moreover, when I added [Install] section in the unit file: > > > > [Install] > > WantedBy=multi-user.target > > > > User instance does not have this target. > > > and run $systemctl --user enable foo , it worked. > > > > Even more, after that I removed the unit file, and recreated the unit > file > > without the [Install] section, now I start the service and the original > > problem is no longer seen. > > > > So it seems like only when I try to create a new user service for the > first > > time on the system, without using [Install], it will fail to start. > > > > Any ideas why this is happening? (btw, I don't want to have [Install] for > > this service.) > > > > Or is this a known issue fixed in a later release? > > > > Thanks > > > > Han > > > >