systemctl 和 journalctl 找不到 charon-system.service

systemctl 和 journalctl 找不到 charon-system.service

如果我使用 grep 运行,服务就会出现在输出中

[root@maincore ~]# systemctl status --all | grep charon
       │   │ └─135060 grep --color=auto charon
         │ └─127087 /usr/sbin/charon-systemd
     Unit boot.automount could not be found.
     Unit boot.mount could not be found.
     Unit sysroot.mount could not be found.
       └─135060 grep --color=auto charon
Unit display-manager.service could not be found.
Unit ipa.service could not be found.
Unit krb5kdc.service could not be found.
Unit ntpd.service could not be found.
Unit ntpdate.service could not be found.
Unit postgresql.service could not be found.
Unit sntp.service could not be found.
Main PID: 127087 (charon-systemd)
Status: "charon-systemd running, strongSwan 5.8.2, Linux 4.18.0-240.1.1.el8_3.x86_64, x86_64"
       └─127087 /usr/sbin/charon-systemd
 Jan 24 16:41:48 maincore charon-systemd[127087]: generating IKE_AUTH response 1 [ IDr CERT  AUTH EAP/REQ/ID ]
 Jan 24 16:41:48 maincore charon-systemd[127087]: splitting IKE message (1856 bytes) into 2 fragments
 Jan 24 16:41:48 maincore charon-systemd[127087]: generating IKE_AUTH response 1 [ EF(1/2) ]
 Jan 24 16:41:48 maincore charon-systemd[127087]: generating IKE_AUTH response 1 [ EF(2/2) ]
 Jan 24 16:41:48 maincore charon-systemd[127087]: sending packet: (1236 bytes)

Unit systemd-timesyncd.service could not be found.
Unit ypbind.service could not be found.
Unit yppasswdd.service could not be found.
Unit ypserv.service could not be found.
Unit ypxfrd.service could not be found.
       │ │ └─127087 /usr/sbin/charon-systemd
           │ └─135060 grep --color=auto charon
       │ └─127087 /usr/sbin/charon-systemd
       │ └─135060 grep --color=auto charon
         │ └─135060 grep --color=auto charon
Unit dirsrv.target could not be found.
Unit syslog.target could not be found.

但是如果我将单元名称直接放入 systemctl 或 journalctl 中,它不起作用

[root@maincore ~]# systemctl status charon-systemd
Unit charon-systemd.service could not be found.

[root@maincore ~]# journalctl -u charon-systemd
-- Logs begin at Thu 2021-01-21 19:48:23 UTC, end at Mon 2021-01-25 00:29:45 UTC. --
-- No entries --

charon-systemd 服务有日志。出了什么问题?

[root@maincore ~]# systemctl list-units -t service 
UNIT                               LOAD   ACTIVE SUB     DESCRIPTION                                                       
auditd.service                     loaded active running Security       Auditing Service                                         
chronyd.service                    loaded active running NTP client/server                                                 
crond.service                      loaded active running Command Scheduler                                                 
dbus.service                       loaded active running D-Bus System Message Bus                                          
dracut-shutdown.service            loaded active exited  Restore /run/initramfs on shutdown                                
[email protected]                 loaded active running Getty on tty1                                                     
import-state.service               loaded active exited  Import network configuration from initramfs                       
irqbalance.service                 loaded active running irqbalance  daemon                                                 
kdump.service                      loaded active exited  Crash recovery kernel arming                                      
kmod-static-nodes.service          loaded active exited  Create list of required static device nodes for the current kernel
loadmodules.service                loaded active exited  Load legacy module configuration                                  
mariadb.service                    loaded active running MariaDB 10.3 database server                                      
network.service                    loaded active exited  LSB: Bring up/down networking                                     
● nginx.service                      loaded failed failed  The nginx HTTP and reverse proxy server                           
nis-domainname.service             loaded active exited  Read and set NIS domainname from /etc/sysconfig/network           
php-fpm.service                    loaded active running The PHP FastCGI Process Manager                                   
plymouth-quit-wait.service         loaded active exited  Hold until boot process finishes up                               
plymouth-quit.service              loaded active exited  Terminate Plymouth Boot Screen                                    
plymouth-read-write.service        loaded active exited  Tell Plymouth To Write Out Runtime Data                           
plymouth-start.service             loaded active exited  Show Plymouth Boot Screen                                         
polkit.service                     loaded active running Authorization Manager                                             
radiusd.service                    loaded active running FreeRADIUS high performance RADIUS server.                        
rngd-wake-threshold.service        loaded active exited  Hardware RNG Entropy Gatherer Wake threshold service              
rngd.service                       loaded active running Hardware RNG Entropy Gatherer Daemon                              
rsyslog.service                    loaded active running System Logging Service                                            
sshd.service                       loaded active running OpenSSH server daemon                                             
sssd.service                       loaded active running System Security Services Daemon                                   
strongswan.service                 loaded active running strongSwan IPsec IKEv1/IKEv2 daemon using swanctl                 
systemd-fsck-root.service          loaded active exited  File System Check on Root Device                                  
systemd-journal-flush.service      loaded active exited  Flush Journal to Persistent Storage                               
systemd-journald.service           loaded active running Journal Service                                                   
systemd-logind.service             loaded active running Login Service                                                     
systemd-random-seed.service        loaded active exited  Load/Save     Random Seed                                             
systemd-remount-fs.service         loaded active exited  Remount Root and Kernel File Systems                              
systemd-sysctl.service             loaded active exited  Apply Kernel Variables                                            
systemd-tmpfiles-setup-dev.service loaded active exited  Create Static Device Nodes in /dev                                
systemd-tmpfiles-setup.service     loaded active exited  Create Volatile Files and Directories                             
systemd-udev-trigger.service       loaded active exited  udev Coldplug all Devices                                         
systemd-udevd.service              loaded active running udev Kernel Device Manager                                        
systemd-update-utmp.service        loaded active exited  Update UTMP about System Boot/Shutdown                            
systemd-user-sessions.service      loaded active exited  Permit User Sessions                                              
tuned.service                      loaded active running Dynamic  System Tuning Daemon                                      
[email protected]      loaded active exited  /run/user/1000 mount wrapper                                      
[email protected]                  loaded active running User Manager for UID 1000   

[root@maincore ~]# systemctl list-unit-files | grep charon 
[root@maincore ~]# 

                                  

答案1

您混淆了进程的名称和启动该进程的 systemd 服务的名称。它们之间不一定有任何关系。

要查找负责正在运行的进程的 systemd 服务,请将其 PID 提供给systemctl status

systemctl status <PID>

例如,您似乎对 PID 为 127087 的进程感兴趣charon-systemd,因此您可以运行:

systemctl status 127087

现在您可以看到实际的服务名称及其状态。

相关内容