[systemd-devel] sd_bus. Message refrence count between sd_bus_call_async callback and sd_bus_process.

2020-11-10 Thread igo95862
Calling sd_bus_process with second parameter as sd_bus_message** will 
put a new message in to that pointer. The man page says that the caller 
should unref it ,however, I found out that if you do that it will get 
garbage collected before a callback registed with sd_bus_call_async 
will get a chance to access it.


Even passing NULL to the second parameter will corrupt callbacks.

Is this documentation issue? Is it correct to refernce the new message 
with sd_bus_process and when not touch its refrence count until the 
callback has a chance to access it? Does the callback get a new 
reference so it should unrefrence it twice?



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


Re: [systemd-devel] Query currently active journald configuration option

2020-11-10 Thread Andrei Borzenkov
09.11.2020 19:09, Lennart Poettering пишет:
> On Mo, 09.11.20 08:48, Andrei Borzenkov (arvidj...@gmail.com) wrote:
> 
>> Is it possible to query configuration options in effect in running
>> journald instance?
> 
> Besides the brief log output it does itself, no there's currently no
> way.
> 
> We never had that because journald can't use D-Bus, because D-Bus
> itself is a client to journald. However, we recently added support for
> a Varlink interface, which requires no broker daemon, and hence just
> works. It would make a ton of sense to extend that varlink IPC
> interface to expose some information about configuration, its state
> and statistics. Happy to review/merge a patch for that.
> 
>>
>> Background - when user asks question about journald, the first
>> information is current settings (like whether persistence is enabled or
>> not). It needs fetching files from multiple places which varies between
>> distributions (/lib vs /usr/lib). Not really user friendly and not
>> possible to do with simple command.
> 
> Fetching files from /lib or /usr/lib? What precisely do you mean?
> 

_CONF_PATHS_SPLIT_USR_NULSTR
_CONF_PATHS_SPLIT_USR

> For such build-time params we expose systemd.pc as pkg-config file,
> which has various paths as variables.
> 

Now explain it to user who barely knows what command line is and most
likely does not even have development environment installed.

Besides, what pkg-config variable exactly controls location of
configuration files? For all I can tell such variable does not exist.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to dynamically retrieve my service name?

2020-11-10 Thread Etienne Doms
Ok it seems /org/freedesktop/systemd1/unit/self is exactly what I was
looking for.

Thank you for your fast response.

Le mar. 10 nov. 2020 à 18:23, Mantas Mikulėnas  a écrit :
>
> You can call org.freedesktop.systemd1.Manager.GetUnitByPID() to directly get 
> the D-Bus object path based on your PID.
>
> There is also the magic path "/org/freedesktop/systemd1/unit/self" which 
> always gives properties of the same service (or scope) that you're in.
>
> Finally, it is possible to call sd_pid_get_unit() from sd-login.h to get your 
> unit name (straight from /proc//cgroup, with no D-Bus yet), then call 
> .Manager.GetUnit() to translate the name into an object path.
>
>
>
> On Tue, Nov 10, 2020 at 6:28 PM Etienne Doms  wrote:
>>
>> Hello,
>>
>> My service needs to behave a bit differently when it has been
>> automatically because of a software fault. I use the
>> "Restart=on-failure", and I understand that I can read the "NRestarts"
>> property which is incremented whenever the service is restarted.
>>
>> The thing is, inside my service, I have no idea if I'm foobar.service,
>> barfoo.service, etc. and I believe I should be agnostic of that.
>>
>> Is there a way to dynamically retrieve
>> /org/freedesktop/systemd1/unit/foobar_2eservice, so that I can ask
>> org.freedesktop.systemd1 the NRestarts property value of the
>> org.freedesktop.systemd1.Service interface?
>>
>> Maybe I'm just over-engineering and should just hardcode
>> "foobar.service" inside my service, but it feels a bit odd to me...
>> Maybe also I understand nothing about D-Bus, sorry about that.
>>
>> Thank you for your support.
>>
>> Best regards,
>> Etienne Doms
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
>
> --
> Mantas Mikulėnas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Luca Boccassi
On Tue, 2020-11-10 at 17:22 +, Luca Boccassi wrote:
> On Tue, 2020-11-10 at 18:12 +0100, Francis Moreau wrote:
> > On Tue, Nov 10, 2020 at 2:43 PM Luca Boccassi  wrote:
> > > On Tue, 2020-11-10 at 11:50 +0100, Francis Moreau wrote:
> > > > On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
> > > >  wrote:
> > > > > On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
> > > > > 
> > > > > > Hello,
> > > > > > 
> > > > > > After restarting a service with "systemctl try-restart ..." I want 
> > > > > > to
> > > > > > verify that the service has been restarted.
> > > > > > 
> > > > > > How can I reliably do this without using the dbus API ?
> > > > > 
> > > > > D-Bus is how systemd exposes its state. If you don't want to use that,
> > > > > you won't get the state information.
> > > > > 
> > > > 
> > > > dbus is overkill for my little bash script.
> > > 
> > > It's pretty simple, and a one-liner, to get the value of a property
> > > from a bash script with busctl. Eg:
> > > 
> > > $ busctl get-property org.freedesktop.systemd1 
> > > /org/freedesktop/systemd1/unit/gdm_2eservice 
> > > org.freedesktop.systemd1.Service Restart
> > > s "always"
> > > 
> > 
> > Thank you but I'm not interested in the Restart property of a service,
> > I want to know if a service as been restarted.
> 
> It's just an example on how to get D-Bus data on units easily from a
> bash script.

Eg:

$ busctl get-property org.freedesktop.systemd1 
/org/freedesktop/systemd1/unit/gdm_2eservice org.freedesktop.systemd1.Service 
NRestarts
u 0

-- 
Kind regards,
Luca Boccassi
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to dynamically retrieve my service name?

2020-11-10 Thread Mantas Mikulėnas
You can call org.freedesktop.systemd1.Manager.GetUnitByPID() to directly
get the D-Bus object path based on your PID.

There is also the magic path "/org/freedesktop/systemd1/unit/self" which
always gives properties of the same service (or scope) that you're in.

Finally, it is possible to call sd_pid_get_unit() from sd-login.h to get
your unit name (straight from /proc//cgroup, with no D-Bus yet), then
call .Manager.GetUnit() to translate the name into an object path.



On Tue, Nov 10, 2020 at 6:28 PM Etienne Doms  wrote:

> Hello,
>
> My service needs to behave a bit differently when it has been
> automatically because of a software fault. I use the
> "Restart=on-failure", and I understand that I can read the "NRestarts"
> property which is incremented whenever the service is restarted.
>
> The thing is, inside my service, I have no idea if I'm foobar.service,
> barfoo.service, etc. and I believe I should be agnostic of that.
>
> Is there a way to dynamically retrieve
> /org/freedesktop/systemd1/unit/foobar_2eservice, so that I can ask
> org.freedesktop.systemd1 the NRestarts property value of the
> org.freedesktop.systemd1.Service interface?
>
> Maybe I'm just over-engineering and should just hardcode
> "foobar.service" inside my service, but it feels a bit odd to me...
> Maybe also I understand nothing about D-Bus, sorry about that.
>
> Thank you for your support.
>
> Best regards,
> Etienne Doms
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


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


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Luca Boccassi
On Tue, 2020-11-10 at 18:12 +0100, Francis Moreau wrote:
> On Tue, Nov 10, 2020 at 2:43 PM Luca Boccassi  wrote:
> > On Tue, 2020-11-10 at 11:50 +0100, Francis Moreau wrote:
> > > On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
> > >  wrote:
> > > > On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
> > > > 
> > > > > Hello,
> > > > > 
> > > > > After restarting a service with "systemctl try-restart ..." I want to
> > > > > verify that the service has been restarted.
> > > > > 
> > > > > How can I reliably do this without using the dbus API ?
> > > > 
> > > > D-Bus is how systemd exposes its state. If you don't want to use that,
> > > > you won't get the state information.
> > > > 
> > > 
> > > dbus is overkill for my little bash script.
> > 
> > It's pretty simple, and a one-liner, to get the value of a property
> > from a bash script with busctl. Eg:
> > 
> > $ busctl get-property org.freedesktop.systemd1 
> > /org/freedesktop/systemd1/unit/gdm_2eservice 
> > org.freedesktop.systemd1.Service Restart
> > s "always"
> > 
> 
> Thank you but I'm not interested in the Restart property of a service,
> I want to know if a service as been restarted.

It's just an example on how to get D-Bus data on units easily from a
bash script.

-- 
Kind regards,
Luca Boccassi
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Francis Moreau
On Tue, Nov 10, 2020 at 2:43 PM Luca Boccassi  wrote:
>
> On Tue, 2020-11-10 at 11:50 +0100, Francis Moreau wrote:
> > On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
> >  wrote:
> > > On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
> > >
> > > > Hello,
> > > >
> > > > After restarting a service with "systemctl try-restart ..." I want to
> > > > verify that the service has been restarted.
> > > >
> > > > How can I reliably do this without using the dbus API ?
> > >
> > > D-Bus is how systemd exposes its state. If you don't want to use that,
> > > you won't get the state information.
> > >
> >
> > dbus is overkill for my little bash script.
>
> It's pretty simple, and a one-liner, to get the value of a property
> from a bash script with busctl. Eg:
>
> $ busctl get-property org.freedesktop.systemd1 
> /org/freedesktop/systemd1/unit/gdm_2eservice org.freedesktop.systemd1.Service 
> Restart
> s "always"
>

Thank you but I'm not interested in the Restart property of a service,
I want to know if a service as been restarted.

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


[systemd-devel] How to dynamically retrieve my service name?

2020-11-10 Thread Etienne Doms
Hello,

My service needs to behave a bit differently when it has been
automatically because of a software fault. I use the
"Restart=on-failure", and I understand that I can read the "NRestarts"
property which is incremented whenever the service is restarted.

The thing is, inside my service, I have no idea if I'm foobar.service,
barfoo.service, etc. and I believe I should be agnostic of that.

Is there a way to dynamically retrieve
/org/freedesktop/systemd1/unit/foobar_2eservice, so that I can ask
org.freedesktop.systemd1 the NRestarts property value of the
org.freedesktop.systemd1.Service interface?

Maybe I'm just over-engineering and should just hardcode
"foobar.service" inside my service, but it feels a bit odd to me...
Maybe also I understand nothing about D-Bus, sorry about that.

Thank you for your support.

Best regards,
Etienne Doms
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Luca Boccassi
On Tue, 2020-11-10 at 11:50 +0100, Francis Moreau wrote:
> On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
>  wrote:
> > On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
> > 
> > > Hello,
> > > 
> > > After restarting a service with "systemctl try-restart ..." I want to
> > > verify that the service has been restarted.
> > > 
> > > How can I reliably do this without using the dbus API ?
> > 
> > D-Bus is how systemd exposes its state. If you don't want to use that,
> > you won't get the state information.
> > 
> 
> dbus is overkill for my little bash script.

It's pretty simple, and a one-liner, to get the value of a property
from a bash script with busctl. Eg:

$ busctl get-property org.freedesktop.systemd1 
/org/freedesktop/systemd1/unit/gdm_2eservice org.freedesktop.systemd1.Service 
Restart
s "always"

-- 
Kind regards,
Luca Boccassi
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Francis Moreau
On Tue, Nov 10, 2020 at 12:47 PM Arian Van Putten  wrote:
>
> I think what you might want is `Type=exec` instead of `Type=simple` in your 
> unit file.  It was recently added to systemd.
>
> then `systemctl restart` will return a failure when the main process fails to 
> start. I hope that helps.

Thank you however I don't control the type of the restarted units, it
can be anything,

>
>
> On Tue, Nov 10, 2020 at 11:50 AM Francis Moreau  
> wrote:
>>
>> On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
>>  wrote:
>> >
>> > On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
>> >
>> > > Hello,
>> > >
>> > > After restarting a service with "systemctl try-restart ..." I want to
>> > > verify that the service has been restarted.
>> > >
>> > > How can I reliably do this without using the dbus API ?
>> >
>> > D-Bus is how systemd exposes its state. If you don't want to use that,
>> > you won't get the state information.
>> >
>>
>> dbus is overkill for my little bash script.
>>
>> --
>> Francis
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
>
> --
>
> Arian van Putten  l  Software Engineer
>
> @arian_wire on Wire
>
> Wire - Secure team messaging.
>
>  Zeta Project Germany GmbH  l  Rosenthaler Straße 40, 10178 Berlin, Germany
>
> Geschäftsführer/Managing Director: Morten J. Broegger
>
> HRB 149847 beim Handelsregister Charlottenburg, Berlin
>
> VAT-ID DE288748675



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


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Arian Van Putten
I think what you might want is `Type=exec` instead of `Type=simple` in your
unit file.  It was recently added to systemd.

then `systemctl restart` will return a failure when the main process fails
to start. I hope that helps.



On Tue, Nov 10, 2020 at 11:50 AM Francis Moreau 
wrote:

> On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
>  wrote:
> >
> > On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
> >
> > > Hello,
> > >
> > > After restarting a service with "systemctl try-restart ..." I want to
> > > verify that the service has been restarted.
> > >
> > > How can I reliably do this without using the dbus API ?
> >
> > D-Bus is how systemd exposes its state. If you don't want to use that,
> > you won't get the state information.
> >
>
> dbus is overkill for my little bash script.
>
> --
> Francis
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


-- 

Arian van Putten  l  Software Engineer

@arian_wire on Wire

Wire  - Secure team messaging.

 Zeta Project Germany GmbH  l  Rosenthaler Straße 40, 10178 Berlin, Germany



Geschäftsführer/Managing Director: Morten J. Broegger

HRB 149847 beim Handelsregister Charlottenburg, Berlin

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


[systemd-devel] systemd-rfkill.service: Failed to set up special execution directory in /var/lib: Read-only file system

2020-11-10 Thread Mark Rogers
I have a Raspberry Pi-based development kiosk system which has been working
fine for ages. But without having made any changes that I can relate to the
boot sequence, it now errors on startup with multiple:

[FAILED] Failed to start Load/Save RF Kill Switch Status

errors, and also a single

  [FAILED] Failed to start Set console font and keymap

error.

Clearly these relate to the read-only filesystem but that hasn't changed so
I don't see why I am now getting errors unless there was always a race
condition that I'm now experiencing for the first time?

Any suggestions for how to resolve these? (Do I even need rfkill in a kiosk
environment? I tried to disable it but that doesn't appear to have any
impact.)

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


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Francis Moreau
On Tue, Nov 10, 2020 at 11:30 AM Lennart Poettering
 wrote:
>
> On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:
>
> > Hello,
> >
> > After restarting a service with "systemctl try-restart ..." I want to
> > verify that the service has been restarted.
> >
> > How can I reliably do this without using the dbus API ?
>
> D-Bus is how systemd exposes its state. If you don't want to use that,
> you won't get the state information.
>

dbus is overkill for my little bash script.

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


Re: [systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Lennart Poettering
On Di, 10.11.20 10:28, Francis Moreau (francis.m...@gmail.com) wrote:

> Hello,
>
> After restarting a service with "systemctl try-restart ..." I want to
> verify that the service has been restarted.
>
> How can I reliably do this without using the dbus API ?

D-Bus is how systemd exposes its state. If you don't want to use that,
you won't get the state information.

Sorry,

Lennart

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


[systemd-devel] How can I simply check that a service has been restarted ?

2020-11-10 Thread Francis Moreau
Hello,

After restarting a service with "systemctl try-restart ..." I want to
verify that the service has been restarted.

How can I reliably do this without using the dbus API ?

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