[HowTo] Getting journald to forward its output to virtual console 12

This post is a wiki post ─ any member with sufficient privileges can edit this. Please edit, amend and/or correct wherever necessary. :slight_smile:


INTRODUCTION

Those of us who are new to distributions that use systemd as PID 0 might remember (and miss) how traditional system loggers on sysvinit-based distributions write their output to virtual console 12 ─ i.e. /dev/tty12 ─ in real-time. However, journald, the system logger of systemd, also allows for this, albeit that it's not enabled by default in Manjaro. Doing so is not that difficult, though. :wink:

HOW TO DO IT

It's a two-step procedure. The first step is to edit /etc/systemd/journald.conf. Open up a terminal window and type...

sudo nano /etc/systemd/journald.conf

The file lists all of the options in their default values as set when journald was compiled, and as common in GNU/Linux configuration files, a "#" character at the beginning of a line signifies that the line is a comment.

In order to enable logging to a virtual console, we're going to change two values by removing their comment prefix "#" and changing the value of the option. The two options we have to un-comment and change are the following...

#ForwardToConsole=no
#TTYPath=/dev/console

Change this to...

ForwardToConsole=yes
TTYPath=/dev/tty12

Save the file by pressing Ctrl+O. You will be prompted on whether to overwrite the file or enter another filename. Hit the Return/Enter key. Press Ctrl+X to exit nano.

The second step is to activate the changes to the configuration, which you do by rehashing the configuration files, like so...

sudo systemctl daemon-reload

From this moment on, you will be able to see journald's output in real-time by switching over to virtual console 12, which you do by pressing Ctrl+Alt+F12. Of course, there won't be much ─ if anything at all ─ on the screen of your terminal yet right now, depending on whether there is anything worth writing to the log at this particular moment in time. But a few hours from now, there will be a lot more information on the screen of the logging console.

And of course, in order to switch over to your graphical desktop environment or window manager again, all you need to do is press Alt+F1 (for KDE Plasma) or Alt+F7 (for XFCE), or whatever other matching key combination for the virtual console that your graphical session runs at.


Hopefully this was useful, and remember that this is a wiki post, so it can be edited, amended and/or corrected where needed. :slight_smile:

5 Likes

Good advice.

I suggest adapting the log level as well, depending on your needs:
MaxLevelConsole=info
(I find 'debug' to be a little too verbose for tty).

3 Likes

Forum kindly sponsored by Bytemark