Akadata Linux · Version 0 Saphira

Init guide

OpenRC init system on Akadata Linux: service lifecycle, /etc/init.d catalogue, runlevels, and how the build controller installs service scripts.

Saphira, the Akadata Linux Version 0 mascot
Technical preview

Init system

OpenRC on Akadata Linux

Akadata Linux uses OpenRC as its init system. Services are defined as shell scripts in /etc/init.d, each beginning with the interpreter line #!/sbin/openrc-run. Runlevels control which services start and stop together: boot for essential system setup, default for persistent daemons, and shutdown for orderly termination.

OpenRC was chosen because it is simple, script‑driven, and does not pull in a process‑supervisor tree that obscures what is running. The init scripts are version‑controlled alongside the distribution source. There is no systemd, no dbus dependency, no opaque binary log.


Essential commands

Service lifecycle

rc-status          # Show runlevel and service state
rc-update add sshd  # Add sshd to the default runlevel
rc-update del sshd  # Remove sshd from the default runlevel
rc-service sshd start
rc-service sshd stop
rc-service sshd restart

rc-status lists every runlevel and the state of every service within it (started, stopped, or crashed). rc-update manages which services belong to which runlevel; it writes symlinks under /etc/runlevels/. rc-service starts, stops, and restarts individual services by running the start(), stop(), or restart() function defined in the service script.


Service catalogue

/etc/init.d

The listing below is taken from the Akadata development validation system: the machine where every service is confirmed working before a release candidate is published. The exact files may vary between installations depending on which stage4 packages are selected.

Boot runlevel — system initialisation

These services bring the kernel environment to a usable state. They mount pseudo‑filesystems, set the clock, load kernel modules and keymaps, check filesystems, and activate swap. They run once at boot and are not restarted.

agetty.tty1  agetty.tty3  agetty.tty5  agetty.ttyS0  binfmt       consolefont
agetty.tty2  agetty.tty4  agetty.tty6  bootmisc      cgroups      devfs
dmesg        fsck         hostname     hwclock        keymaps      killprocs
localmount   loopback     modules      mount-ro       mtab         numlock
osclock      procfs       root         save-keymaps   savecache    seedrng
swclock      swap         sysctl       sysfs          termencoding

Default runlevel — long‑running daemons

Services started after the boot runlevel completes. They remain running until shutdown. The exact set depends on the stage4 profiles and packages selected at build time.

agetty       chronyd      dcron        dnsmasq        haproxy      ipvsadm
local        mariadb      named        net-online     netmount     network
nftables      nginx        openvswitch  php-fpm        postfix      rspamd
runsvdir     s6-svscan    smartd       sshd           unbound      valkey

Infrastructure and helpers

akadata-boot-ok     functions.sh     user

functions.sh is the OpenRC helper library sourced by every service script. It provides ebegin, eend, and the check‑run environment. akadata-boot-ok runs last in the boot sequence and signals that the system reached a known‑good state. user is a local‑administrator hook: create it, make it executable, and it runs at the end of the default runlevel.


Service scripts

Anatomy of an OpenRC service

Every service in /etc/init.d is a shell script that follows a simple contract. Here is the sshd service as an example:

#!/sbin/openrc-run

description="OpenSSH daemon"
command=/usr/sbin/sshd
command_args=${sshd_args:-}

depend()
{
	need net
	use dns logger
}

start()
{
	ebegin "Starting sshd"
	"$command" $command_args
	eend $?
}
  • Shebang: #!/sbin/openrc-run is the OpenRC interpreter. It sources the script and calls its functions.
  • depend(): Declares what this service needs before it can start. need is a hard requirement (the service will not start without it). use is soft (start it if present). before and after control ordering. provide declares a virtual service name that other scripts can depend on.
  • start() / stop(): Called by rc-service. Default implementations run the command variable if set; custom overrides are written when the service needs more than a simple daemon launch.
  • command / command_args: The daemon binary and its arguments. OpenRC manages PID tracking and shutdown signalling automatically for daemons that write a PID file or stay in the foreground.

Service scripts are installed by the build controller from stage4/services/ into the rootfs. Each package that provides a daemon also provides its init script, so the service definition and the binary are never out of sync.


First boot

First-boot account setup

On first boot, a marker file /etc/akadata-firstboot-required is present. When root logs in on a console, /root/.profile runs /sbin/akadata-firstboot while the marker exists. The helper prompts for the root password, then for a non-root administrator login name. The name is validated (lowercase letters, digits, underscores, and hyphens; it must not start with a digit or hyphen and must not be root), the account is created with /bin/bash in the wheel group, and its password is set. The marker is removed on completion, so the flow runs once.

OpenSSH ships with PermitRootLogin no, so remote administration uses the administrator account rather than root. The first-boot helper and the /root/.profile hook are part of the baselayout, installed into the derived rootfs by apply-accounts.sh.