Bug 86034

Summary: journalctl cannot be used when systems is not started
Product: systemd Reporter: chris21 <chris21.roux>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTABUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description chris21 2014-11-08 12:29:56 UTC
I am starting my system with a rescue cd boot, and I want to consult system logs from a previous boot without system started.
Journalctl works only when systems is started.
Is there a work around to consult a previous boot logs without starting system?
Comment 1 chris21 2014-11-08 12:32:17 UTC
Sorry for automatic completion orthography; here is the real text:
I am starting my system with a rescue cd boot, and I want to consult systemd logs from a previous boot without systemd started.
Journalctl works only when systemd is started.
Is there a work around to consult a previous boot logs without starting systemd?
Comment 2 Ronny Chevalier 2014-11-08 22:14:00 UTC
Hi,

There is the --directory or --file arguments to make journalctl operate on a directory or on a specific journal file instead of the system journal files.

Did you use one of these arguments ?
Comment 3 chris21 2014-11-09 14:53:29 UTC
Hello Ronny,

I don't understand:
are you telling me to use the --directory or --file argument to make journalctl operate on the system journal files as it is its default behavior?
Comment 4 Ronny Chevalier 2014-11-09 15:25:41 UTC
Hmm, you are right.

In this case you need to use the --root option. Since you use a rescue cd boot, you mounted your system in /mnt/ or equivalent, journalctl needs to know where is the root filesystem, so: journalctl --root=/mnt/

If this is not the problem what arguments did you use ? and what error is shown by journalctl exactly ?
Comment 5 chris21 2014-11-10 09:25:03 UTC
No Ronny,
I am chrooted.
Comment 6 Ronny Chevalier 2014-11-10 12:01:39 UTC
Ok, can you provide the error shown by journalctl and the command line you used ?
Comment 7 Lennart Poettering 2014-11-10 12:18:40 UTC
journalctl looks for the journal files in /var/log/journal/<machine-id>/. If you boot up with a rescue OS that has a different machine ID or a different root it hence won't find any data there.

Hence, make sure:

a) to either chroot to the host OS, and then use journalctl --directory=/var/log/journal/<machine-id>

b) or chroot to the host OS, and then use journalctl -m

b) or to run journalctl --directory=<pathtorootdir>/var/log/journal/<machine-id>

c) or to run journalctl --root=<pathtorootdir> -m

The "-m" swicth merges the journals of all directories in /var/log/journal/*, hence makes it unnecessary to figure out the machine id of the host.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.