For me, the reasons for getting rid of elogind were dmesg errors like these (only with kernels later than 5.4, and regardless of kernel config, kernel commandline or BIOS settings):
[112632.955495] Asynchronous wait on fence 0000:00:02.0:elogind[1165]:4f482 timed out (hint:intel_atomic_commit_ready [i915])
[112636.925429] i915 0000:00:02.0: [drm] GPU HANG: ecode 9:1:878aaff9, in elogind [1165]
...
[ 3680.505752] i915 0000:00:02.0: [drm] Resetting rcs0 for preemption time out
[ 3680.505778] i915 0000:00:02.0: [drm] elogind[1171] context reset due to GPU hang
[ 3680.510459] i915 0000:00:02.0: [drm] GPU HANG: ecode 9:1:86dfaff9, in elogind [1171]
Turns out it didn't stop the freezes, but here's my experience with seatd FWIW.
seatd, dbus and polkit just need libelogind to run (elogind is only a buildtime dependency; the headers could be packaged with libelogind, or separately (an "elogind-headers" package would be nice, see below). I tested libelogind-249-pre, though the binary package also works. I've already been using custom-built dbus (no audit) and polkit (with duktape, which fortunately is the default now). For suspend, shutdown and reboot I added the following to /etc/sudoers:
%users ALL = NOPASSWD: /usr/local/lib/suspend,/usr/bin/openrc-shutdown -H 0,/usr/bin/openrc-shutdown -r 0
suspend is a little C program (doesn't currently work with linux-next, suspends only once, then hangs; works with mainline and 5.4):
#include <stdio.h>
#include <stdlib.h>
int main(void) {
FILE *state;
state = fopen("/sys/power/state", "r+");
if (state == NULL) {
exit(EXIT_FAILURE);
}
fprintf(state, "%s", "mem");
fclose(state);
exit(EXIT_SUCCESS);
}
I put it in /usr/local/lib because I don't want it on my path. This program could of course be expanded to handle shutdown and reboot as well (not currently needed). Who needs loginctl? For XDG_RUNTIME_DIR, I tested adding
export XDG_RUNTIME_DIR=`mktemp -d /tmp/xdg-${UID}-XXXXXXXXXX`
echo "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" > ~/.pam_environment
to .bash_profile, which works perfectly well. There is also a pam_rundir package, which I also tested (it creates the usual /run/user/$UID).
The elogind-git package needed a hack to build (here's a working PKGBUILD):
pkgbase=elogind
pkgname=('elogind' 'libelogind' 'elogind-headers')
pkgver=249.pre.r0.g06e702c9d
pkgrel=6
pkgdesc="The systemd project's logind, extracted to a standalone package"
arch=('x86_64')
url="https://github.com/elogind/elogind"
license=('GPL' 'LGPL2.1')
makedepends=('intltool' 'gperf' 'gtk-doc' 'polkit' 'dbus'
'libseccomp' 'meson' 'kexec-tools' 'openrc' 'libcap' 'python-jinja' 'elogind-headers')
options=('!libtool')
source=("git+https://github.com/elogind/elogind")
sha256sums=('SKIP')
groups=(modified)
pkgver() {
cd "${srcdir}/elogind"
git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g;s/\:/./g'
}
build() {
# -Dman=false avoids a build error
local meson_options=(
-Drootlibdir=/usr/lib
-Drootlibexecdir=/usr/lib/elogind
-Ddbuspolicydir=/usr/share/dbus-1/system.d
-Ddocdir=/usr/share/doc/elogind
-Ddefault-hierarchy=hybrid
-Dcgroup-controller=openrc
-Daudit=false
-Dman=false
-Ddefault-kill-user-processes=false
)
meson "${pkgbase}" build "${meson_options[@]}"
#***EVIL*** hack to avoid build error:
sed -i -e "/^meson.add_install_script('sh', '-c', 'touch/d" "${srcdir}"/elogind/src/core/meson.build
#end ***EVIL*** hack
meson compile -C build
}
check(){
meson test -C build --print-errorlogs
}
package_elogind() {
pkgdesc="The systemd project's logind, extracted to a standalone package"
provides=("elogind=${pkgver}" 'logind')
depends=('acl' 'dbus' 'libseccomp' 'libelogind' 'kexec-tools' 'udev')
optdepends=('polkit: polkit support')
backup=('etc/elogind/logind.conf')
#***EVIL*** hack
mkdir -p "${pkgdir}"/usr/lib/elogind/system-{shutdown,sleep}
touch "${pkgdir}"/usr/lib/elogind/system-{shutdown,sleep}/.keep_dir
#end ***EVIL*** hack
DESTDIR="${pkgdir}" meson install -C build
ln -sfv libelogind.pc "${pkgdir}"/usr/lib/pkgconfig/libsystemd.pc
install -dm755 "${srcdir}"/_libelogind
mv -v "${pkgdir}"/usr/lib/libelogind*.so* "${srcdir}"/_libelogind
install -d "${pkgdir}"/{etc,usr/lib}/elogind/{logind,sleep}.conf.d
}
package_libelogind() {
pkgdesc="elogind client libraries"
provides=('libelogind.so' "libelogind=${pkgver}" 'liblogind')
depends=('libcap' 'libudev')
cd "${pkgbase}"
install -dm755 "${pkgdir}"/usr/lib
mv "${srcdir}"/_libelogind/libelogind*.so* "${pkgdir}"/usr/lib
#cp -R "${pkgdir}"../elogind/usr/include "${pkgdir}"/usr/
ln -sfv libelogind.so "${pkgdir}"/usr/lib/libsystemd.so
ln -sfv libsystemd.so "${pkgdir}"/usr/lib/libsystemd.so.0
}
package_elogind-headers() {
mkdir -p ${pkgdir}/usr/include/elogind
cp -R --no-preserve='ownership' ${srcdir}/elogind/src/systemd ${pkgdir}/usr/include/elogind
cd ${pkgdir}/usr/include/elogind
for file in systemd/*.h; do ln -s $file ./${file/systemd//}; done
}
I tested {,lib}elogind-249-pre built with this PKGBUILD, see below.
Does seatd actually do anything on a system with a single logged-in user? "ps axo seat" came up empty except for a column of dashes. (Even when I logged in again on a different tty, which incidentally took very long, and I didn't get graphics - it turned out to be a libelogind-249-pre issue, works with {,lib}elogind-246-10, including the one built against elogind-headers. Maybe polkit and dbus also need to be rebuilt, but since seatd doesn't do anything for me, I'm done testing).