Systemd被诟病的很多的点之一就是出现问题之后很难确认原因,其实在很早的时候systemd就提供了debug的方法,这篇文章介绍常用的一种方式,并结合一个常见的很容易忽视的问题来进行说明。
场景
workingdirectory事前不存在,但是status提示信息过少,journalctl没有有益信息提示,详细可参看下述文章:
设定方式
使用如下方式可以在CentOS7上得到验证可以对服务启动进行debug,与其说debug,更准确地说是打出相关的日志信息以进行辅助。
Step 1: 设定system.conf
对象文件:/etc/systemd/system.conf
- 修改内容:设定LogLevel
LogLevel=debug
- 设定例
[root@liumiaocn systemd]# cat system.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See systemd-system.conf(5) for details.
[Manager]
LogLevel=debug
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#CrashShell=no
#ShowStatus=yes
#CrashChVT=1
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
#JoinControllers=cpu,cpuacct net_cls,net_prio
#RuntimeWatchdogSec=0
#ShutdownWatchdogSec=10min
#CapabilityBoundingSet=
#SystemCallArchite