[systemd-devel] Running "systemd --user" and creating a new session
Ivan Shapovalov
intelfx100 at gmail.com
Sat Jun 8 13:04:54 PDT 2013
On 08 June 2013 02:41:56 Ivan Shapovalov wrote:
> On 07 June 2013 12:47:28 Kok, Auke-jan H wrote:
> > On Fri, Jun 7, 2013 at 3:18 AM, Иван Шаповалов <intelfx100 at gmail.com>
wrote:
> > > Hi all,
> > >
> > > Recently I've attempted to switch my user session to "systemd --user".
> > > The
> > > configuration is pretty simple - no multiseat, nothing special.
> > > I start the user session with provided "user at .service" with some
> > > modifications:
> > >
> > > --- /usr/lib/systemd/system/user at .service 2013-05-30 16:55:28.000000000
> > > +0400
> > > +++ /etc/systemd/system/user at .service 2013-06-07 03:46:27.158435556
> > > +0400
> > > @@ -13,11 +13,14 @@
> > >
> > > User=%I
> > > PAMName=systemd-shared
> > > # in order to allow MEM_CG features to work, add "memory:/" here
> > >
> > > -ControlGroup=%R/user/%U.user/shared cpu:/
> > > +# note to myself: cpu:/ has been removed due to running a -ck kernel
> > > +ControlGroup=%R/user/%U.user/shared
> > >
> > > ControlGroupModify=yes
> > > Type=notify
> > > ExecStart=-/usr/lib/systemd/systemd --user
> > >
> > > +Environment=XDG_RUNTIME_DIR=/run/user/%U
> > >
> > > Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/dbus/user_bu
> > > s_
> > > socket +Environment=SHELL=%s
> > >
> > > [Install]
> > > Alias=user@%i.service
> > >
> > > --
> > >
> > > This modified unit works (almost) as expected, however, everything that
> > > is
> > > started under that systemd instance does _not_ get its own session.
> > > For example, $XDG_SESSION_ID is empty and there are no new records
> > > in output of 'loginctl list-sessions'.
> > >
> > > So, a question: is this the desired behavior, and, if yes, how can I
> > > create
> > > a session manually?
> >
> > This is one of the missing parts - loginctl needs modifications to
> > make enable-linger working, and that's not implemented.
> >
> > Ultimately, the admin should not directly start a user at .service
> > instance manually.
> >
> > Auke
>
> Hm, interesting..
> After an hour of experiments, I changed PAMName to "system-login". It
> worked, and then I looked at your user-session at .service just to find out
> that the same thing is done there.
>
> Ivan
So I've succeeded in launching a vt-based session (Type=tty, Class=user) with
an Xorg instance in it.
Here is another problem: actually, I planned to use this all on a headless
machine with Xvnc as X server. Obviously, it does not have a tty, so things
like TTYPath=... can't be applied there. So I want a session with no TTY, but
still assigned to seat0 and always Active.
Plain omission of TTYPath= from user-session at .service gives me a session of
Class=background and empty Seat, however it is Active.
If e. g. KDM is used to start a session (configured to use Xvnc), it gives me
a session of Type=x11 and again an empty Seat (I guess, because there is no
TTY).
So basically three questions:
1) Is this a correct way to go, or it's easier to configure polkit to be lax
(allow everything to everyone) and be happy with Class=background and empty
Seat?
2) Does "Type=x11" influence anything? If yes, then how to launch such a
session using only systemd (without a DM)?
3) How to assign a session to a specific seat, again with systemd only?
- Thanks,
Ivan.
More information about the systemd-devel
mailing list