Re: [systemd-devel] dbus and exit-on-idle

2017-05-23 Thread Matthijs van Duin
On 22 May 2017 at 10:36, Lennart Poettering  wrote:

> Yes, the exit-on-idle logic on dbus is impossible to implement
> correctly for non-trivial cases right now.
>

Hmm? Can you elaborate? Apart from the two issues I identified (which look
easily fixable to me), are there more known races that would remain?

non-trivial additions to the dbus spec


Yeah, I'm not holding my breath for that one...
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] dbus and exit-on-idle

2017-05-23 Thread Colin Walters


On Sun, May 21, 2017, at 08:26 PM, Matthijs van Duin wrote:
> I've been pondering how to allow my bus-activated service to exit when
> it's unneeded (which is 99% of the time), and in particular how to deal
> with exit/activate races correctly...

See also https://lists.freedesktop.org/archives/dbus/2015-May/016671.html
I was recently working on using this in 
https://github.com/projectatomic/rpm-ostree/pull/606
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Locale setup for non-shells

2017-05-23 Thread Lennart Poettering
On Mon, 22.05.17 19:36, Nikolai Kondrashov (nikolai.kondras...@redhat.com) 
wrote:

> On 05/22/2017 04:46 PM, Lennart Poettering wrote:
> > On Mon, 22.05.17 14:11, Nikolai Kondrashov (nikolai.kondras...@redhat.com) 
> > wrote:
> > > I'm trying to solve a problem of supplying locale settings to non-shell
> > > programs acting as login shells in Fedora and RHEL, as described
> > > below.
> > 
> > Which services precisely are running these PAM sessions?
> > 
> > Note that explicitly importing /etc/locale.conf should be entirely
> > unnecessary: systemd reads that anyway and adds it to the environment
> > of all services it spawns.
> > 
> > I am pretty sure instead of readding this to the env block through PAM
> > it should just stay in place anyway, and simply be inherited
> > down. Hence, I'd claim that the services setting up the PAM session
> > are simply too eager in cleaning up the environment and should be
> > fixed to leave LANG= and LC_*= in the environment passed to activates 
> > sessions.
> > 
> > > So far it seems the Debian way of doing things will work.
> > > 
> > > Could you please confirm that the format of locale.conf is not going to 
> > > change
> > > in a way incompatible with what pam_env.so expects?
> > > 
> > > The pam_env.so manpage:
> > > 
> > > http://man7.org/linux/man-pages/man8/pam_env.8.html
> > > 
> > > The locale.conf manpage:
> > > 
> > > https://www.freedesktop.org/software/systemd/man/locale.conf.html
> > > 
> > > Also, am I missing anything? Is there another way systemd can help here?
> > 
> > The syntax described in the man page is unlikely to change. I have no
> > idea about the format pam_env expects though.
> > 
> > And I can only recommend fixing the services in question instead of
> > taping over the issue with pam_env...
> 
> Thanks for your prompt response, Lennart!
> 
> I'm talking about logins on console now, so I assume the service in question,
> technically, is systemd-logind. However, I found out that it's working OK, and
> the real problem is these two pieces in /lib/systemd/system/getty@.service:
> 
> # Unset locale for the console getty since the console has problems
> # displaying some internationalized messages.
> Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= 
> LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= 
> LC_MEASUREMENT= LC_IDENTIFICATION=
> 
> and
> 
> ExecStart=-/sbin/agetty --noclear %I $TERM
> 
> What the first one does is obvious, and the second needs to be modified to
> make login preserve the environment. Like this:
> 
> ExecStart=-/sbin/agetty -o "-p -- \u" --noclear %I $TERM
> 
> Do you think the two pieces above can be changed to let the locale environment
> through?

Yes, I think that would make sense to do. Could you file an issue
asking for that on systemd github? (or even better: a PR implementing
it!)

https://github.com/systemd/systemd/issues/new

Lennart

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


Re: [systemd-devel] how to correctly specify dependency on dbus

2017-05-23 Thread prashantkumar dhotre
Thanks.
my service runs during early bootup.
one intermittent issue I am seeing is that my service fails in
dbus_bus_get_private() with error:

 07:45:19 : dbus_bus_get_private() failed with error: Failed to
connect to socket /var/run/dbus/system_bus_socket: No such file or
directory


dbus service started at 07:44:34  and my service started at  07:45:19
which is 45 sec after dbus and also I see
/var/run/dbus/system_bus_socket present before this error.


#systemctl status dbus :
 * dbus.service - D-Bus System Message Bus
   Loaded: loaded (/lib/systemd/system/dbus.service; static; vendor
preset: enabled)
   Active: active (running) since Tue 2017-05-02 07:44:34 UTC; 40s ago
 Docs: man:dbus-daemon(1)
 Main PID: 1574 (dbus-daemon)
   CGroup: /system.slice/dbus.service
   `-1574 /usr/bin/dbus-daemon --system --address=systemd:
--nofork --nopidfile --systemd-activation

 07:45:15:  netstat -anp | grep dbus :
 unix  2  [ ACC ] STREAM LISTENING 116811/init
 /var/run/dbus/system_bus_socket
unix  3  [ ] STREAM CONNECTED 118311574/dbus-daemon
unix  3  [ ] STREAM CONNECTED 109071574/dbus-daemon
unix  3  [ ] STREAM CONNECTED 118301574/dbus-daemon
unix  3  [ ] STREAM CONNECTED 11833
1574/dbus-daemon/var/run/dbus/system_bus_socket
unix  3  [ ] STREAM CONNECTED 11832
1574/dbus-daemon/var/run/dbus/system_bus_socket


not sure why dbus API is failing even though the socket is present.
So am I missing to add any dependency in my service file ?


On Sat, Apr 29, 2017 at 10:36 PM, Lennart Poettering
 wrote:
> On Wed, 26.04.17 10:09, prashantkumar dhotre (prashantkumardho...@gmail.com) 
> wrote:
>
>> Hi
>> For my service,  I have:
>>
>> # cat my.service
>> [Unit]
>> Description=My Service
>> After=dbus.service
>> Requires=dbus.service
>> ...
>> ...
>>
>> Some time i see that my service fails to get dbus connection
>> (dbus_bus_get_private() fails without any error msg).
>> one possibility i think is that dbus is not fully initialized.
>> From above service file config, i understand when i start my service,
>> dbus service is started 1st and then my service.
>> but i am not sure if my service start step is delayed until dbus is
>> fully up , initialized and running and ready to accept conections.
>> is there a way to specify this in my service file.
>
> Regular system services do not have to declare any explicit dependency
> on D-Bus, as D-Bus is always and unconditionally available in the later
> boot phase (where regular services are started) and during runtime.
>
> If your service runs during the early boot phase however (i.e. before
> basic.target is reached, meaning your service has
> DefaultDependencies=no set), then you do need an explicit dependency,
> but should only specify it as After=dbus.socket +
> Requires=dbus.socket (i.e. on the socket rather than the service).
>
> If you don't know whether your service is an early or late boot
> service then it's almost certainly a late boot service.
>
>> For ex, for systemd-networkd,service, i see it specify  like :
>>
>> # On kdbus systems we pull in the busname explicitly, because it
>> # carries policy that allows the daemon to acquire its name.
>> Wants=org.freedesktop.network1.busname
>> After=org.freedesktop.network1.busname
>>
>>
>> Can i use same (specifying After/Wants on a dbus name) ?
>
> Please ignore anything related to kdbus in the source, this is
> supported no longer, and does not apply to regular D-Bus.
>
>
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] FW: Question about systemd sessions

2017-05-23 Thread Mantas Mikulėnas
gdm registers its login screen as a session because it *is* in essence a
regular (if trimmed down) GNOME session. It follows the same logind rules
for accessing the display, audio out, etc.

Various desktop services and recently even programs use DBus activation –
instead of launching them directly, the consumer app tells DBus to start
them (either explicitly or just by trying to talk to the activatable
service). So usually you'd see quite a few processes as children of
dbus-daemon.

* If your distro has switched to the "user bus" model, then dbus-daemon
will be running as a systemd --user service, and therefore under user@.
* In addition to that, some apps have their own systemd --user services,
and DBus uses those to start the app.

On Tue, May 23, 2017, 12:12 Олег Гаврильченко 
wrote:

>
>
>
>
> *From:* Олег Гаврильченко [mailto:gavrilche...@avionica.spb.ru]
> *Sent:* Monday, May 22, 2017 6:17 PM
> *To:* 'systemd-devel@lists.freedesktop.org' <
> systemd-devel@lists.freedesktop.org>
> *Subject:* Question about systemd sessions
>
>
>
> Hello!
>
> I have question about systemd user sessions.
>
> When I start my systemd system and login to it I see 2 user sessions: c1
> for user gdm and c2 for my user. I see 2 (user@120.slice and
> user@1000.slice) slices and 2 scopes(session-c1.scope and
> session-c2.scope). Several programs or deamons reside in user@.slice,
> other in session-c*.scope.
> I don't understend and can not find in documentation, why is there 2 and
> not 1 session in system? And why does several programs reside in
> user@.slice and other in session-c*.scope?
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
-- 

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


[systemd-devel] FW: Question about systemd sessions

2017-05-23 Thread Олег Гаврильченко
 

 

From: Олег Гаврильченко [mailto:gavrilche...@avionica.spb.ru] 
Sent: Monday, May 22, 2017 6:17 PM
To: 'systemd-devel@lists.freedesktop.org'

Subject: Question about systemd sessions

 

Hello!

I have question about systemd user sessions.

When I start my systemd system and login to it I see 2 user sessions: c1 for
user gdm and c2 for my user. I see 2 (user@120.slice 
and user@1000.slice  ) slices and 2
scopes(session-c1.scope and session-c2.scope). Several programs or deamons
reside in user@.slice  , other in session-c*.scope.
I don't understend and can not find in documentation, why is there 2 and not
1 session in system? And why does several programs reside in user@.slice
  and other in session-c*.scope?

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