Artix Linux Forum

Init systems => runit => Topic started by: spike32 on 07 January 2021, 19:48:11

Title: Self-made runit init script
Post by: spike32 on 07 January 2021, 19:48:11
Hi everyone! I'm trying to setup this display manager https://github.com/drozdowsky/ly-void which looks pretty nice to me, since I'm using i3 with no desktop environment. I have succesfully installed it following the README. However, this one was made for void linux which keeps services in /etc/sv/ and links them to /var/service/ . So what I tried to do is creating /etc/runit/sv/ly-runit-service/run with this content https://raw.githubusercontent.com/drozdowsky/ly-void/master/res/ly-runit-service/run and I made it executable by running sudo chmod a+x /etc/runit/sv/ly-runit-service/run .

Then I tried:
- sudo ln -s /etc/runit/sv/ly-runit-service /etc/runit/service/
but if I try:
- sudo sv restart ly-runit-service
it says:
- fail: ly-runit-service: unable to change to service directory: file does not exist

So, I tried to do:
- sudo ln -s /etc/runit/sv/ly-runit-service /etc/runit/runsvdir/current/
and then:
- sudo sv restart ly-runit-service
and it says:
- timeout: down: ly-runit-service: 1s, normally up, want up
so I think that for some reason it is not able to start the service.

The strange thing is that it doesn't recognize the service when it is placed where it should be, and it does recognize the service when it is not placed where it should be. Why?

After all, the display manager doesn't start at start-up  :D  :'(
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 07 January 2021, 20:16:03
Services expected to run are located in /etc/runit/runsvdir/default. Once it is linked there, it will automatically try to start.
It seems, the script you use expects tty2 to be free, therefore you need to disable agetty-tty2 or change it to other tty in script itself
Title: Re: Self-made runit init script
Post by: spike32 on 07 January 2021, 20:34:10
Services expected to run are located in /etc/runit/runsvdir/default. Once it is linked there, it will automatically try to start.
It seems, the script you use expects tty2 to be free, therefore you need to disable agetty-tty2 or change it to other tty in script itself
So, I changed tty2 with tty3 within the script, removed the link /etc/runit/runsvdir/current/ly-runit-service and created a new link with
sudo ln -s /etc/runit/sv/ly-runit-service /etc/runit/service
Then I rebooted and nothing happened
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 08 January 2021, 08:26:06
So, I changed tty2 with tty3 within the script, removed the link /etc/runit/runsvdir/current/ly-runit-service and created a new link with
sudo ln -s /etc/runit/sv/ly-runit-service /etc/runit/service
Then I rebooted and nothing happened
By default tty1 to tty6 are enabled, so you need at least tty7. Also, there is no /etc/runit/service, /etc/runit/runsvdir/default contains the running ones
Title: Re: Self-made runit init script
Post by: spike32 on 08 January 2021, 14:08:50
By default tty1 to tty6 are enabled, so you need at least tty7. Also, there is no /etc/runit/service, /etc/runit/runsvdir/default contains the running ones
So, I've set tty7 within the file and linked it to /etc/runit/runsvdir/default. Now, when I reboot tty1 starts as default, and if I change to tty7 I see

Code: [Select]
Artix Linux 5.10.4-artix2-1 (tty7)

_

with no possibility to login, but I see continuous refreshes like it's trying to start Ly but it can't for some reason.

Plus, if I run sudo sv status ly-runit-service it says: down: ly-runit-service: 0s, normally up, want up
even if I restart it.
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 08 January 2021, 15:53:31
Try starting command in script manually
Title: Re: Self-made runit init script
Post by: spike32 on 08 January 2021, 16:21:04
I'm sorry, I didn't understand what you mean.
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 08 January 2021, 16:47:21
Run command from script as root, not as runit script.Then you'll get its error output
Title: Re: Self-made runit init script
Post by: spike32 on 08 January 2021, 17:15:33
Run command from script as root, not as runit script.Then you'll get its error output
I get a segmentation fault
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 08 January 2021, 17:21:56
Most likely the same is in script
Title: Re: Self-made runit init script
Post by: spike32 on 08 January 2021, 17:32:48
So how could I solve it? What causes the segmentation fault?
Title: Re: Self-made runit init script
Post by: alium on 08 January 2021, 17:38:06
https://github.com/drozdowsky/ly-void  project is dead, 1.5 years was not updated.
Use runit service from this project and try the original, which is still devoleped https://github.com/nullgemm/ly (no need systemd).

Title: Re: Self-made runit init script
Post by: spike32 on 08 January 2021, 18:39:53
https://github.com/drozdowsky/ly-void  project is dead, 1.5 years was not updated.
Use runit service from this project and try the original, which is still devoleped https://github.com/nullgemm/ly (no need systemd).


I have installed this project https://github.com/nullgemm/ly and kept the same script for the runit service, but I'm still gettin the segmentation fault.
Title: Re: Self-made runit init script
Post by: ####### on 08 January 2021, 19:43:00
https://aur.archlinux.org/packages/ly/ (https://aur.archlinux.org/packages/ly/)
Try building the AUR package. I've no idea how to set it up or if it works properly, but at least it didn't segfault when I tried it briefly so would get past that issue.
Title: Re: Self-made runit init script
Post by: spike32 on 10 January 2021, 12:26:31
https://aur.archlinux.org/packages/ly/ (https://aur.archlinux.org/packages/ly/)
Try building the AUR package. I've no idea how to set it up or if it works properly, but at least it didn't segfault when I tried it briefly so would get past that issue.
The thing is that if I simply run ly form terminal it works, but if I run this script https://raw.githubusercontent.com/drozdowsky/ly-void/master/res/ly-runit-service/run with sudo ./run I get the segmentation fault
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 10 January 2021, 12:43:26
I think, you'd better run
Code: [Select]
sudo /usr/bin/ly tty2 "${BAUD_RATE}" "${TERM_NAME}"
with properly set values
Title: Re: Self-made runit init script
Post by: spike32 on 10 January 2021, 12:44:27
The thing is that if I simply run ly form terminal it works, but if I run this script https://raw.githubusercontent.com/drozdowsky/ly-void/master/res/ly-runit-service/run with sudo ./run I get the segmentation fault
I think that maybe the script is wrong cause there are variables like $GETTY_ARGS, $BAUD_RATE, and $TERM_NAME which are never declared or initialized. Could it be the reason?
Title: Re: Self-made runit init script
Post by: ####### on 10 January 2021, 15:08:37
Try
Code: [Select]
$ env
in your terminal, you'll see  what is set. The Void boot shell environment would have been different.
Title: Re: Self-made runit init script
Post by: phoenix_king_rus on 10 January 2021, 15:56:14
I think that maybe the script is wrong cause there are variables like $GETTY_ARGS, $BAUD_RATE, and $TERM_NAME which are never declared or initialized. Could it be the reason?
They should be specified in conf file (or exported in shell). Runit init scripts use BAUD_RATE=38400 and TERM_NAME=linux
Title: Re: Self-made runit init script
Post by: spike32 on 22 January 2021, 12:24:30
I think, you'd better run
Code: [Select]
sudo /usr/bin/ly tty2 "${BAUD_RATE}" "${TERM_NAME}"
with properly set values
I tried to follow this by changing my script with that

Code: [Select]
#!/bin/sh

tty=${PWD##*-}

[ -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

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

exec /usr/bin/ly tty7 "${BAUD_RATE}˝ "${TERM_NAME}"

by setting BAUD_RATE to 38400 and TERM_NAME to "linux". Still nothing, tty1 starts by default and if I change to tty7 it gets in stuck.
Title: Re: Self-made runit init script
Post by: spike32 on 30 January 2021, 20:16:35
I tried to follow this by changing my script with that

Code: [Select]
#!/bin/sh

tty=${PWD##*-}

[ -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

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

exec /usr/bin/ly tty7 "${BAUD_RATE}˝ "${TERM_NAME}"

by setting BAUD_RATE to 38400 and TERM_NAME to "linux". Still nothing, tty1 starts by default and if I change to tty7 it gets in stuck.
up
Title: Re: Self-made runit init script
Post by: vandrar on 31 January 2021, 09:25:31
I tried to reproduce and get it working with:

/etc/runit/sv/ly/run
Code: [Select]
#!/bin/sh

tty=${PWD##*-}

[ -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

exec setsid ${GETTY} ${GETTY_ARGS} -nl /usr/bin/ly tty7 "38400" "linux"

Edited /etc/ly/config.ini:
Code: [Select]
# tty in use
tty = 7

Then just enabled service
Code: [Select]
ln -s /etc/runit/sv/ly /run/runit/service
and reboot
Title: Re: Self-made runit init script
Post by: spike32 on 03 February 2021, 18:06:43
I tried to reproduce and get it working with:

/etc/runit/sv/ly/run
Code: [Select]
#!/bin/sh

tty=${PWD##*-}

[ -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

exec setsid ${GETTY} ${GETTY_ARGS} -nl /usr/bin/ly tty7 "38400" "linux"

Edited /etc/ly/config.ini:
Code: [Select]
# tty in use
tty = 7

Then just enabled service
Code: [Select]
ln -s /etc/runit/sv/ly /run/runit/service
and reboot
Thank you! It finally works! Meaning that it shows at startup, but if I type my password it doesn't log me in :'(
I select i3, my username, type my password, press enter, and it shows on top "logged out".... Why?
Title: Re: Self-made runit init script
Post by: spike32 on 04 February 2021, 18:04:23
Thank you! It finally works! Meaning that it shows at startup, but if I type my password it doesn't log me in :'(
I select i3, my username, type my password, press enter, and it shows on top "logged out".... Why?
up