Hello list, Like I said in my previous post, I have successfully installed systemd on my LFS-based system, and since people have shown interest I post it here so everyone else can try it. Regarding the comments on replacing sysvinit, I think systemd is not ready for this just yet, but I do think that sysvinit is slowly becoming obsolete, and a newer init system like systemd eventually will find its way into the base LFS book, sooner or later.
Before I begin with the instructions, I would like to clear up one misconception: systemd is *not* all about booting faster or in parallel. Rather, it is about managing the system, starting and stopping sessions and services, monitoring mount points, controlling the runtime environment of each process, and so on. Of course, as the init process, its first responsibility is to bring up user space, and it should try to do that as fast as it can, like any other process. But that's not its main purpose, as far as I understand it. Also, please note that this is a young project, and there are still obvious bugs, ugly interfaces, and some orientation towards big distributions (especially fedora). Furthermore, my system is probably very different from yours, so you might need to take some extra steps beyond what is described here. However, the installation procedure does not overwrite the existing binaries from sysvinit or the LFS init scripts, so you should be able to install systemd just to test it and go back to sysvinit if anything goes wrong. I guess some of you would be interested in this nonetheless, so I tried to check how much time each of the two systems (sysvinit and systemd) takes to boot up. I booted 4 times in a row for each system, and these were the results (in seconds): sysvinit: 8.40 8.47 8.11 8.72 systemd: 6.99 7.12 7.48 7.27 When shutting the system down, systemd takes about 1 second, while sysvinit with the LFS init scripts take about 10 seconds, so I did not bother to make an exact measurement. Prerequisites ------------- The README file describes the following dependencies: Linux kernel >= 2.6.30 (with devtmpfs, cgroups; optional but strongly recommended: autofs4, ipv6) libudev >= 172 dbus >= 1.4.0 libcap gtk+ >= 2.20 (optional) PAM >= 1.1.2 (optional) libcryptsetup (optional) libaudit (optional) libselinux (optional) tcpwrappers (optional) libnotify (optional) It is also suggested to install nss-myhostname in order to use systemd-hostnamed. I also noted that the systemd-analyze tool requires dbus-python binding in order to run. However, these two packages, and the packages marked as optional in the README file, are not required, and systemd can be built and run without them. Preparations ------------ First, /etc/mtab should be a symbolic link to /proc/self/mounts. Apparently, this is not specific to systemd, but the new recommended way to setup this file on Linux systems. To create the link, run the following command as the root user: ln -sfv /proc/self/mounts /etc/mtab systemd uses a number of configuration files, which are intended to replace distribution-specific configuration files related to console fonts, kernel modules, temporary files, and other system parameters. Of these configuration files, only /etc/hostname is really essential, while the others have reasonable defaults that should work out-of-the-box. Create /etc/hostname by running the following command as the root user: grep '^HOSTNAME=' /etc/sysconfig/network | sed 's/^HOSTNAME=//' >/etc/hostname You can read about the other configuration files in the manual pages that come with systemd: binfmt.d(5) - additional binary formats to register at boot locale.conf(5) - locale-related configuration settings modules-load.d(5) - kernel modules to load at boot os-release(5) - system name and version information, similar in purpose to /etc/lfs-release sysctl.d(5) - kernel parameters to apply at boot systemd.conf(5) - general settings for systemd itself tmpfiles.d(5) - creation and clean up of temporary files vconsole.conf(5) - configuration of the virtual console (font, keymap, etc) There are also machine-id(5) and machine-info(5), but I didn't quite understand their use. systemd also recognizes several options that you can pass on the kernel command line. See the manual pages mentioned above and also systemd(1) for more information on these options. On my system, I also needed to create a group named "lock". If this group does not exist on your system, create it by running the following command as the root user: groupadd -g 54 lock Installation ------------ As noted above, installation of systemd should not overwrite any files provided by sysvinit (except for 6 manual pages). You can download the package from here: http://www.freedesktop.org/software/systemd/ After downloading and unpacking the package, cd into the unpacked directory and run these commands to compile it: ./configure --prefix=/ --with-rootdir=/ --with-distro=other --with-sysvinit-path= --with-sysvrcd-path= make Then, as the root user, run "make install" to install the package. After installing systemd, you should re-install udev and dbus, in order to install their service files for use by systemd. Further configuration --------------------- In order to bring up the network on boot, create and enable a network service by running the following commands: cat >/etc/systemd/system/network.service <<EOF [Unit] Description=Bring up network interfaces Before=network.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=/etc/rc.d/init.d/network start ExecStop=/etc/rc.d/init.d/network stop [Install] WantedBy=multi-user.target EOF systemctl enable network.service systemd also has a feature called "read-ahead", which is supposed to speed up the boot process, but on my system it actually slows it down by about half a second (even when I tried to boot with it multiple times). If you want to try it, run these commands as the root user: systemctl enable systemd-readahead-collect.service systemctl enable systemd-readahead-replay.service To undo this, run again as the root user: systemctl disable systemd-readahead-collect.service systemctl disable systemd-readahead-replay.service The above commands (enable and disable) may not work if you are using a symlink-style package management system. If this is the case, you can create or remove the necessary symbolic links manually. To enable read-ahead this way, run these commands as the root user: ln -sv /lib/systemd/system/systemd-readahead-collect.service /etc/systemd/system/multi-user.target.wants/ ln -sv /lib/systemd/system/systemd-readahead-replay.service /etc/systemd/system/multi-user.target.wants/ And to disable: rm /etc/systemd/system/multi-user.target.wants/systemd-readahead-collect.service rm /etc/systemd/system/multi-user.target.wants/systemd-readahead-replay.service I haven't tried this method, but it should work, and it's officially supported and documented. Boot ---- After following the above instructions, you should be able to boot normally and use sysvinit as you normally do. In order to boot with systemd instead, add "init=/bin/systemd" to the kernel command line. I hope you found this information useful, and of course any questions or comments are welcome. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page