• I'm running ArchLinux, using the systemd binary to start necessary services as part of the initramfs (root fs decryption, mounting etc.).
  • I would like to examine what systemd units are started as part of this stage, and when.
  • systemd-analyze plot only shows me a time-graph of all the units after the switch-root has taken place.
  • The switch root unit (by definition the last unit in the initrd boot sequence) states:

    # ...
    ExecStart=/usr/bin/systemctl --no-block --force switch-root /sysroot
    # ...
  • The systemctl man page on the switch-root system command has this to say:

    switch-root ROOT [INIT]

    Switches to a different root directory and executes a new system manager process below it. This is intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host volume. This call takes twoarguments: the directory that is to become the new root directory, and the path to the new system manager binary below it to execute as PID 1. If the latter is omitted or the empty string, a systemd binary will automatically be searched for and used as init. If the system manager path is omitted, equal to the empty string or identical to the path to the systemd binary, the state of the initrd's system manager process is passed to the main system manager, which allows later introspection of the state of the services involved in the initrd boot phase.

    and then is quiet on the matter of initrds...


After boot, how can I introspect the state of the services involved in the initrd boot phase as inferred above, or discover what units were even run (as some are dynamically generated)?

  • Have you looked at the output of sudo journalctl |grep -i initrd? Is that at least along the lines of what you are looking for? – airhuff Feb 1 '17 at 21:43

https://freedesktop.org/wiki/Software/systemd/Debugging/ suggests using journalctl -b to view log messages from boot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.