Acer Aspire V3-772 Ubuntu系统旧boot.log及journal日志缺失问题排查求助
我的设备是Acer Aspire V3-772,配置8GB内存,装的是Ubuntu 22.04.3 LTS,桌面环境用的Gnome 42.9,Wayland显示服务器,UEFI启动模式。
最近朋友的这台笔记本总是出现关机异常的问题,我想通过查看之前的boot.log来排查原因,但用ls /var/log查看日志目录时,发现只有当前的boot.log文件,旧的日志完全找不到:
auth.log boot.log btmp cups dmesg gdm3 gpu-manager.log journal kern.log lastlog private syslog ubuntu-advantage.log unattended-upgrades wtmp
之后我又去看systemd的journal日志,进入/var/log/journal目录后,只看到一个名为9be0c0a693aa409aa7b4e30f37396627的文件夹,里面也只有当前启动的日志,没有任何历史日志。我不确定这台机器之前是否有保留旧日志的情况,还是从一开始就是这样的。
我了解到日志的保留行为是由logrotate.conf控制的,所以我查看了它的配置内容,看起来是比较标准的设置:
global options do not affect preceding include directivesrotate log files weeklyweekly
use the adm group by default, since this is the owning groupof /var/log/syslog.su root adm
keep 4 weeks worth of backlogsrotate 4
create new (empty) log files after rotating old onescreate
use date as a suffix of the rotated file#dateext
uncomment this if you want your log files compressed#compress
packages drop log rotation information into this directoryinclude /etc/logrotate.d
system-specific logs may also be configured here.
另外,当前日志里有几个标记为重要的错误,不知道是否和日志缺失有关,我把它们列出来:
- ACPI Error: Aborting method _SB.PCI0.PEG0.PEGP.DD02._BCL due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
- ACPI BIOS Error (bug): Could not resolve symbol [_SB.PCI0.GFX0.DD02._BCL], AE_NOT_FOUND (20210730/psargs-330)
- Can't chdir to /var/spool/anacron: No such file or directory
- Timed out waiting for device /sys/devices/virtual/misc/vmbus!hv_kvp.
- Failed to start Application launched by gnome-session-binary.
我已经查了很多相关资料,但还是没找到日志缺失的原因,想请教大家:为什么旧的日志文件(早于当前启动的)会完全消失?
编辑补充:
我看到有资料提到,如果只能查看当前日志,可能是/etc/var/下没有journal目录,需要手动创建;或者在/etc/systemd/journald.conf里设置storage = persistent,这样系统会自动创建journal目录并保存持久化日志。但我的系统里journal目录已经存在了,而且设置storage = persistent后也没有任何变化。我想问问大家:如果我删除现有的journal目录,让系统通过设置storage = persistent的机制重新创建这个目录,会不会就能让系统正常保留历史日志了?这样操作安全吗?
备注:内容来源于stack exchange,提问作者plopper

