Re: [systemd-devel] Antw: Re: Explain status "Loaded: not-found (Reason: No such file or directory)"

2019-05-13 Thread Lennart Poettering
On Mo, 13.05.19 08:08, Ulrich Windl (ulrich.wi...@rz.uni-regensburg.de) wrote:

> > Typically, when you see "not-found" as "Loaded" value, you'll also see
> > "No such file or directory" as "Reason" value, but there are some
> > other cases, since units are not always synthesized from unit files on
> > disk, but from other concepts too.
> >
>
> Thanks for the explanation; it's more clear now. However I'd prefer a message
> like "Loaded: iotwatch.target could not be found", so
> * name what is missing, and
> * use an "errno message" only for specific system calls (not to summarize
> several)

The name of the unit missing is shown in the same output a tiny bit
further up, we try to repeat ourselves too often. "systemctl status"
is supposed to compress a lot of information into little space.

Note that these "errno" error strings are generally how things are
done on UNIX. For example, if you use plain "rm" to remove a missing
file, or "cat" to cat it you get the same error strings:

$ rm 
rm: cannot remove '': No such file or directory
$ cat 
cat: : No such file or directory

UNIX admins typically recognize the "No such file or directory" phrase
and know what it means. I mean, UNIX is sometimes a bit cryptic, but
it is how it is...

Lennart

--
Lennart Poettering, Berlin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Antw: Re: Explain status "Loaded: not-found (Reason: No such file or directory)"

2019-05-13 Thread Lennart Poettering
On Mo, 13.05.19 07:48, Ulrich Windl (ulrich.wi...@rz.uni-regensburg.de) wrote:

> >> I guess it's not a file named "Reason" that's missing. Despite of my
> >> recommendation to create helpful error messages, can you explain what it
> > means?
> >> Even after an strace I could not find out what is missing.
> >>
> >
> > It means that unit definition file (iotwatch.target) was not found in
> > any directory where systemd looks for it.
>
> The confusing part is that something that cannot be found is "active" for 18
> minutes ;-)

If you start a unit, then remove its unit file it remains started but
the unit file cannot be found anymore. We try to make the best of it:
leave the service running as well as possible, but will tell you the
unit file is now absent.

Of course, it's not a good idea to remove a unit file while a service
is still running, but we cannot really stop you from doing so, this
being UNIX and all...

Lennart

--
Lennart Poettering, Berlin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Antw: Re: Explain status "Loaded: not-found (Reason: No such file or directory)"

2019-05-12 Thread Ulrich Windl
>>> Lennart Poettering  schrieb am 09.05.2019 um 17:08
in
Nachricht <20190509150818.GA5854@gardel-login>:
> On Do, 09.05.19 12:25, Ulrich Windl (ulrich.wi...@rz.uni-regensburg.de) 
> wrote:
> 
>> Hi!
>>
>> I'm developing a service and getting the status of my target gives:
>> ● iotwatch.target
>>Loaded: not-found (Reason: No such file or directory)
>>Active: active since Thu 2019-05-09 12:00:56 CEST; 18min ago
>>
>> I guess it's not a file named "Reason" that's missing. Despite of my
>> recommendation to create helpful error messages, can you explain what it 
> means?
>> Even after an strace I could not find out what is missing.
> 
> "Loaded" is a field that indicates whether the unit definition was
> properly loaded from the unit file. Here, it's shown as "not-found",
> which is the value indicating that no unit file by the name
> "iotwatch.target" could be found. Then, in brackets you get some
> additional information: here "Reason:" is the field that indicates the
> reason why the unit file wasn't found, and this usually gives you a
> UNIX error code, i.e. the text string associated with an "errno"
> code. "No such file or directory" is the string for ENOENT, i.e. it's
> the simplest of cases here: there really just was no file found by the
> name you requested.
> 
> Typically, when you see "not-found" as "Loaded" value, you'll also see
> "No such file or directory" as "Reason" value, but there are some
> other cases, since units are not always synthesized from unit files on
> disk, but from other concepts too.
> 

Thanks for the explanation; it's more clear now. However I'd prefer a message
like "Loaded: iotwatch.target could not be found", so
* name what is missing, and
* use an "errno message" only for specific system calls (not to summarize
several)

Regards,
Ulrich

> Lennart
> 
> --
> Lennart Poettering, Berlin



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Antw: Re: Explain status "Loaded: not-found (Reason: No such file or directory)"

2019-05-12 Thread Ulrich Windl
>>> Andrei Borzenkov  schrieb am 09.05.2019 um 16:32 in
Nachricht <11c2e9e7-4094-7c65-5840-9f69b54e3...@gmail.com>:
> 09.05.2019 13:25, Ulrich Windl пишет:
>> Hi!
>> 
>> I'm developing a service and getting the status of my target gives:
>> ● iotwatch.target
>>Loaded: not-found (Reason: No such file or directory)
>>Active: active since Thu 2019-05-09 12:00:56 CEST; 18min ago
>> 
>> I guess it's not a file named "Reason" that's missing. Despite of my
>> recommendation to create helpful error messages, can you explain what it 
> means?
>> Even after an strace I could not find out what is missing.
>> 
> 
> It means that unit definition file (iotwatch.target) was not found in
> any directory where systemd looks for it.

The confusing part is that something that cannot be found is "active" for 18
minutes ;-)

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel