1

TL;DR: how to access the systemd journal of an offline systemd instance.

So I am migrating some machines over to Ubuntu 16.04 now from the previous LTS version. This means everything is now based on systemd.

Normally I am bootstrapping my machines from a rescue disk of the same version I intend to install, using debootstrap. The reason for this is that for many of my machines I have to run a headless setup.

In a recent case, a machine I am supposed to prepare was booted for me by someone on a remote site, an SSH server was started and a user account configured such that I could log on. That machine had a screen, but due to setting an incompatible mode, the screen remained blank from the point where Ubuntu shows the splash screen. I solved this in the GRUB2 config meanwhile, but the point is, that it was also essentially a headless scenario.

So I set up the machine using debootstrap and tried to boot. The screen remained blank (and either way, I would not have seen the screen myself like in an actual headless installation).

Nothing happened, but the machine could be pinged, but SSH was evidently not running. Puzzling ...

When I rebooted the machine, I was faced with the task to access the systemd journal from the offline machine to figure out what went wrong. I.e. a journal of a systemd instance that wasn't running but of the same version as the one running.

Question: how can I access the systemd journal of a systemd instance that isn't currently running?

# systemd --version
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN
3

If you can mount the disk of your offline system, you can use the -D or --directory option with journalctl. For example, if you mount the disk to /mnt, you can access its journal with

journalctl -D /mnt/var/log/journal
2
  • 1
    Hi Jason and welcome to Unix.SE! Thanks for the answer. Unfortunately it comes a little late for my problem back then, but still much appreciated you took the time to answer! Nov 17 '20 at 7:14
  • 1
    I realize a lot of time had passed, and I wanted to answer it because I had the same question and imagine I will have it again some time in the future.
    – Jason
    Nov 18 '20 at 20:18

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.