Systemd provides us with a more modern approach of booting. It also benefits from the modern multicore processors and relies on very aggressive parallelization to get the job done very quickly. Arch Linux provides systemd by default. Systemd uses "the so-called service files" to define how and when a certain service or "a so-called daemon" has to be started.
The following list describes the main tasks that we will perform in this recipe:
systemctl command, we can start and stop services on demand.Let's list the steps required to install systemd:
pacman -S systemd systemd-arch-units.init=/bin/systemd to your kernel command line by editing /boot/syslinux/syslinux.cfg:APPEND initrd=/initramfs-linux.img root=/dev/sda2rootfstype=ext4 ro init=/bin/systemd
Let's list the steps required to set the default target:
systemctl enable graphical.target
systemctl enable multi-user.target
systemctl start service
systemctl enable service
We need the systemd-arch-units package, because not all packages providing services are providing the service files needed to be able to use them with systemd. Due to the fact that we added init=/bin/systemd to the kernel command line, the system will use systemd for startup.
These days only two targets can be set automatically as the default target, as only graphical.target and multi-user.target provide the default target installation.
In the systemctl start service command, service is actually the name of a file. For example, NetworkManager has a systemd service file called NetworkManager.service, and it is this full name we need to pass to the systemctl command. For example:
systemctl start NetworkManager.service
To be able to know what services to start during boot time, systemctl will create symlinks to the specific service files in the correct locations where systemd will search them during boot.
Once we are satisfied with systemd booting our system, we can eventually fine-tune it a little more.
The following command will provide symlinks for initscripts' compatibility:
pacman -S systemd-sysvcompat
The result is that you can omit the extra parameter init=/bin/systemd on your kernel command line.
We can easily change the desired target by changing the kernel command line in our boot loader configuration. This makes it easy to test if some specific target suits our needs.
Similar to the appending of a number to the kernel command line when using initscripts, we can also do this for systemd using the systemd.unit parameter.
For example, considering Syslinux as the boot loader, open /boot/syslinux/syslinux.cfg and add systemd.unit=multi-user.target to the kernel command line:
APPEND initrd=/initramfs-linux.img root=/dev/sda2 rootfstype=ext4ro systemd.unit=multi-user.target
The previous example is valid for a system with only systemd, otherwise we also would require init=/bin/systemd.
We might want to know what services we have available on our system, and of course we want to know what we can do with those services.
We can list all the used services or choose the list all the available services by running the following commands:
systemctl list-units --type=service systemctl list-units -a --type=service
By default systemd supports actions such as start, stop, restart, reload, and status. There are more actions available, which can be found by issuing man systemctl.
Before enabling a service, we might want to check if the service is not already enabled. We can check if a service is already enabled for startup during the boot process by using the is-enabled action:
systemctl is-enabled service