Skip to main content
Topic: Testing seatd (not to necrobump the previous thread) (Read 2618 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Testing seatd (not to necrobump the previous thread)

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):
Code: [Select]
[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:
Code: [Select]
%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):
Code: [Select]
#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
Code: [Select]
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):
Code: [Select]
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).

Re: Testing seatd (not to necrobump the previous thread)

Reply #1
Does seatd actually do anything on a system with a single logged-in user?

Yeah it makes it possible to run graphics as a non-root user. You wouldn't have been able to start xorg in the first place.

Re: Testing seatd (not to necrobump the previous thread)

Reply #2
Yeah it makes it possible to run graphics as a non-root user. You wouldn't have been able to start xorg in the first place.
tried using seatd on my mate dinit system and could not run graphics as a non root user.  i only got a working desktop running as root.
Cat Herders of Linux

Re: Testing seatd (not to necrobump the previous thread)

Reply #3
I just uninstalled elogind and kexec-tools and rebooted, and I'm in the graphics (rootless xorg). What I can't do is login to another tty and get graphics, same as with seatd. Still not convinced that seatd does anything. Rebooting now with elogind, will try rebuilding dbus and polkit with elogind-git.

Re: Testing seatd (not to necrobump the previous thread)

Reply #4
tried using seatd on my mate dinit system and could not run graphics as a non root user.  i only got a working desktop running as root.

You need to actually run the daemon and add the your user to the correct group.

I just uninstalled elogind and kexec-tools and rebooted, and I'm in the graphics (rootless xorg).

In theory, this shouldn't have worked at all. You should have had a permissions error when trying to access /dev/dri/card0 (or whatever your gpu card number is) if you really removed elogind completely from your system.

Re: Testing seatd (not to necrobump the previous thread)

Reply #5
You need to actually run the daemon and add the your user to the correct group.

In theory, this shouldn't have worked at all. You should have had a permissions error when trying to access /dev/dri/card0 (or whatever your gpu card number is) if you really removed elogind completely from your system.
https://forum.artixlinux.org/index.php/topic,3050.msg27949.html#msg27949

followed op..  please advise.
Cat Herders of Linux

Re: Testing seatd (not to necrobump the previous thread)

Reply #6
I didn't remove libelogind, and I used automatic login (I don't use a login manager, just a function in .bash_profile
Code: [Select]
gui() {
    if [[ -z "${WINDOWPATH}" ]]; then
        local WIN=$(pidof Xorg | wc -w)
        rm -f /tmp/.gui${WIN}-${UID}*
        local LOG="$(mktemp -q /tmp/.gui${WIN}-${UID}-`date +%a%d%b%Y-%T`.log.XXXXXXXXXX)"
        local ERR="$(mktemp -q /tmp/.gui${WIN}-${UID}-`date +%a%d%b%Y-%T`-error.log.XXXXXXXXXX)"
        startx :${WIN} 1>${LOG} 2>${ERR}
    else
        echo 'To be run from the console - Aborting.'
    fi
}
Then typing "gui" at the console will log you in (on as many ttys as you want, works with elogind). And I started seatd-openrc when testing seatd. Did you mean I have to add myself to the "seat" group? seatd was started with "-g video" by default (which I'm a member of), if I recall correctly.

Re: Testing seatd (not to necrobump the previous thread)

Reply #7
The init scripts are currently a bit dated. They should run with the "seat" group. Currently some run with "video" and others with "seatd". That said, if you were in the video group and seatd was running as the video group, then this should have worked.

Re: Testing seatd (not to necrobump the previous thread)

Reply #8
A little bit more information would be nice.

So far i can see here, you using the openrc version. Wich DE?

Quote
For suspend, shutdown and reboot I added the following to /etc/sudoers:

This sadly dont readd the Shutdown and Restart Buttons back to KDE. Tried is already too.

Quote
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)

Everything from AUR? why?

Quote
Who needs loginctl? For XDG_RUNTIME_DIR, I tested adding

Code: [Select]
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.

Why is this needed?

Edit:

Quote
The init scripts are currently a bit dated. They should run with the "seat" group. Currently some run with "video" and others with "seatd".

Im since two days testing seatd in a VM. The seatd group even didnt exist. So i only added me to the two groups audio and input like in the post https://forum.artixlinux.org/index.php/topic,3050.0.html mentioned. And everything works.

Should i add me to seat?

Re: Testing seatd (not to necrobump the previous thread)

Reply #9
The init scripts are currently a bit dated. They should run with the "seat" group. Currently some run with "video" and others with "seatd". That said, if you were in the video group and seatd was running as the video group, then this should have worked.
i am capable of following written instructions.  i added myself to all the groups listed as well as the ones recommended in the arch link you posted about groups.  I wouldn't waste your time if i could get it to work.  I see that it works for many and that is awesome.  There are a few though, me and nokangaroo at least for who it appears to not be working.  If it worked, i would def use it.  I thank you for your hard work on this project.  I look forward to the day it is part of the iso builds from community live usbs.
Cat Herders of Linux

Re: Testing seatd (not to necrobump the previous thread)

Reply #10
pluto:
My DE is MATE with openbox as window manager (which can handle my keyboard shortcuts, so I'm not using mate-settings-daemon or mate-panel, I use tint2 instead. I use mate-session-manager, which is actually smaller than lxde-session and works better). As for the AUR packages an all the other modifications, I am plagued by this i915 interface freeze (with kernels later than 5.4), and I was trying to find out if it had anything to do with userspace applications, see the above dmesg code (apparently it's a pure kernel issue, but I like my modified DE and will keep it).
If you can't get shutdown and restart buttons, try defining keyboard shortcuts (that's what I did; for openbox that means adding code to rc.xml, for KDE I can't tell you, but there will be documentation). You may need to press the power button after shutting down.
The XDG_RUNTIME_DIR is used by dbus, dconf and gvfs (and xorg puts a cookie there). Adding lines to .bash_profile is just one possible way to get it, the canonical way would be installing pam_rundir (only if you use seatd, elogind creates XDG_RUNTIME_DIR automatically)

The posted PKGBUILD is still not quite correct, it creates a corrupt libelogind.pc (which is trivial to fix but elogind-249-pre seems to be hopelessly broken, and I don't recommend using it).

Re: Testing seatd (not to necrobump the previous thread)

Reply #11
pluto:
My DE is MATE with openbox as window manager (which can handle my keyboard shortcuts, so I'm not using mate-settings-daemon or mate-panel, I use tint2 instead. I use mate-session-manager, which is actually smaller than lxde-session and works better). As for the AUR packages an all the other modifications, I am plagued by this i915 interface freeze (with kernels later than 5.4), and I was trying to find out if it had anything to do with userspace applications, see the above dmesg code (apparently it's a pure kernel issue, but I like my modified DE and will keep it).
If you can't get shutdown and restart buttons, try defining keyboard shortcuts (that's what I did; for openbox that means adding code to rc.xml, for KDE I can't tell you, but there will be documentation). You may need to press the power button after shutting down.
The XDG_RUNTIME_DIR is used by dbus, dconf and gvfs (and xorg puts a cookie there). Adding lines to .bash_profile is just one possible way to get it, the canonical way would be installing pam_rundir (only if you use seatd, elogind creates XDG_RUNTIME_DIR automatically)

The posted PKGBUILD is still not quite correct, it creates a corrupt libelogind.pc (which is trivial to fix but elogind-249-pre seems to be hopelessly broken, and I don't recommend using it).

Ah ok. Did you tried this? https://wiki.archlinux.org/title/Intel_graphics#Kernel_crashing_w/kernels_4.0+_on_Broadwell/Core-M_chips

sure i could make keyboard shortcuts wich start "sudo poweroff" for example. Or simple Desktopicons wich does this. But that only a workaround :-)

Now i simply shutdown/restart with konsole and sudo poweroff/sudo reboot. But would be nice if i could use KDE native for that. And it should be possible how i already found out. But i only found solution for dinit, initd and 66. But sadly not with openrc.

And im to stupid to implement the found solutions to openrc :-)


Re: Testing seatd (not to necrobump the previous thread)

Reply #13

Not gonna happen, unless seatd becomes a full logind replacement.

this is possibly a stupid question because i am not familiar with it, but what is missing until now?

im investing much time the last few days with researching because i switched to seatd and collecting a bunch information. I tried few wide spread DEs already (KDE, GNOME, Cinnamon), at all it seems to work without problems (after fresh install, openrc). The only Problem all have common is that all lose the ability to reboot/shutdown over the Desktop.

Edit: and with all i had to manually add a variable to make nano as standard editor for user, root and sudo. Dont know if this wouldnt be needed with elogind.

Re: Testing seatd (not to necrobump the previous thread)

Reply #14
this is possibly a stupid question because i am not familiar with it, but what is missing until now?

im investing much time the last few days with researching because i switched to seatd and collecting a bunch information. I tried few wide spread DEs already (KDE, GNOME, Cinnamon), at all it seems to work without problems (after fresh install, openrc). The only Problem all have common is that all lose the ability to reboot/shutdown over the Desktop.

Power management is one of these features. GNOME, KDE, etc. use logind to suspend, poweroff and reboot.

Seatd also doesn't implement logind-stlye user access control lists.