The dinit init system in Artix Linux

The dinit init system

Most home desktop users are happy with whatever init system their favourite Linux distro comes with by default. In many cases this will be systemd. In my view systemd is over-complicated for a home system. There are many alternative init systems ( sysVinit, runit, OpenRC, BSD-RC, S6, 66, Busybox, dinit). Of those, I would have recommended OpenRC for a simple home-usr init system , but the more recent dinit init system is challenging strongly.

Features of dinit

The main attributes of dinit are

  • Dinit allows the user to start and stop daemons ( ie services) with simple commands similar to those used by OpenRC.
  • Dinit handles system startup and shutdown.
  • Dinit provides a process No 1 called /usr/bin/dinit which forks all other processes
  • Dinit provides parallel startup of services and dependency management
  • Dinit provides service supervision, ie it automatically restarts failed daemons
  • Dinit allows users to setup services

How to get dinit

The only Linux distros that come with dinit as the default init system are Artix and Chimera. By far the easiest of those to install is Artix, so we will use Artix here.

I started with a download of artix-xfce-dinit-20240823-x86_64.iso from

Note, Artix has downloads with various default init systems. You need to choose the dinit version.
The install is simple… Artix uses the Calamares installer for all but its base iso’s.
It boots to a typical Xfce screen

That is my favorite Xfce background. The default background is a double helix

and I have added some things to the bottom panel there.
You may wonder what all those disk partition icons are? Xfce seems to do that in some distros… it is obvious that my machine has a large number of partitions.

So how do I know that it is using dinit?

ls -F /etc/dinit.d
acpid         cryptsetup-early  lightdm       metalog     statd
avahi-daemon  cupsd             lightdm-pre   mount.d/    tty1
bluetoothd    dbus              logind        nfs-server  tty2
boot.d/       dbus-pre          lvm2          ntpd        tty3
config/       dhcpcd            lvm-monitor   rpcbind     tty4
connmand      dmeventd          lvmpolld      rsync       tty5
cronie        elogind           lvmpolld-pre  sshd        tty6
cryptsetup    haveged           mdadm         ssh-keygen  wpa_supplicant

There is its configuration directory. Also

$ ps ax | grep dinit
    1 ?        S      0:00 /usr/bin/dinit

There is process number 1… it is dinit.

Artix is Arch based. You use the pacman package system for updates and installs.

It is possible to install dinit from source into any distro. That is not an easy option.

Compare dinit to runit, s6 and sysVinit

There is an init system comparison table here

https://wiki.gentoo.org/wiki/Comparison_of_init_systems

and some more points here

  1. The first thing one notices when using dinit is that there only one process ( /usr/bin/dinit) that acts as an init process, accepts service management commands, and does service supervision. Contrast that with runit , s6 and other daemontools based init systems, where there is an init process plus separate supervisor processes for each and every service, plus if there is logging a separate log process for every service…

  2. The next thing one notices is there is just one directory (/etc/dinit.d) where
    all of the service information is kept

The files are service files . We can see the content of the sshd service file. It is a simple list of parameters, there is no script as in sysVinit or run file as in runit.
Both sysVinit and runit use a link farm… a directory full of soft links that point to the startup files of the daemons to be started. Dinit just has a service file.
The daemons required at boot time are in the boot.d subdirectory.

To create a service file in Artix/dinit, one simply installs the dinit package corresponding to the service package. For example

trinity:[nevj]:~$ pacman -Ss vsftpd

world/vsftpd 3.0.5-1
    Very Secure FTP daemon


world/vsftpd-dinit 20211103-4 (dinit-world)
    dinit service scripts for vsftpd

So to get vsftpd just install the above 2 packages. In Artix there are also packages for openrc, runit and s6, to go with every service package.

3.The most likely thing a home user may want to do is to start or stop a daemon. The dinit commands for this are

dinitctl start service_name
dinitctl stop service_name

One can also list services

dinitctl list

and one can make a service autostart at boot

dinitctl enable service_name

Dinit, in common with s6 and systemd, allows users as well as root, to manage services That can not be done in runit or OpenRC or sysVinit.

  1. An important feature of dinit is that it automatically manages dependencies between services, so that it starts daemons in a suitable order. S6 can do that too, and so can systemd. Runit and OpenRc and SysVinit do not manage dependencies. What proper dependency management means is that daemons can be started in parallel if they are independent. That makes booting fast. Dinit boot time is indeed fast… Chimera Linux (in a VM) boots in 4 seconds, Artix/dinit ( hard install) in about 10 seconds , Artix/s6 (hard install) takes 17 seconds. Dinit is faster than s6.

Conclusion

Dinit is a suitable init system for home use. It boots fast, has simple commands, and in general leaves the user alone and does not intrude on other parts of the system.

If you want to read more about dinit look here

https://wiki.artixlinux.org/Main/Dinit

https://davmac.org/projects/dinit/

and an interesting account from the developer of dinit here

Dinit is a different design to other init systems… it is a monolithic C++ program. All other init systems break up into a series of utilities, the worst being systemd, with s6 not far behind. OpenRC is a script… so it is slow but has been around a while and is reliable. I would say OpenRC is the next most suitable for home use, after dinit.

I am sure dinit will start to become available in other distros. Keep an eye on it, and have a try with Artix if you are interested.

6 Likes

That one looks interesting indeed!

1 Like

@kovacslt
Yes, all the others are a complicated mess, compared to dinit.
They suffer from too much partitioning of tasks.
Dinit is one blob of C++ code, and nothing else. It cant grow tentacles and invade your system ( like systemd) and it does not swamp your ps with processes (like runit and s6), and it does not fill up our filesystem with link farms( like sysvinit, OpenRC, runit).

I like it. I think it has a future.

It is coming. There is a project called Dinit on Devuan

3 Likes

Hi Neville,
I’m a home user. Not even close to the knowledge of an Admin. As you know I use Linux Mint.
Is there some big advantage of replacing systemd with dinit or is it even possible? Maybe a home user would get their self into a lot of problems trying to replace a Linux subsystem.

Just curious. I don’t believe I would attempt to perform a huge modification to Linux.

Howard

2 Likes

Hi Howard,
Good question.
It is possible but very difficult. Wait until is is available in a downloaded iso, or try Artix/dinit in a VM or a hard install.
I think it will be available in Devuan soon, there is a project

Advantages would be

  • fast boot
  • no dependency problems with services
  • 10 minute learning curve… compared to half an hour for runit and half a lifetime for systemd
  • philosophical benefits that I will leave for now
  • a million less lines of code in your system
  • compatability across Linux , BSD, MacOS
  • compatability across glibc, musl

I dont think I would try to port it to any Linux. The problem is you have to change the packages for every service that requires a daemon. Artix have already done that.
The people trying to port dinit to Devuan are building on what Artix have done… ie moving the Artix packages into Devuan. Let them do it. It is a lot of work.
The other bit … replacing the init process… is easy.

Removing all the tentacles of systemd is not easy. Devuan have already done it, and they maintain what they have done, so leave it to them.
I dont know how Artix get on being dependent on Arch which is systemd. They must have to keep removing stuff from Arch packages. They seem to cope well.

I think Mint will follow Ubuntu. But LMDE might morph to LMDV( Devuan based) and that could allow Mint to embrace other init systems, including dinit.
Peppermint have already done that … they offer Debian or Devuan based isos.

I think MX will follow Antix… Antix has already produced that ’ Init Diversity Spin’
that I looked at last year… unfortunately the spin did not include dinit, but they may redo it with dinit… I might ask. MX has already removed systemd (like Devuan) so its task in adopting another init system is lighter.

In short , wait and see. It looks promising.

2 Likes

Decided to quickly check out Artix in a VM…

Yeah… Nah…

Arch based? It’s basically Arch isn’t it? You boot to a shell and start partitioning your storage from CLI / tty…

Yeah… Nah…

I used to kinda enjoy that kinda thing - THIRTY years ago when I started out with Slackware 3…

No longer - I just want the quickest route to a graphical desktop that ALSO has a NIX shell…

2 Likes

You missed something.
You must have used a base .iso
It has a GUI installer.
Try the isos with a preconfigured desktop

3 Likes

Doh! I sure missed that…

I just looked at the top of the list for the first one that mentioned dinit…

Grabbing the MATE and XFCE versions now… Reckon I’ll probably try out MATE first off…

3 Likes

@daniel.m.tripp

Remember, when you install a package that runs a daemon, there are 2 packages
packagename
and
packagename-dinit
You need to install both

3 Likes

I am with howard on this, not sure i would want to or gain anything by doing this.

If it is not broken why try to fix it !

2 Likes

Because we dont want a fix (patch) to systemd, we want a new model altogether.
Start again fron scratch is in order.

2 Likes