[systemd-devel] Systemctl thinks a service file exists that does not

Andrei Borzenkov arvidjaar at gmail.com
Mon Aug 28 11:21:39 UTC 2023


On Mon, Aug 28, 2023 at 1:50 PM Cecil Westerhof <cldwesterhof at gmail.com> wrote:
>
> Op ma 28 aug 2023 om 11:55 schreef Andrei Borzenkov <arvidjaar at gmail.com>:
>>
>> On Mon, Aug 28, 2023 at 12:27 PM Cecil Westerhof <cldwesterhof at gmail.com> wrote:
>> >
>> > On debian 12, when Itype:
>> >     systemctl status spam
>> >
>> > and giving a tab I get:
>> >     spamassassin-maintenance.service  spamassassin.service
>> >     spamassassin-maintenance.timer    spamd.service
>> >
>> > Still:
>> >     systemctl start spamassassin.service
>> >
>> > keeps giving not found.
>> >
>>
>> Those units are probably listed as dependencies somewhere. Units
>> listed in Wants or After/Before are not required to exist.
>>
>> > So systemctl thinks there is a spamassassin.service file, but when
>> > starting it does not find it.
>> >
>> > I do not find a spamassassin.service file on my system. The other
>> > three I do find.
>> >
>> > When using:
>> >     find / -name spamassassin.service
>> >
>> > it does not find spamassassin.service.
>> > So why does systemctl think there is a spamassassin.service?
>>
>> It is not the systemctl, it is your shell completion of the systemctl.
>> Just look at the output of "systemctl list-units --all" for
>> "not-found".
>
>
> I have to clean up my system: there are 25 not-found services, 3 not-found targets, 2 not-found mounts and 1 not-found socket.
>
> For spamassassin.service I see:
>     ● spamassassin.service                                                                                           not-found inactive dead      spamassassin.service
>
> But when I give:
>     systemctl list-dependencies spamassassin.service
>
> I get:
>     spamassassin.service
>
> I looked into:
>     /etc/systemd/system
>     /run/systemd/system
>     /lib/systemd/system
> But I do not find dependencies.
>
> Where else should I look?
>

Look at "systemctl show spamassassin.service".

>
>> Maybe completion should skip missing units. At least for such actions
>> as "status" this does not look useful.
>>
>> > And how do I make it forget it?
>> >
>>
>> systemd cannot forget them as long as units depending on them are still loaded.
>
>
>
> --
> Cecil Westerhof


More information about the systemd-devel mailing list