Devuan5 init diversity edition

Hmm… assuming exit codes are just the usual bash exit codes

1 Like

After digging through the sysvinit script & the systemd unit file I got it to work reliably with the following execline script

#!/bin/execlineb -P
foreground { mkdir -pm 0755 /var/run/vsftpd/empty }
fdmove -c 2 1
exec /usr/sbin/vsftpd /etc/vsftpd.conf

3 Likes

Used your script exactly.
No success.
If I click on Start in the GUI it flips , and stays at Down
Doing it manually

root@init-diversity:~# s6-rc -v 4 start vsftpd-srv
s6-rc: info: bringing selected services up
s6-rc: info: service vsftpd-srv: already up

root@init-diversity:/home/nevj# s6-svstat /run/s6-rc/scandir/vsftpd-srv
down (exitcode 127) 0 seconds, normally up, want up, ready 0 seconds
[nevj@trinity ~]$ 

So in my Devuan init-diversity, the script does not work.
But
I think the script is probably OK… I think I need to get vsftpd-srv into a Down state… So I tried stopping it first

root@init-diversity:/home/nevj# s6-rc -v 4 stop vsftpd-srv
s6-rc: info: bringing selected services down
s6-rc: info: service vsftpd-srv: stopping
s6-rc: info: service vsftpd-srv successfully stopped
root@init-diversity:/home/nevj# s6-rc -v 4 start vsftpd-srv
s6-rc: info: bringing selected services up
s6-rc: info: service vsftpd-srv: starting
s6-rc: info: service vsftpd-srv successfully started
root@init-diversity:/home/nevj# ps ax | grep ftp
  354 ?        S      0:01 s6-supervise vsftpd-srv
  395 ?        S      0:01 s6-supervise vsftpd-log
 1229 pts/0    S+     0:00 grep ftp

So it says ‘successfully started’ … but it is not running ?
Do I perhaps need to recompile the database after changing the script?

root@init-diversity:/home/nevj# s6-db-reload
s6-rc database has been updated
Do you want to reload the new default service state? [Y/n] y
reloading default bundle
sh: 0: cannot open /etc/s6-rc/helper-scripts/mount-bootclean/mount-bootclean.sh: No such file
s6-rc: warning: unable to start service mount-bootclean: command exited 2
Starting fake hwclock: loading system time.
/etc/s6-rc/helper-scripts/fake-hwclock/shell_up: 10: fake-hwclock: not found
s6-rc: warning: unable to start service fake-hwclock: command exited 127
default bundle has been reloaded
Dou you want to delete old service databases? [Y/n] n
Not deleting old service databases
root@init-diversity:/home/nevj# exit
exit

OK, that updates the database.
Now try again to start it

s6-rc: info: bringing selected services down
s6-rc: info: service vsftpd-srv: stopping
s6-rc: info: service vsftpd-srv successfully stopped
root@init-diversity:/home/nevj# s6-rc -v 4 start vsftpd-srv
s6-rc: info: bringing selected services up
s6-rc: info: service vsftpd-srv: starting
s6-rc: info: service vsftpd-srv successfully started
root@init-diversity:/home/nevj# ps ax | grep ftp
12197 ?        S      0:00 s6-supervise vsftpd-srv
12198 ?        S      0:00 s6-supervise vsftpd-log
14335 ?        Ss     0:00 /usr/sbin/vsftpd /etc/vsftpd.conf
14446 pts/0    S+     0:00 grep ftp

SUCCESS !.

Thank you for the script
It seems the main problem was… if I change a script I have to update the database.

Now , can I start the vsftpd-log daemon?

3 Likes

Absolutely, every time.

I have since tested this with my Devuan, Antix, MX, Debian (unreleased) init-diversity spins & works every time.

2 Likes

I have also created a 66 frontend to use with all my spins booted with s6-66:

To enable vsftpd with s6-66 you will need to only create frontend file
/etc/66/service/vsftpd with contents:

[main]
@type = classic
@version = 0.0.1
@description = “vsftpd server daemon”
@user = ( root )

[start]
@execute = (
foreground { mkdir -pm 0755 /var/run/vsftpd/empty }
exec /usr/sbin/vsftpd /etc/vsftpd.conf
)

To enable:

sudo 66 parse vsftpd #This parses the frontend unit to create the actual service
sudo 66 enable vsftpd #This adds the service to startup
sudo 66 start vsftpd #This immediately starts the service

2 Likes

See what I edited onto end of last reply.

That is the issue. Lesson hard learned

Thank you

3 Likes

Thanks I shall be needing that.
Does 66 parse update the database?

I shall start a new topic on s6-66… probably go back to Antix.
I only chose Devuan to see what package support was like.
What I see is … only a few example support scripts for runit, much more for s6-rc.

No special compiling is required for 66, it seems to recompile the database everytime it is required. Both the “parse” & “enable” seem to do the database compilation when invoked.

All these ‘init-diversity’ distro’s are unofficial personal spins of mine, as are many of the service files.
There are a few more scripts available for s6-rc because gnuinos provided an experimental spin including them (Thanks aitor).

Plans from antiX to fully support these will benefit any debian based distro…

3 Likes

@ProwlerGr ,
No, it does not start with your original script.

root@init-diversity:~# s6-svstat /run/s6-rc/scandir/vsftpd-log
down (exitcode 100) 0 seconds, normally up, want up, ready 0 seconds

" s6-log will exit 100 if the script is invalid."

I might have a look at the Artix log script … It does not have one
So compare it with sshd-log in Devuan
the last lines differ


s6-setuidgid s6log exec -c s6-log -d3 -b -- ${DIRECTIVES} /run/log/sshd

So try changing that line to /run/log/vsftpd → no difference.
Still the same exit 100.

Here is the script for the logger:

#!/bin/execlineb -P
envfile /etc/s6-rc/config/vsftpd.conf
importas -sCuD “n3 s2000000 T” DIRECTIVES DIRECTIVES
ifelse { test -w /var/log } {
foreground { install -d -o s6log -g s6log /var/log/vsftpd }
s6-setuidgid s6log exec -c s6-log -d3 -b – ${DIRECTIVES} /var/log/vsftpd
}
foreground { install -d -o s6log -g s6log /run/log/vsftpd }
s6-setuidgid s6log exec -c s6-log -d3 -b – ${DIRECTIVES} /run/log/vsftpd

Temporarily uploaded here

1 Like

That is exactly the script I have.
To be sure I copied yours and tried again
s6-db-reload, then

root@init-diversity:~# s6-rc -v 4 stop vsftpd-log
s6-rc: info: bringing selected services down
s6-rc: info: service vsftpd-log: stopping
s6-rc: info: service vsftpd-log successfully stopped
root@init-diversity:~# s6-rc -v 4 start vsftpd-log
s6-rc: info: bringing selected services up
s6-rc: info: service vsftpd-log: starting
s6-rc: info: service vsftpd-log successfully started

root@init-diversity:~# ps ax | grep ftp
15854 ?        S      0:00 s6-supervise vsftpd-srv
15857 ?        S      0:00 s6-supervise vsftpd-log
15941 ?        Ss     0:00 /usr/sbin/vsftpd /etc/vsftpd.conf
19569 pts/3    S+     0:00 grep ftp

It must be a Devuan issue.

1 Like

It is the Devuan live iso I’m using in my screenshot, so I can confirm it is not related to the distro.

Did you create the /etc/s6-rc/config/vsftpd.conf file?

Yes, it exists.
There is also /etc/vsftpd.conf

The only message I can get is exitcode 100
which
for s6-log means invalid script.
for execline means wrong usage
That is rubbish… all the log scripts are the same as the vsftpd one , except for the daemon name.

1 Like

From my point of view, … I was in the middle of trying to write an S6 topic for itsFOSS when your spins appeared. …
so I shelved writing, and looked at what I could learn from your spins. … The result was I learnt heaps, and will learn more as I go on to s6-66. When I get back to the article, it will benefit from this exercise.

From itsFOSS point of view… if I do everything in public view,
the other comminity members can see something about init system usage and can participate in debate about their various merits.

From your point of view, your spins are getting some exposure and there may be some useful feedback.

So you are helping us a lot. I hope you get something useful in return.

The whole init system scene is in a rather fluid state at the moment. Attitudes are changing and it looks like even Debian
will embrace what you call init-diversity , in some form.
S6 seems to be well placed to play a leading role as a systemd alternative… it is important for places like itsFOSS to have the debate and to gain the understanding of init systems that will be needed when things begin to change.
Discussing your spins is a really useful and important step.

3 Likes

My view is that you saved the best for last… :wink:

I’m very happy you see it this way.
It is a journey for me as well which started as: how do I get s6 working in Debian, & has now come to the point to: why fight over inits when there is a way to provide proper choice.
antiX is the pioneering distro embracing this concept, I really hope other distro’s will follow.

3 Likes

I hope so.
Can only tackle one thing at a time. I turned 79 recently, I am slowing up, so be patient please. We shall have a thorough look at s6-66.

3 Likes

I reckon other distros will follow, but will want to put their own trademark on it. Be prepared for some variations.
I wonder what Artix will do ?.. their init diversity solution is more traditional ie make your choice at install time.
Your spins shift that choice to reboot time.

2 Likes

More testing

root@init-diversity:~# s6-svstat /run/s6-rc/scandir/vsftpd-log
down (exitcode 127) 0 seconds, normally up, want up, ready 0 seconds

Summary of common exit codes for execline programs

    0: success. This code is rarely encountered, because most execline programs chainload into something else when they succeed, instead of exiting 0.
    100: wrong usage
    111: system call failed
    126: unable to chainload into another program (any other error than ENOENT)
    127: unable to chainload into another program (executable not found)

So there is an executable it cant find?

root@init-diversity:~# s6-svstat -o up,ready /run/s6-rc/scandir/vsftpd-log
false false

What does not ‘ready’ mean?

I think I have the answer.
in /etc/s6-rc/vsftpd-log there need to be more files than run and type.
I copied what was in sshd-log… I have noted these are exactly the same as the files you posted ‘here’
There is also an extra file producer-for in sshd-srv
So after setting that up, it crashes with s6-db-reload and loses the compile-active file.
So obviously I do not have it completely right yet, but I think this approach will get me there.
More tomorrow

2 Likes

@ProwlerGr

Success with vsftpd-log.
I now understand that it ties the -srv and -log services together into a bundle, and you can refer to the whole as vsftpd

root@init-diversity:~# s6-rc stop vsftpd
root@init-diversity:~# s6-rc start vsftpd
root@init-diversity:~# ps ax | grep ftp
28878 ?        S      0:00 s6-supervise vsftpd-srv
28880 ?        S      0:00 s6-supervise vsftpd-log
29668 ?        Ss     0:00 s6-log -d3 -b -- n3 s2000000 T /var/log/vsftpd
29674 ?        Ss     0:00 /usr/sbin/vsftpd /etc/vsftpd.conf
29781 pts/0    S+     0:00 grep ftp

The daemon vsftpd is running , and there is an s6-log running for it.

What was the problem?
Quite esoteric… my copy of the run file for vsftpd-log had some strange unprintable characters inthe importas line.

$ od -a vsftpdlogrun.correct  | more
0000000   #   !   /   b   i   n   /   e   x   e   c   l   i   n   e   b
0000020  sp   -   P  nl   e   n   v   f   i   l   e  sp   /   e   t   c
0000040   /   s   6   -   r   c   /   c   o   n   f   i   g   /   v   s
0000060   f   t   p   d   .   c   o   n   f  nl   i   m   p   o   r   t
0000100   a   s  sp   -   s   C   u   D  sp   "   n   3  sp   s   2   0
0000120   0   0   0   0   0  sp   T   "  sp   D   I   R   E   C   T   I
0000140   V   E   S  sp   D   I   R   E   C   T   I   V   E   S  nl   i


$ od -a vsftpdlogrun.wrong | more
0000000   #   !   /   b   i   n   /   e   x   e   c   l   i   n   e   b
0000020  sp   -   P  nl   e   n   v   f   i   l   e  sp   /   e   t   c
0000040   /   s   6   -   r   c   /   c   o   n   f   i   g   /   v   s
0000060   f   t   p   d   .   c   o   n   f  nl   i   m   p   o   r   t
0000100   a   s  sp   -   s   C   u   D  sp   b nul  fs   n   3  sp   s
0000120   2   0   0   0   0   0   0  sp   T   b nul  gs  sp   D   I   R
0000140   E   C   T   I   V   E   S  sp   D   I   R   E   C   T   I   V
0000160   E   S  nl   i   f   e   l   s   e  sp   {  sp   t   e   s   t

That took some time to find.
b nul fs instead of "
but they both print as quote??
Some copy/paste problem I imagine.

So now when I list bundles

$ s6-rc-db list bundles
...
vsftpd
...

I get vsftpd ( among others),
but if I list longruns

$s6-rc-db list longruns
...
vsftpd-log
vsftpd-srv
...

I get the log and server daemons separately.

The s6-rc Service Manager does not list the bundle, only the individual daemons.

I think it is time for a summary of s6 with s6-rc, and then a move on
to s6 with s6-66.

3 Likes

Yes consumer-for - pipeline-name - notification-fd need to also be populated. They are simple enough to define if you look at any other logger service.

Yes
/etc/s6-rc/sv/vsftpd-srv/producer-for & /etc/s6-rc/sv/vsftpd-log/consumer-for marry the services into a bundle & the contents of file /etc/s6-rc/sv/vsftpd-log/pipeline-name defines the bundle name.

2 Likes