[systemd-devel] Running "systemd --user" and creating a new session

Ivan Shapovalov intelfx100 at gmail.com
Fri Jun 7 15:41:56 PDT 2013


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_bus_
> > 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


More information about the systemd-devel mailing list