Repository navigation
lib: add dmesg fallback for kernel log access on non-systemd systems - #1368
Merged
Merged
Conversation
The test framework assumed systemd: kernel logs were read with journalctl, so it could not be used on distributions without it, such as Artix Linux, Gentoo with OpenRC, Yocto or other embedded OSes. Rename journalctl_cmd() to kernel_logger_cmd(). It still uses "journalctl -k" when journalctl is available. Otherwise it falls back to "dmesg -k", mapping --priority to the dmesg equivalent --level. Use the wrapper everywhere kernel logs are read, including fw_relfilepath_from_klogs(), which called journalctl directly, and the callers in verify-sof-firmware-load.sh and sof-kernel-log-check.sh. Also save the kernel messages collected since KERNEL_CHECKPOINT (or all of them if the checkpoint is disabled) to dmesg.txt in the exit handler. Flush the logs to disk with sync in case the DUT is power reset. Call "sudo true" in setup_kernel_check_point() so the sudo credentials are cached before the log commands run. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
marc-hb
reviewed
Nov 24, 2026
marc-hb
left a comment
Contributor
There was a problem hiding this comment.
Renaming the function seems unncessary.
lgirdwood
approved these changes
Nov 27, 2026
marc-hb
reviewed
Nov 27, 2026
| mapped_args+=("${arg/--priority/--level}") | ||
| done | ||
|
|
||
| sudo dmesg -k --nopager "${mapped_args[@]}" |
Contributor
There was a problem hiding this comment.
-
This is dropping the important
--sinceargument: exactly whydmesgis unsuitable for testing. -
Other obvious reason why is: unknown ring buffer size and losing logs at very verbose levels.
Embedded systems like Yocto aside, "systemd-free" distros have /var/log/something that should have been used instead of dmesg. It would have avoided at least issue 2.
At least it does not seem to affect systems that do have journalctl....
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test framework assumed systemd: kernel logs were read with journalctl, so it could not be used on distributions without it, such as Artix Linux, Gentoo with OpenRC, Yocto or other embedded OSes.
Rename journalctl_cmd() to kernel_logger_cmd(). It still uses "journalctl -k" when journalctl is available. Otherwise it falls back to "dmesg -k", mapping --priority to the dmesg equivalent --level.
Use the wrapper everywhere kernel logs are read, including fw_relfilepath_from_klogs(), which called journalctl directly, and the callers in verify-sof-firmware-load.sh and sof-kernel-log-check.sh.
Also save the kernel messages collected since KERNEL_CHECKPOINT (or all of them if the checkpoint is disabled) to dmesg.txt in the exit handler. Flush the logs to disk with sync in case the DUT is power reset.
Call "sudo true" in setup_kernel_check_point() so the sudo credentials are cached before the log commands run.