0

I am updating a device running Yocto from Pyro with kernel 4.19 to Gatesgarth with kernel 5.10; this forces me to rewrite my old SysVinit scripts to SystemD unit files.
Trying to figure out which service launches when, I went to dmesg | grep ... and I encountered this problem: dmesg does not show me all the messages that I can see during boot, for example all the strings containing [ OK ] are missing (example of what i mean in the picture).
terminal screenshot

In the previous version where this syntax was not present, the dmesg command would reprint line-by-line everthing happened since the kernel initialization.
What is the name of these lines and where can I find them? I suspect them to be some output of SystemD and that's the reason they don't show up when I check kernel messages, but since i've never used SystemD before, my google-fu is quite lacking on this, and man systemd didn't seem to be helpful either (I tried looking around for .

Any hint will be greatly appreciated :)

2 Answers 2

1

They're just free-form "console messages" without any other more-specific term. The init system traditionally prints them to /dev/console as it processes its /etc/rc scripts, or the scripts themselves write there.

In the previous version where this syntax was not present, the dmesg command would reprint line-by-line everthing happened since the kernel initialization.

No, that's not what the dmesg command has ever done. What it prints are kernel log buffer messages only.

In your screenshot, some of the messages are sent to the kernel log buffer, and the kernel forwards them to the console, while the other half are written directly to the console.

Messages written to the console never go in the kernel log, regardless of what prints them – systemd, openrc, sysvinit, or something else.

Indeed as far as I can remember, earlier init systems would only write to the console – systemd was the one that started also logging to dmesg (and introduced /dev/kmsg for that purpose), not the other way around.

The console messages don't actually go to any log – the ones you find in journalctl are again sent there separately (or copied from dmesg), and usually with more metadata than console messages have. Adding _PID=1 would show just the ones sent by systemd, while -u foo would show all messages about foo.service.


As for "which service launches when", systemd tracks this per-service – you've already found journalctl, but roughly the same information is available in systemctl status for each service, and an overall diagram can be generated using systemd-analyze plot > foo.svg.

The boot process is not linear, so do not try to guess it from the timing. Systemd does not guarantee any specific order other than "after basic.target" by default, so it's often mandatory to explicitly specify your dependencies in Wants=/After=. Use systemctl list-dependencies [--after] and see the diagram in man bootup.

1
-1

After more Googling I came across this question, which solves my problem: I just needed to change dmesg | grep ... with journalctl -b | grep ....

However, I still could not find out how these messages are called, and apparently neither could one of the commenters of the linked question.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.