大网数据广告活动
服务器运维问答

systemd-journald system logs are not persistent across boots despite Storage=persistent

· 52CE 我爱测

I recently got a problem with systemd not preserving logs from previous boots. I checked several answers here and elsewhere but haven't found a solution. the problem is that the user log gets persistent across boots but system lo…

问题原文

原帖链接 · Jan Peter König · CC BY-SA 4.0

I recently got a problem with systemd not preserving logs from previous boots. I checked several answers here and elsewhere but haven't found a solution.

the problem is that the user log gets persistent across boots but system logs are not

/etc/systemd/journald.conf

[Journal]
Storage=persistent
SystemMaxUse=500M
SystemMaxFiles=5

journalctl -b -1

[root@2ba2de9e /var/log/journal] # journalctl --system -b -1
Data from the specified boot (-1) is not available: No such boot ID in journal

I'm using archlinux arm on some raspberry pis

versions 4.14.24-1-ARCH systemd 237.64-1 systemd-sysvcompat 237.64-1

Anyone has an idea why this is occurring? on my desktop machine this is working without problems?

已采纳解答

原帖链接 · filbranden · CC BY-SA 3.0

It is possible that journald is removing the old logs because you're short on diskspace. (You didn't mention how long after boot the -b -1 is not working, so I don't know if you have many logs from the current boot at that time.)

You have SystemMaxUse=500M configured, but journald might decide to use less than 500MB if you don't have too much free diskspace. There is also a SystemKeepFree=... setting, which defaults to 15% of the size of the filesystem (or 4GB, whatever is smaller) and journald will enforce that limit more strongly than how much space you allow. If you have your /var/log/journal in a tight partition, maybe that might be part of the issue.

You can use some commands to check how much space journald is using, such as:

$ journalctl --disk-usage

And you and also see how many boots (and what are their times and IDs) journald knows about with:

$ journalctl --list-boots

These might also help shed a light on your issue...

I hope this helps!

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-03-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0 / CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。