4

My current system boots to console and I do not want to use a display manager.

After updating to Ubuntu 13.10, I realised that the ConsoleKit is no longer used for managing user logins and systemd-logind service is used instead.

My .xinitrc config for Ubuntu 13.04 looked like this:

exec ck-launch-session startxfce4

The ck-launch-session enabled me to mount disks or shutdown/reboot/suspend the PC.

The only place where I could find documentation for how to enable these features was in the documentation for Arch Linux:

Users should first set up systemd-logind to manage their session. If systemd is running as the system init daemon, then this is already happening.

Next, the user must launch systemd by putting the following in their ~/.xinitrc: /usr/lib/systemd/systemd --user

The user should remove any instances of ck-launch-session or dbus-launch from their ~/.xinitrc, as those commands are unneeded.

However, as Ubuntu uses upstart and not the systemd, I can't do that on my configuration.

I tried doing something similar so I put this in my .xinitrc:

export DESKTOP_SESSION=xfce
init --user

And the xfce session starts, but I'm still not able to mount the hard disks or reboot, shutdown and suspend my PC. It's effectively the same as calling startxfce4 directly.

If I start the X server with the vt01 argument, where 01 is the id of the current tty, everything works fine, but I can't use stuff like CTRL+C to terminate the server if something hangs. Yes, there are workarounds like calling killall xinit, but this doesn't solve the problem.

I think that I'm not allowed to do shutdown If i start the X server in a new tty is because a new logind session is not cretated. After reading the logind documentation, I realize that I probably need to create a new session upon starting the X server and that session should be marked as active when I'm in the X server. This can be checked with the following command:

loginctl show-session $XDG_SESSION_ID | grep Active

The following line in the logind documentation confuses me:

CreateSession() and ReleaseSession() may be used to open or close login sessions. These calls should never be invoked directly by clients. Creating/closing sessions is exclusively the job of PAM and its pam_systemd module.

So my question is how can I make PAM create a new logind session upon starting the X server?

jeremija
  • 3,358

1 Answers1

1

I've spent all night looking at this for my Ubuntu console boot + Openbox setup and was in the same boat as you. systemd isn't used fully in Ubuntu 13.10 but it does replace ConsoleKit as you said. I'd got as far as loginctl and wanted to tear my hair out, then I found http://blog.falconindy.com/articles/back-to-basics-with-x-and-systemd.html which works a treat.

My .xinitrc is as follows -

exec dbus-launch --sh-syntax --exit-with-session openbox-session

I've used the helper script in the link above and aliased startx as, 'exec path/to/the/helper/script'. Works a treat and nm-applet is playing ball too.

P.S. In case the link disappears above, here's the helper script to replace startx.

#!/bin/bash
TTY=${TTY:-$(tty)}
TTY=${TTY#/dev/}

if [[ $TTY != tty* ]]; then
  printf '==> ERROR: invalid TTY\n' >&2
  exit 1
fi

printf -v vt 'vt%02d' "${TTY#tty}"

xinit -- "$vt" "$@"