Skip to main content
Topic: [WIP] seatd support (elogind alternative) (Read 16121 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[WIP] seatd support (elogind alternative)

Previously there was a brief attempt at packaging seatd as an alternative to elogind, but we found some issues and put it aside for awhile. Well time has passed and another look was given. This time around, with the help of an additional pam module, seatd support is looking much, much viable as a valid choice. Some more work needs to be done, but here's a brief tutorial on how to switch your system from using elogind to seatd.

Why use seatd?
elogind works great however it is quite complicated and large. By its nature, it is very tied to upstream systemd development (for better or worse). Additionally, it has a runtime dbus dependency. On the other hand, seatd's source code is magnitudes smaller and much easier to understand. It has a logind API implementation in one single C file so it is still compatible with software that uses logind.

Init System Support Status
openrc: implemented
runit: implemented
s6: implemented
dinit: implemented

Note: it is highly recommended that you perform these commands in a separate TTY and not in a graphical environment. Playing around with the elogind daemon will likely kill your graphical session at some point. Make sure all important work is saved before proceeding.

pam_rundir
One important thing that elogind provides is automatic creation and handling of the XDG_RUNTIME_DIR environment variable and directories. seatd does not do this and many, many programs (wayland, pulseaudio, dbus, etc.) write runtime user data here so you mostly want this. Instead of using the elogind daemon, we can use a PAM module called pam_rundir that handles the directory creation and the XDG_RUNTIME_DIR environment variable. It is merely about 300 lines of C code and only ever executes on system login/logout. All it does it create/delete the /run/user directories as appropriate and export the XDG_RUNTIME_DIR environment variable.
Code: [Select]
$ sudo pacman -S pam_rundir

seatd-${init}
Installing this likely removes elogind-${init} from your system so do not be surprised if your graphical session dies/restarts at this point. After you have seatd-${init} installed, you can add it to your service manager's defaults. e.g. for s6/s6-rc:
Code: [Select]
$ sudo pacman -S seatd-s6
$ sudo touch /etc/s6/adminsv/default/contents.d
$ sudo s6-db-reload

elogind removal
Strictly speaking, this part is optional. If you leave elogind on your system, it will still work fine. The dbus autostarting feature will make elogind always start by itself on login so it is a bit wasteful. You can opt to remove it totally.
Code: [Select]
$ sudo pacman -Rdd elogind
Of course, never lightly use -Rdd but in this case it is okay. seatd only needs libelogind to function. Programs that depend on elogind should function perfectly fine with seatd/libseat. Artix needs to update the package dependencies to be a bit more generic, but for now this is OK.

Add users to groups
One thing systemd (and by extension elogind) did was magically handle a lot of group stuff in the background. So your user did not need to be a part of the video group to start xorg for example. Without elogind, this no longer happens so you have to add your user to the correct groups if you want things to still work normally. See the Arch wiki page for a list of some of these groups. You almost certainly want to add your user to audio and input at a minimum. seatd runs with the seat user so you will need to add yourself there for graphics.
Code: [Select]
$ sudo gpasswd -a $USER seat
$ sudo gpasswd -a $USER audio
$ sudo gpasswd -a $USER input
Add yourself and other users to more groups as needed. After that, you can just perform a reboot and you should be good to go. Enjoy using seatd!

 

Re: [WIP] seatd support (elogind alternative)

Reply #1
You will need to enable the [universe] repo in your pacman.conf settings if you have not done so.
Code: [Select]
[universe]
Server = https://universe.artixlinux.org/$arch
Server = https://mirror.pascalpuffke.de/artix-universe/$arch
Will this feature be only available in universe repo or it could be moved to official repos?
ARMtix


Re: [WIP] seatd support (elogind alternative)

Reply #3
Looking forward to seatd support in 66! :)

Edit: Just replaced elogind with seatd, rebooted and it works, thanks!
There is a seatd-suite66 in universe. I am currently trying to get a sort of logind selection/option for the scripts, instead of a hard dep on one or the other.

Re: [WIP] seatd support (elogind alternative)

Reply #4
Will this feature be only available in universe repo or it could be moved to official repos?
Universe is just a stopgap for now until we finish updating our packaging to support any logind backend. elogind is a bit of a hard depend at the moment.

Re: [WIP] seatd support (elogind alternative)

Reply #5
There is a seatd-suite66 in universe. I am currently trying to get a sort of logind selection/option for the scripts, instead of a hard dep on one or the other.
Hmm, curiously it works with elogind removed (didn't remove elogind-suite66 and libelogind though, as they report the removal would break dependencies) and seatd and seatd-suite66 installed.

Re: [WIP] seatd support (elogind alternative)

Reply #6
Hmm, curiously it works with elogind removed (didn't remove elogind-suite66 and libelogind though, as they report the removal would break dependencies) and seatd and seatd-suite66 installed.
Yep :) though I want to figure out a way to make 66 accept variable in *depends field or may have to do something similar to how Dudemanguy did it in s6.

Re: [WIP] seatd support (elogind alternative)

Reply #7
I am running 66 as well. Will consider switching to seatd in the future.


Re: [WIP] seatd support (elogind alternative)

Reply #9
Of course. It's just that myself and @ndowens are the main ones working on this and we use s6 and suite66 respectively. :P

Re: [WIP] seatd support (elogind alternative)

Reply #10
I have just finished a major rewrite of pam_rundir and you can see the source here. The functionality should be the same. I removed the complicated counting logic the original implementation had and instead used utmp for tracking user logins. Additional other small improvements are in there like switching to snsprintf() and so on. The universe package has been updated to this new release (v1.1.0). Please try it and let me know if you encounter any problems.

Sidenote: the package now has an install file that adds the pam_rundir.so line to pam on install and removes it on uninstall so you don't have to do it manually anymore. Ideally this just gets added to the default pambase file in the future.

Re: [WIP] seatd support (elogind alternative)

Reply #11
No problem @Dudemanguy‍. I don´t panic. Good things come to those who can wait :)
Actually I wanted to have tried s6 & Co for a long time, but little time and the complexity have prevented me so far.

Btw... great job


Re: [WIP] seatd support (elogind alternative)

Reply #13
Have you enabled pam_rundir.so as the article says?

If it's not working, you can do it "manually" like the Qt apps do:

Code: [Select]
export XDG_RUNTIME_DIR="/tmp/runtime-$(id -un)"
mkdir -p "$XDG_RUNTIME_DIR" && chmod 700 "$XDG_RUNTIME_DIR" &&
sway

While I'll stay with elogind on Artix until package dependencies are sorted out, I'll try building and running pam_rundir.so on other Linux distros (where I'm already using seatd).

Re: [WIP] seatd support (elogind alternative)

Reply #14
Hello, I followed this tutorial but I got a message like this link:

https://www.reddit.com/r/voidlinux/comments/knqwq8/how_to_get_sway_to_work/

I don't know if I have to set an environment variable or something like that. I followed step by step carefully.

At the moment I switched back to elogind.

Best regards.
pam_rundir should automatically set the environment variable. Are you saying it did not?