How can I make a tinydm service?
There is an openrc one only.
https://gitlab.com/postmarketOS/tinydm
#!/sbin/openrc-run
# Copyright 2020 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
supervisor=supervise-daemon
name="tinydm"
description="tinydm"
command="/usr/bin/autologin"
command_args="tinydm-run-session"
depend() {
provide display-manager
need localmount
want dbus elogind
}
start_pre() {
# default to 1000 if none set in config
[ -z "$AUTOLOGIN_UID" ] && AUTOLOGIN_UID=1000
user=$(getent passwd ${AUTOLOGIN_UID} | cut -d: -f1)
if [ -z "$user" ]; then
eerror "ERROR: unable to find user with uid $AUTOLOGIN_UID"
return 1
fi
command_args="$user $command_args"
}
I made this for dinit, in /etc/dinit.d/tinydm:
type = process
command = "/usr/bin/autologin tinydm-runsession"
smooth-recovery = true
logfile = /var/log/dinit/tinydm.log
depends-on = dbus logind
waits-for = loginready
waits-for.d = live.d
It is not working:
dinitctl start tinydm
dinitctl: failed to find service description.
dinitctl: check service description file exists / service name spelling.
I have autologin installed.
My guess would be the following:
The dint service file: /etc/dinit.d/tinydm
type = process
command = /etc/dinit.d/scripts/tinydm
smooth-recovery = true
depends-on = logind
waits-for = loginready
waits-for.d = live.d
The following starting script is based on sddm's dinit package.
Create a system user (a vacate <1000 entry) and group for tinydm daemon.
The starting script in /etc/dinit.d/scripts/tinydm.
#!/bin/sh
mkdir -p /var/lib/tinydm
mkdir -p /run/user/<tinydm user number>
chown -R tinydm:tinydm /var/lib/tinydm
chown -R tinydm:tinydm /run/user/<tinydm user number>
chmod 700 /run/user/<tinydm user number>
exec "/usr/bin/autologin tinydm-runsession"
Be sure to make the starting script executable.
Some tweaking most likely will be required and there is no guarantee that it will actually work.
Please see tinydm issue number 2 (https://gitlab.com/postmarketOS/tinydm/-/issues/2).
Something about autologin being an issue that is not a bug in tinydm according to the developer.
Due to being an "interesting package" without an AUR listing I would think that no one else using "dinit" has ever heard of or even tried it out.
Hi!
I think the problem is your `depends-on`. In Dinit syntax you need to use a new line for every depends. Example:
# Incorrect: depends-on = dbusd elogind
depends-on = dbusd
depends-on = elogind
Also `dinitcheck` is installed on artix to help you for debugging your service:
sudo dinitcheck tinydm
Regards
The openrc service adds the username between the commands, after "autologin".
That is set in /etc/conf.d/tinydm.
Not sure to how add that to the dinit service, I se it manually.
No need to quote in exec.
In /etc/dinit.d/scripts/tinydm:
#!/bin/sh
mkdir -p /var/lib/tinydm
chown -R tinydm:tinydm /var/lib/tinydm
exec /usr/bin/autologin <user> tinydm-run-session
It seems that ~/.Xresources is ignored.
I packaged tinydm and tinydm-dinit.
Is there an example to how create the user/group for "chown -R tinydm:tinydm"?
I looked the sddm's dinit package for the script.
Please see 5.2 Example adding a system user (https://wiki.archlinux.org/title/Users_and_groups)
In this case the second example is the way to go. I edited the username to "tinydm".
(*) Check existing assigned numbers and elect a unused number which is not usually assign to common application daemons.
You can use any number you want that is free but usually system type daemon users are created with numbers below 1000.
One can also use one of GUI user and group desktop applications to create the user and group.
For daemons the shell should be "/usr/bin/nologin". One can edit the number as desired if required.
How can I add that to the PKGBUILD?
Like in this file https://gitea.artixlinux.org/packagesL/lightdm/src/branch/master/x86_64/extra/lightdm.sysusers ?
~/.Xresources is ignored, it was not on lightdm.
Is this a tinydm bug?
The following line from the linked PKGBUILD:
install -m 644 ../lightdm.sysusers "${pkgdir}"/usr/lib/sysusers.d/lightdm.conf
Thus you would have to add a similar line to your new PKGBUILD's package section.
install -m 644 ../tinydm.sysusers "${pkgdir}"/usr/lib/sysusers.d/tinydm.conf
Note the path maybe different on your setup, adjust accordingly.
The actual "tinydm.sysusers" file would have to be created.
Posting an issue on the project's code site is a good idea because it helps the devs gain knowledge of the issue and hopefully to create modifications to the project's code.
"Autologin" could be the source of the issue so you may want to check autologin's code site as well.
I am not sure if the lack of reading .Xresources when using Xorg is a bug or just a lack of feature which display manager applications should be able to do. It is "tiny" after all.
I made the thing that make the tinydm user, thanks.
Is something like the openrc service doable on dinit?
Using something like "exec /usr/bin/autologin $user tinydm-runsession" on /etc/dinit.d/scripts/tinydm, to fetch the value set in the config.
I now found out that it is not supposed to load .Xresources.
I added it manually in the wrapper that I am using "xrdb -merge "$HOME"/.Xresources".
Based on the openrc stuff my best guess would be:
AUTOLOGIN_UID=1000
user=$(getent passwd ${AUTOLOGIN_UID} | cut -d: -f1)
I would place in the /etc/dinit.d/scripts/tinydm file at the beginning since it has to run before anything else.
This should be able to populate the user variable correctly.
The openrc configuration file showed AUTOLOGIN_UID as being a static variable.
The openrc script shows shows logic loop to ensure the configuration file information for the AUTOLOGIN_UID is able to be read.
Thus it seems to me that the simplest approach is to add the required static AUTOLOGIN_UID variable into the dinit script.
Since the AUTOLOGIN_UID variable is now defined inside the file, the step to check for a readable variable would be redundant.
With this one you use the file in /etc, in case you want to use other init.
#!/bin/sh
source /etc/conf.d/tinydm
[ -z "$AUTOLOGIN_UID" ] && AUTOLOGIN_UID=1000
user=$(getent passwd ${AUTOLOGIN_UID} | cut -d: -f1)
if [ -z "$user" ]; then
eerror "ERROR: unable to find user with uid $AUTOLOGIN_UID"
return 1
fi
mkdir -p /var/lib/tinydm
chown -R tinydm:tinydm /var/lib/tinydm
exec /usr/bin/autologin $user tinydm-run-session