Linux Systemd, XBMC, autologin & D-Bus authentication
#1
Just wondering if anyone here had a full systemd setup and XBMC running on it. So far, I have gotten XBMC autologin to work on systemd, but it fails to connect to D-Bus, so I cannot suspend/shutdown/reboot/hibernate.

Arch Linux will somewhere in the future be switching to systemd, so I am migrating my systems, but the D-Bus thing is proving a particular PITA.
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#2
So, any takers? Big Grin
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#3
I've got two boxes running Arch 32-bit that switched over to systemd a couple weeks ago and I have suspend, resume, reboot and shutdown working (haven't tried Hibernate but it appears on the XBMC shutdown menu). I don't have XBMC running as a systemd service. I set up a service that launches mingetty to autologin (as user xbmc). Based on similar instructions I found somewhere to autolaunch agetty, I created a file called /etc/systemd/system/[email protected]:
Code:
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Getty on %I
Documentation=man:mingetty(8)
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

# On systems without virtual consoles, don't start any getty. (Note
# that serial gettys are covered by [email protected], not this
# unit
ConditionPathExists=/dev/tty0

[Service]
Environment=TERM=linux
# the VT is cleared by TTYVTDisallocate
ExecStart=-/sbin/mingetty --autologin xbmc tty1 linux
Type=simple
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no

# 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=

# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
KillSignal=SIGHUP

[Install]
Alias=getty.target.wants/[email protected]
WantedBy=graphical.target

Created the following symlink:
Code:
# ln -s /etc/systemd/system/[email protected] /etc/systemd/system/getty.target.wants/[email protected]

Then I enabled the service with:
Code:
# systemctl enable [email protected]

I start X from ~/.bashrc:
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
    startx
    logout
fi

and XBMC launches from ~/.xinitrc with:
Code:
exec ck-launch-session /usr/bin/xbmc --standalone &> /dev/null

I tried a few other variations before this worked so hopefully I haven't omitted something.
Reply
#4
Wow, thanks. That is one hefty systemd file. I use autologin as well now on the traditional init system, I'll give your stuff a shot.
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#5
autostart X as a user is no problem in systemd https://wiki.archlinux.org/index.php/Sys...rvice_file

But automount is still a problem on my setup. Is this kind of thing also handled by dbus?
Reply
#6
Just wanna thank you guys.
Now systemd is fun again
Reply
#7
If you use lightdm or other DE, you can setup auto-login through it and it will register you with consolekit/policykit/dbus

You can possibly setup xrandr and keyboard layouts with scripts.
Reply
#8
ConsoleKit is deprecated. I think you should just use systemd, polkit, upower, udisks. IIRC pm features and automounts for user worked out of the box (Openbox and no DM).
https://wiki.archlinux.org/index.php/Sys...er_systemd
Reply
#9
(2012-09-01, 04:17)mrchris Wrote:
Code:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
    startx
    logout
fi


Code:
exec ck-launch-session /usr/bin/xbmc --standalone &> /dev/null

What does the "logout part" do?


ConsoleKit will interefere with systemd-login so it should be:

exec /usr/bin/xbmc-standalone
Reply
#10
That's why I leave it to lightdm to autologin to the XBMC session. Lightdm will take care of whatever ck, polkit, d-bus requirements there are and additionally you can setup displays, touchpad, etc with lightdm scripts because it would be harder to do in console before XBMC is started.
Reply

Logout Mark Read Team Forum Stats Members Help
Systemd, XBMC, autologin & D-Bus authentication0