systemd-journald无法在CentOS 7上启动

自从一个星期前,journald没有开始了。 启动时,它启动并logging引导消息和其他一些服务启动日志,然后在启动Switch Root时突然closures:

 Mar 18 05:22:56 playground1.local systemd-journal[96]: Runtime journal is using 8.0M (max allowed 391.1M, trying to leave 586.7M free of 3.8G available → current limit 391.1M). Mar 18 05:22:56 playground1.local systemd-journal[96]: Runtime journal is using 8.0M (max allowed 391.1M, trying to leave 586.7M free of 3.8G available → current limit 391.1M). Mar 18 05:22:56 playground1.local kernel: Initializing cgroup subsys cpuset Mar 18 05:22:56 playground1.local kernel: Initializing cgroup subsys cpu Mar 18 05:22:56 playground1.local kernel: Initializing cgroup subsys cpuacct Mar 18 05:22:56 playground1.local kernel: Linux version 3.10.0-327.10.1.el7.x86_64 ([email protected].centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Tue Feb 16 17:03:50 UTC 2016 Mar 18 05:22:56 playground1.local kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-327.10.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_US.UTF-8 console=ttyS0 systemd.debug ... Mar 18 05:22:57 playground1.local systemd[1]: Reached target Switch Root. Mar 18 05:22:57 playground1.local systemd[1]: Starting Switch Root. Mar 18 05:22:57 playground1.local systemd[1]: Starting Switch Root... Mar 18 05:22:57 playground1.local systemd[1]: Switching root. Mar 18 05:22:57 playground1.local systemd-journal[96]: Journal stopped 

如果我尝试手动启动,它会很快失败:

 [root@playground1 ~]# systemctl start systemd-journald.service Job for systemd-journald.service failed because the control process exited with error code. See "systemctl status systemd-journald.service" and "journalctl -xe" for details. [root@playground1 ~]# systemctl status systemd-journald.service ● systemd-journald.service - Journal Service Loaded: loaded (/usr/lib/systemd/system/systemd-journald.service; static; vendor preset: disabled) Active: failed (Result: start-limit) since Fri 2016-03-18 16:38:21 EDT; 21s ago Docs: man:systemd-journald.service(8) man:journald.conf(5) Process: 3404 ExecStart=/usr/lib/systemd/systemd-journald (code=exited, status=1/FAILURE) Main PID: 3404 (code=exited, status=1/FAILURE) Status: "Shutting down..." [root@playground1 ~]# 

journalctl -xe打印启动日志,手动启动服务时,它不会实际写任何东西到日志。 如果我删除日志文件,它不会被创build。

手动运行/usr/lib/systemd/systemd-journald类的工作,这意味着进程启动, journalctl包含日志启动日志,但事后没有其他logging。

systemd-journald.socket似乎也无法加载,这可能是失败的原因,但我没有看到有关它的日志中的任何东西:

 [root@playground1 systemd]# systemctl status systemd-journald.socket ● systemd-journald.socket - Journal Socket Loaded: loaded (/usr/lib/systemd/system/systemd-journald.socket; static; vendor preset: disabled) Active: failed (Result: service-failed-permanent) since Fri 2016-03-18 16:46:24 EDT; 4min 8s ago Docs: man:systemd-journald.service(8) man:journald.conf(5) Listen: /run/systemd/journal/stdout (Stream) /run/systemd/journal/socket (Datagram) /dev/log (Datagram) 

我不认为它与SELinux有关,因为唯一被拒绝的是读取machine-id ,这不应该是一个showstopper。 但是,我在审计日志中注意到的一件奇怪的事情是该服务似乎正在启动两次?

 type=AVC msg=audit(1458334641.993:330): avc: denied { read } for pid=3689 comm="systemd-journal" name="machine-id" dev="dm-0" ino=67109045 scontext=system_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file type=SYSCALL msg=audit(1458334641.993:330): arch=c000003e syscall=2 success=no exit=-13 a0=7fbc38ebf08f a1=80100 a2=7ffeb87c80bf a3=3 items=0 ppid=1 pid=3689 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-journal" exe="/usr/lib/systemd/systemd-journald" subj=system_u:system_r:syslogd_t:s0 key=(null) type=SERVICE_START msg=audit(1458334642.002:331): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-journald comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed' type=SERVICE_START msg=audit(1458334642.002:332): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-journald comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' type=SERVICE_STOP msg=audit(1458334642.002:333): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-journald comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' 

看到两个SERVICE_START消息,一个是res=failed ,另一个是res=success

谷歌告诉我,没有人有这个问题。 有任何想法吗?

AVC指示正在读取的文件没有SELinux标签。

如果在创build文件时SELinux被禁用,或者在不支持SELinux的文件系统(如vfat)上创build,则会发生这种情况。

如果有人禁用并重新启用了SELinux,那么您应该可以通过重新标记文件系统来解决问题(可能还有其他许多问题)。 您可以通过以下方式在线完成

 restorecon -r / 

如果文件所在的文件系统不支持SELinux,则需要将其replace为支持SELinux的文件系统,然后重新标记。