UNIT LOAD ACTIVE SUB DESCRIPTION proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File Syste sys-devices-pc...0-1:0:0:0-block-sr0.device loaded active plugged VBOX_CD-ROM sys-devices-pc...:00:03.0-net-enp0s3.device loaded active plugged PRO/1000 MT Desktop Adapter sys-devices-pc...00:05.0-sound-card0.device loaded active plugged 82801AA AC'97 Audio Controller sys-devices-pc...:0:0-block-sda-sda1.device loaded active plugged VBOX_HARDDISK sys-devices-pc...:0:0-block-sda-sda2.device loaded active plugged LVM PV Qzyo3l-qYaL-uRUa-Cjuk-pljo-qKtX-VgBQ8 sys-devices-pc...0-2:0:0:0-block-sda.device loaded active plugged VBOX_HARDDISK sys-devices-pl...erial8250-tty-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0 sys-devices-pl...erial8250-tty-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1 sys-devices-pl...erial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2 sys-devices-pl...erial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3 sys-devices-virtual-block-dm\x2d0.device loaded active plugged /sys/devices/virtual/block/dm-0 sys-devices-virtual-block-dm\x2d1.device loaded active plugged /sys/devices/virtual/block/dm-1 sys-module-configfs.device loaded active plugged /sys/module/configfs ...
9. 列出所有失败单元
1 2 3 4 5 6 7 8 9 10 11 12
# systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION kdump.service loaded failed failed Crash recovery kernel arming
LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type.
1 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
10. 检查某个单元(如 cron.service)是否启用
1 2 3 4
# systemctl is-enabled crond.service
enabled
11. 检查某个单元或服务是否运行
1 2 3 4 5 6 7 8 9 10 11 12
# systemctl status firewalld.service
firewalld.service - firewalld -dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Tue2015-04-2816:27:55IST; 34min ago MainPID: 549 (firewalld) CGroup: /system.slice/firewalld.service └─549/usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) Active: active (running) since Tue 2015-04-28 17:21:30 IST; 6s ago Process: 2876 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) Main PID: 2881 (httpd) Status: "Processing requests..." CGroup: /system.slice/httpd.service ├─2881 /usr/sbin/httpd -DFOREGROUND ├─2884 /usr/sbin/httpd -DFOREGROUND ├─2885 /usr/sbin/httpd -DFOREGROUND ├─2886 /usr/sbin/httpd -DFOREGROUND ├─2887 /usr/sbin/httpd -DFOREGROUND └─2888 /usr/sbin/httpd -DFOREGROUND
Apr 28 17:21:30 tecmint systemd[1]: Starting The Apache HTTP Server... Apr 28 17:21:30 tecmint httpd[2881]: AH00558: httpd: Could not reliably determine the server's fully q...ssage Apr 28 17:21:30 tecmint systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full.
httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) Active: failed (Result: exit-code) since Tue 2015-04-2818:01:42 IST; 28min ago Main PID: 2881 (code=exited, status=0/SUCCESS) Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
Apr2817:37:29 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:29 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:39 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:39 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:49 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:49 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:59 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2817:37:59 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. Apr2818:01:42 tecmint systemd[1]: httpd.service: control process exited, code=exited status=226 Apr2818:01:42 tecmint systemd[1]: Unit httpd.service entered failed state. Hint: Some lines were ellipsized, use -l to show in full.
Broadcast message from root@tecmint on pts/0 (Wed 2015-04-2911:31:18 IST):
The system is going down to rescue mode NOW!
33. 进入紧急模式
1 2 3 4 5 6
# systemctl emergency
Welcome to emergency mode! After logging in, type "journalctl -xb" toview system logs, "systemctl reboot" to reboot, "systemctl default" to try again to boot intodefault mode.