Re: [systemd-devel] how to use per-user systemd --user services / how to replace /etc/xdg/autostart/app.desktop?

2016-06-24 Thread Martin Pitt
Mantas Mikulėnas [2016-06-16 16:03 +0300]:
> So I would create a separate graphical.target and manually `systemctl
> start` it via .xprofile or such. (Don't forget, also, that graphical
> programs usually need $DISPLAY, and this is only imported to the --user
> manager /after/ default.target has already started.)

That's in fact my current schema too. We want to convert the Ubuntu
user session from (session) upstart to (per-user) systemd units, and
my current prototype [1] defines a "graphical.slice", the actual
services hook into that (or perhaps into a subslice like
graphical-xfce.slice), and the whole Xsession gets wrapped into
starting/stopping the per-session-type slice [2].

It's still a prototype (work on this is postponed until end of July on
a sprint), but so far this works reasonably well.

Martin

[1] https://git.launchpad.net/~pitti/+git/systemd-graphical-session/tree/
[2] 
https://git.launchpad.net/~pitti/+git/systemd-graphical-session/tree/usr/share/systemd-graphical-session/session-wrapper
-- 
Martin Pitt| http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] how to use per-user systemd --user services / how to replace /etc/xdg/autostart/app.desktop?

2016-06-20 Thread Simon McVittie
On 16/06/16 14:10, Zbigniew Jędrzejewski-Szmek wrote:
> On Thu, Jun 16, 2016 at 12:32:24PM +, Patrick Schleizer wrote:
>> Using Debian jessie (stable) with systemd package version 215-17+deb8u4.
> 
> I'd suggest looking at existing user units present in
> Debian, converting some more packages where this makes sense, and
> submitting those unit files to the Debian maintainers to integrate
> them in the distribution or upstream.

This sort of structural change is not going to be included in Debian 8
"jessie" - that would defeat the purpose of a long-term stable
distribution. Please develop patches against Debian testing/unstable, so
that they can go into the *next* stable Debian release (Debian 9
"stretch". You can also incorporate those patches into your
locally-installed packages on jessie if you want, but Debian package
maintainers certainly won't apply them to jessie.

A good starting point is to turn D-Bus session services into systemd
user units, as I already did for a few packages (for example
evolution-data-server and gnome-terminal-server). I have mostly been
submitting these as patches upstream, with backports into older upstream
versions in Debian testing/unstable in some cases.

-- 
Simon McVittie
Collabora Ltd. 

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


Re: [systemd-devel] how to use per-user systemd --user services / how to replace /etc/xdg/autostart/app.desktop?

2016-06-16 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Jun 16, 2016 at 12:32:24PM +, Patrick Schleizer wrote:
> Hi!
> 
> I would like to replace some /etc/xdg/autostart/app.desktop files with
> systemd --user services. I believe these are better because then systemd
> keywords such as 'After=' etc. can be used.
> 
> Is this a use case systemd can be used for?

Hi,

yes, systemd --user session can be used to start various user
services, and in fact, recent gnome versions are doing exactly
that.

> Once the user logs in, the systemd --user service should start. Similar
> to like /etc/xdg/autostart mechanism works.
You can see systemd.unit(5) for the explanation of how to add services
to various targets. For systemd --user the targets are described in 
systemd.special(7).

> Using Debian jessie (stable) with systemd package version 215-17+deb8u4.
>
> How to do that?
> 
> Is there any difference for a login console and an X session?

You can hack on those units yourself, but this kind of general change
of how the desktop is built should be done through distribution and
upstream projects. It seems likely that just adding unit files will
not be enough, various small modifications to the programs might be
necessary. I'd suggest looking at existing user units present in
Debian, converting some more packages where this makes sense, and
submitting those unit files to the Debian maintainers to integrate
them in the distribution or upstream.

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


Re: [systemd-devel] how to use per-user systemd --user services / how to replace /etc/xdg/autostart/app.desktop?

2016-06-16 Thread Mantas Mikulėnas
On Thu, Jun 16, 2016 at 3:32 PM, Patrick Schleizer <
patrick-mailingli...@whonix.org> wrote:

> Hi!
>
> I would like to replace some /etc/xdg/autostart/app.desktop files with
> systemd --user services. I believe these are better because then systemd
> keywords such as 'After=' etc. can be used.
>
> Is this a use case systemd can be used for?
>

Mostly, yes. Various services in GNOME 3.20 now show up under `systemctl
--user`, in fact.

Once the user logs in, the systemd --user service should start. Similar
> to like /etc/xdg/autostart mechanism works.
>
> Using Debian jessie (stable) with systemd package version 215-17+deb8u4.
>
> How to do that?
>

[Install]
WantedBy=default.target

However, making everything start via default.target is not a good idea:

– The actual login is delayed until default.target finishes; there were
suggestions to split it up (making only basic.target the 'blocking' part),
but nobody has written the code for that yet. So large services in
default.target can make logins slow.

– When default.target is processed, services don't yet have the necessary
environment variables (see below).

Is there any difference for a login console and an X session?
>

Not yet, no. (Also no difference between whether the --user manager was
started due to an actual login, or whether it was started on boot due to
"enable-linger" configuration.)

So I would create a separate graphical.target and manually `systemctl
start` it via .xprofile or such. (Don't forget, also, that graphical
programs usually need $DISPLAY, and this is only imported to the --user
manager /after/ default.target has already started.)

I've heard of some plans to make "logging in to GNOME" start gnome.target,
and such, but AFAIK there's nothing concrete yet. (Perhaps when the [kd]bus
wars end.)

Nowhere on search engines I found how to do that with Debian. I also
> asked the Debian systemd package maintainers a while ago [with
> instructions what I did], but did not get an answer. [1]
>

About the same as with other distros. Though it'll work better on stretch
than jessie – among other things, you'll probably want the
"dbus-user-session" package, which adds dbus.service for apps launched via
--user.

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


[systemd-devel] how to use per-user systemd --user services / how to replace /etc/xdg/autostart/app.desktop?

2016-06-16 Thread Patrick Schleizer
Hi!

I would like to replace some /etc/xdg/autostart/app.desktop files with
systemd --user services. I believe these are better because then systemd
keywords such as 'After=' etc. can be used.

Is this a use case systemd can be used for?

Once the user logs in, the systemd --user service should start. Similar
to like /etc/xdg/autostart mechanism works.

Using Debian jessie (stable) with systemd package version 215-17+deb8u4.

How to do that?

Is there any difference for a login console and an X session?

Nowhere on search engines I found how to do that with Debian. I also
asked the Debian systemd package maintainers a while ago [with
instructions what I did], but did not get an answer. [1]

Cheers,
Patrick

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=820111
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel