Notes dinit

Voir :

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

https://chimera-linux.org/docs/configuration/services

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

https://itsfoss.community/t/the-dinit-init-system-in-artix-linux/12993

https://davmac.wordpress.com/2018/10/26/on-the-vagaries-of-init-systems/

https://github.com/davmac314/dinit/blob/master/doc/COMPARISON

https://github.com/chimera-linux/dinit-chimera/blob/master/README.md

https://github.com/RussPalms/dinit_dev/blob/master/doc/linux/DINIT-AS-INIT.md

Voir aussi :

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

https://github.com/chimera-linux/dinit-dbus

Présentation

type = process | bgprocess | scripted | internal | triggered
command = ...
stop-command = ...
run-as = (user-id)
restart = (boolean)
logfile = ...
pid-file = ... (Pour bgprocess)
options: ...
depends-on: (service name) (Hard dependency / Need dependency)
depends-ms: (service name) (Milestone)
waits-for: (service name) (Soft dependency)

Install

Debian

Voir : https://repo.antixlinux.com/testing/pool/main/d/dinit/

wget https://repo.antixlinux.com/testing/pool/main/d/dinit/dinit_0.19.4-0_amd64.deb mkdir dinit_tmp cd dinit_tmp ar x ../dinit_0.19.4-0_amd64.deb tar xvf data.tar.xz sudo cp -p lib/dinit/dinit* /usr/local/bin/ sudo rsync -ax usr/share/man/ /usr/local/share/man/

Android - Termux

Source : https://github.com/davmac314/dinit/issues/274

pkg install ndk-sysroot clang binutils-is-llvm make git pkg install m4 git clone https://github.com/davmac314/dinit cd dinit git tag git checkout v0.19.4 ./configure --prefix=$PREFIX --syscontrolsocket=$PREFIX/var/run/dinitctl --sbindir=$PREFIX/bin --disable-cgroups --disable-shutdown make -j $(nproc) make install

Termnux boot

Installer Termux-Boot

cd .termux mkdir boot cd boot cat > 00-dinit <<EOF #! /bin/sh termux-wake-lock dinit EOF termux-fix-shebang ./00-dinit

Usage

$ dinit --version
Dinit version 0.19.4.
Supported features: cgroups utmp supplemental-groups

mkdir ~/.config/dinit.d cd ~/.config/dinit.d cat > ~/.config/dinit.d/boot <<EOF type = internal waits-for.d: boot.d EOF mkdir /.config/dinit.d/boot.d

Exemple de création de service

Voir :

https://github.com/davmac314/dinit/tree/master/doc/linux/services

cat > ~/.config/dinit.d/test_sleep <<EOF type = process command = sleep 600 restart = true EOF dinit dinitctl start test_sleep

État

dinitctl list dinitctl status mysql

Vérif

dinitcheck # ou dinitcheck <service-name>

Config

Lancement automatique de dinit

~/.bashrc

if ! pgrep -u "$USER" dinit > /dev/null; then nohup dinit --user -q -l ~/log/dinit.log >/dev/null 2>&1 & fi

Source : Adaptation de https://wiki.artixlinux.org/Main/Dinit#User_services

Pb

oct 17 17:44:45 vivabelo systemd[2332]: nerdctl-3249c67de5a1a127575835e672573bd05d1fd478bca842293869a7bc2a0a1539.scope: Consumed 2min 37.055s CPU time, 2.1G memory peak, 430M read from disk, 82.7M written to disk.
oct 17 17:44:45 vivabelo containerd-rootless.sh[2454]: time="2025-10-17T17:44:45.171069378+02:00" level=error msg="ttrpc: received message on inactive stream" stream=9

Pb

Err provided file is not a console

Exited (137)

1 errors:\nprovided file is not a console

Solution

apt-get install expect

~/.config/dinit.d/kind

type = process # command = $HOME/bin/nerdctl start --attach kind-control-plane command = unbuffer $HOME/bin/nerdctl start --attach kind-control-plane stop-command = $HOME/bin/nerdctl stop kind-control-plane restart = false logfile = /home/jibe/log/kind.log stop-timeout = 120

Préfixer la commande par unbuffer

Mais ne marche pas avec stdbuf -i0 -o0 -e0 command