Artix Linux Forum

Init systems => dinit => Topic started by: matthewbbarthet on 15 August 2024, 15:22:40

Title: ly dm dinit scripts
Post by: matthewbbarthet on 15 August 2024, 15:22:40
Anyone successfully made a dinit service script for the ly dm, theres no package and i cant manage
Title: Re: ly dm dinit scripts
Post by: Artist on 15 August 2024, 21:49:49
Creating these these scripts for our init's is on my todo list, but not at the top.
You'll find Ly's own script for s6 here: https://github.com/fairyglade/ly/tree/master/res/ly-s6

artist

Title: Re: ly dm dinit scripts
Post by: Artist on 15 August 2024, 22:25:37
FYI: there is a very good alternative for Ly as TUI display manager; Tuigreet.
This comes as packages greetd-tuigreet, and depends on packages greetd and greetd-<init> which are all in the Artix repos.
Tuigreet is a solid program with hardly ever any open issues, and well documented.

One advantage of Tuigreet is that the actual greeter/login process runs as an unprivileged greeter user.

artist
Title: Re: ly dm dinit scripts
Post by: jahway603 on 16 August 2024, 06:03:48
Anyone successfully made a dinit service script for the ly dm, theres no package and i cant manage

If you install the ly Artix package, then it will make sure the ly-dm binary is installed on the system.

There isn't any Artix package yet for ly-dinit, but upstream's dinit service script that you can slightly modify is located here
https://github.com/fairyglade/ly/blob/master/res/ly-dinit

You'll change line 4 in upstream to read
Code: [Select]
command         = /usr/bin/ly-dm

Title: Re: ly dm dinit scripts
Post by: lollox on 23 August 2024, 19:00:07
Anyone successfully made a dinit service script for the ly dm, theres no package and i cant manage

If you install the ly Artix package, then it will make sure the ly-dm binary is installed on the system.

There isn't any Artix package yet for ly-dinit, but upstream's dinit service script that you can slightly modify is located here
https://github.com/fairyglade/ly/blob/master/res/ly-dinit

You'll change line 4 in upstream to read
Code: [Select]
command         = /usr/bin/ly-dm



I used ly before and for the sake of it I decided to try it out again, but failed.
I did what you described with the script in artix ly-dinit package, changing the command parameter  to /usr/bin/ly-dm , but ly does not start at all.
ly service should be enabled like a normal system service with sudo dinitctl enable, right?
Title: Re: ly dm dinit scripts
Post by: Artist on 23 August 2024, 19:20:12
Try:
- dinitctl start ly
- /usr/bin/ly-dm

and see if this produces any errors.

And provide details on how ly has been configured.

artist
Title: Re: ly dm dinit scripts
Post by: lollox on 23 August 2024, 20:39:43
Oh maybe I found why
From the ly github page https://github.com/fairyglade/ly?tab=readme-ov-file#dinit

Code: [Select]
dinit
# zig build installdinit
# dinitctl enable ly
In addition to the steps above, you will also have to keep a TTY free within /etc/dinit.d/config/console.conf.

To do that, change ACTIVE_CONSOLES so that the tty that ly should use in /etc/ly/config.ini is free.


To do that, change ACTIVE_CONSOLES so that the tty that ly should use in /etc/ly/config.ini is free.
How do I do this?

Ok I have this file    /etc/dinit.d/config/console.conf.

Code: [Select]

# Active consoles
# Currently available: /dev/tty1 until /dev/tty6
ACTIVE_CONSOLES="/dev/tty[1-6]"



Do I just edit like this: /dev/tty[1-5] ?
Title: Re: ly dm dinit scripts
Post by: Artist on 23 August 2024, 20:52:34
In file /etc/ly/config.ini there is a section:

# TTY in use
tty = 2

where tty can be modified to ie. 7

artist
Title: Re: ly dm dinit scripts
Post by: lollox on 23 August 2024, 21:24:11
 Okay this time  I did not modify /etc/dinit/ly and /etc/dinit.d/config/console.conf.
I just edited /etc/ly/config.ini  tty = 7, and started ly (as root).
I get this error
Code: [Select]
# dinitctl status ly
Service: ly
    State: STOPPED (could not be launched)
        Stage: executing command
        Error: Permission denied

I also made sure that my .xinitrc is executable as told in that github page

Edit: the file I edited was /etc/ly/config.ini, my bad
Title: Re: ly dm dinit scripts
Post by: davmac on 27 August 2024, 09:44:40
Okay this time  I did not modify /etc/dinit/ly

I hope you mean that you left the "command = /usr/bin/ly-dm" line intact?


and /etc/dinit.d/config/console.conf.
I just edited /etc/ly/config.ini  tty = 7, and started ly (as root).
I get this error
Code: [Select]
# dinitctl status ly
Service: ly
    State: STOPPED (could not be launched)
        Stage: executing command
        Error: Permission denied

That probably means the command executable (/usr/bin/ly-dm) is not marked executable, for some reason. Seems strange.

What does "ls -l /usr/bin/ly-dm" report?

Title: Re: ly dm dinit scripts
Post by: lollox on 27 August 2024, 18:11:16
Code: [Select]

cat /etc/dinit.d/ly
type            = process
restart         = true
smooth-recovery = true
command         = /usr/bin/$EXE_NAME
depends-on      = loginready
termsignal      = HUP
# ly needs access to the console while loginready already occupies it
options         = shares-console

That above is the default service file.
I did modify "/usr/bin/$EXE_NAME'" with "/usr/bin/ly-dm" before, now I have the default one.

Code: [Select]

 ls -l /usr/bin/ly-dm
-rwxr-xr-x 1 root root 586720 24 ago 16.52 /usr/bin/ly-dm

Title: Re: ly dm dinit scripts
Post by: davmac on 28 August 2024, 01:47:05
I did modify "/usr/bin/$EXE_NAME'" with "/usr/bin/ly-dm" before, now I have the default one.

That is the problem, it needs to be modified. Without the "EXE_NAME" environment variable being set to anything, that just comes as "/usr/bin/". That's why you get "permission denied" - you've told Dinit to execute a directory.

Most likely that original file is used as a template in the ly build, i.e. it will replace $EXE_NAME with the actual executable name. (I haven't checked this but it's highly likely).
Title: Re: ly dm dinit scripts
Post by: lollox on 28 August 2024, 19:25:20
I changed back to  "/usr/bin/ly-dm". But I have faced some issues:
no matter if I set "tty = 7" in /etc/ly/config.ini,  ly always starts on tty 1.
WIth the default /etc/dinit.d/config/console.conf  (tty 1 to 6) trying to start ly, doesn't start it but it gives a bunch of error on said tty ( tty 1), even though in dinitctl status the service's state is STARTED.

Second try, I modified /etc/dinit.d/config/console.conf  (tty 2 to 6), so ly actually starts and shows up on tty 1, but when I try  to login it gives this error: /usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server

Third try, I created this file
Code: [Select]
cat /etc/X11/Xwrapper.config
allowed_users = anybody
Now I don't get the error above, but Xorg crashes with this error (this happens regardless if I set "tty = 1" or "tty = 7" in /etc/ly/config.ini, having set dinit tty between 2 and 6) :

Code: [Select]
[  1892.706] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[  1892.706] (EE)
Fatal server error:
[  1892.707] (EE) xf86OpenConsole: Cannot open virtual console 7 (Permission denied)
[  1892.707] (EE)
[  1892.707] (EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
 for help.
[  1892.707] (EE) Please also check the log file at "/home/prova/.local/share/xorg/Xorg.1.log" for additional information.
[  1892.707] (EE)
[  1892.707] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
[  1892.707] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
[  1892.707] (EE) Server terminated with error (1). Closing log file.

That's weird, as I can normally start xorg with startx or xinit.
Title: Re: ly dm dinit scripts
Post by: negative on 28 January 2025, 07:35:16
anyone able to get ly to run properly? i have already changed $EXE_NAME to ly-dm, tty is set to 2 (dunno if console_dev nothing changed if i set this anyways). when booting system, im getting zig/ly related errors and tty1 and nothing else on other tty[2-6] or even tty7 if i set it in config. running ly-dm directly from terminal, its main interface appears, but nothing when started from boot through dinit.
Title: Re: ly dm dinit scripts
Post by: Artist on 28 January 2025, 09:15:07
Please provide the error's you see and also from any log file.
It might not make a difference, but you can test ly-git from the omniverse repository.

FYI: there is a very good alternative for Ly as TUI display manager; Tuigreet.
This comes as packages greetd-tuigreet, and depends on packages greetd and greetd-<init> which are all in the Artix repos.
Tuigreet is a solid program with hardly ever any open issues, and well documented.

One advantage of Tuigreet is that the actual greeter/login process runs as an unprivileged greeter user.

artist
Title: Re: ly dm dinit scripts
Post by: negative on 28 January 2025, 12:41:44
im only getting this message on tty1, pressing enter will should normal artix login prompt. no ly interface appears on any other tty. moving default tty in /etc/ly/config to 2 or 7 (not use by console) still no ly. try ly from "world" repo and ly-git from "omniverse" still the same
Title: Re: ly dm dinit scripts
Post by: Artist on 28 January 2025, 14:34:51
One required variable is probably missing. One of the downsides of Ly is that the errors are not helpful.
So, carefullly compare your setup for Ly to what is required. Note that the agetty related instructions most probably also apply for dinit.

artix
Title: Re: ly dm dinit scripts
Post by: negative on 29 January 2025, 03:00:24
ok, managed to get LY working by replacing "command = /usr/bin/$EXE_NAME" to point to a custom shell sript that run "/usr/bin/agetty -nl /usr/bin/ly-dm 38400 linux"

wierd to have a dinit script included which is incomplete. even the upstream ly repo uses the same incomplete dinit script, at least it should follow how ly was implemented in runit for example.
Title: Re: ly dm dinit scripts
Post by: danielwerg on 12 February 2025, 08:55:08
@negative I got same exact issue as you, tried everything and changing to "/usr/bin/agetty -nl /usr/bin/ly-dm 38400 linux", nothing helped. I'm trying to get ly to start in tty2 only, but for now I only experimented with tty7. tty7 is just blank page with blinking cursor no matter what I change.

I'm afraid of breaking stuff in `/etc/dinit.d/config/console.conf`, can I change it to `ACTIVE_CONSOLES="/dev/tty[1,3-6]"`to free tty2?

@negative Could you share all the files that needed for ly? Like git repo or something else if you got it, been stuck on this for past two days. Might just give up and try "Tuigreet" like @Artist suggested.

related: https://github.com/davmac314/dinit/discussions/440
Title: Re: ly dm dinit scripts
Post by: negative on 12 February 2025, 09:41:22



im just using the modified launcher from ly-runit. copy this code into your executable path (e.g.  /usr/bin/). Make it executable.

Code: [Select]
#!/bin/sh

## Get the tty from the conf file
CONFTTY=$(cat /etc/ly/config.ini | sed -n 's/^tty.*=[^1-9]*// p')

## The execution vars
# If CONFTTY is empty then default to 2
TTY="tty${CONFTTY:-2}"
TERM_NAME=linux
BAUD=38400

[ -r conf ] && . ./conf

if [ -x /sbin/getty -o -x /bin/getty ]; then
# busybox
GETTY=getty
elif [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux
GETTY=agetty
fi

#setsid
exec ${GETTY} ${GETTY_ARGS} -nl /usr/bin/ly-dm "${TTY}" "${BAUD_RATE}" "${TERM_NAME}"
#exec setsid /usr/bin/ly-dm

then modify /etc/dinit/ly. change "command = $EXE_NAME" to "command = <path_to_script_from_above>".

enable service. this should be enough to make ly work.
Title: Re: ly dm dinit scripts
Post by: danielwerg on 12 February 2025, 16:06:35
@negative Thank you! I managed to get it working on tty7, what did you set "ACTIVE_CONSOLES" to make it work with tty2?

Never mind, found this: https://manpages.debian.org/testing/console-setup/console-setup.5.en.html#ACTIVE_CONSOLES and https://askubuntu.com/a/817859

It is a wild card so setting it to
Code: [Select]
/dev/tty[1,3-6]
should work.
Title: Re: ly dm dinit scripts
Post by: danielwerg on 12 February 2025, 16:22:59
Spoke too soon,  after reboot it crashed Hyprland that autostarts on tty1 and switches to tty2 with ly...

I'm giving up, not worth it with my setup.
Title: Re: ly dm dinit scripts
Post by: Artist on 12 February 2025, 18:04:59
Did you disable the agetty service(s) for the tty(s) you want to use? That is required.

Or indeed try Greetd with Tuigreet.

artist
Title: Re: ly dm dinit scripts
Post by: n00b on 12 February 2025, 21:29:46
I think tuigreet needs it's own wiki section.
Title: Re: ly dm dinit scripts
Post by: negative on 13 February 2025, 01:03:58
Spoke too soon,  after reboot it crashed Hyprland that autostarts on tty1 and switches to tty2 with ly...

I'm giving up, not worth it with my setup.
disable tty2,

Code: [Select]
# sudo dinitctl disable tty2

i had mine on default, so it starts at tty7 which console and default agetty is not
Title: Re: ly dm dinit scripts
Post by: Darth_Dan on 15 March 2025, 16:27:18
Trying to figure out much the same.
My "/etc/ly/config.ini" is set to start in tty7;
I have additionally changed "/etc/dinit.d/ly" to include the following:

Code: [Select]
inittab-id = 7
inittab-line = tty7

I've also played around with switching the "options" variable between "starts-on-console" and the default "shares-console".
I've used the fix provided in this thread to boot into tty7 with agetty.

My result is that the I do, indeed, boot with tty7 open, however ly is open in tty1 at boot; and is fighting for control over the terminal with the default login script. I'm lost on how to specify it to actually start into tty7.
Does one need to actually compile it from source, then? Or how did you manage to get it running there, @negative and @danielwerg ?
Title: Re: ly dm dinit scripts
Post by: Artist on 15 March 2025, 17:21:16
did you disable the relevant agetty service as instructed in the ly reedme?

artist
Title: Re: ly dm dinit scripts
Post by: Darth_Dan on 15 March 2025, 18:59:03
did you disable the relevant agetty service as instructed in the ly reedme?

There never was an agetty service for tty7, only 1 through 6.
Title: Re: ly dm dinit scripts
Post by: davmac on 28 March 2025, 02:44:06
Since this keeps coming up (here and elsewhere), I've had a bit of a look at the state of things. Let me weigh in:


I hope that clears things up.