列出缺失的服务
systemctl --state=not-found --all
输出:
UNIT LOAD ACTIVE SUB DESCRIPTION
● boot.automount not-found inactive dead boot.automount
● home.mount not-found inactive dead home.mount
● tmp.mount not-found inactive dead tmp.mount
● connman.service not-found inactive dead connman.service
● console-screen.service not-found inactive dead console-screen.service
● dpdk.service not-found inactive dead dpdk.service
● fcoe.service not-found inactive dead fcoe.service
● firewalld.service not-found inactive dead firewalld.service
● haveged.service not-found inactive dead haveged.service
● ip6tables.service not-found inactive dead ip6tables.service
● iptables.service not-found inactive dead iptables.service
● iscsi-shutdown.service not-found inactive dead iscsi-shutdown.service
● iscsi.service not-found inactive dead iscsi.service
● iscsid.service not-found inactive dead iscsid.service
● kbd.service not-found inactive dead kbd.service
● rbdmap.service not-found inactive dead rbdmap.service
● systemd-hwdb-update.service not-found inactive dead systemd-hwdb-update.service
● systemd-oomd.service not-found inactive dead systemd-oomd.service
● systemd-update-done.service not-found inactive dead systemd-update-done.service
● systemd-vconsole-setup.service not-found inactive dead systemd-vconsole-setup.service
● xencommons.service not-found inactive dead xencommons.service
● xendomains.service not-found inactive dead xendomains.service
● virtlxcd.socket not-found inactive dead virtlxcd.socket
● virtqemud.socket not-found inactive dead virtqemud.socket
● virtvboxd.socket not-found inactive dead virtvboxd.socket
● virtvzd.socket not-found inactive dead virtvzd.socket
● virtxend.socket not-found inactive dead virtxend.socket
查找引用缺失服务的单元
grep -rR "<service_name>" /usr/lib/systemd
grep -rR "<service_name>" /etc/systemd
# See tables in man page for more directories to search with grep and to learn their purpose
man systemd.unit
样品tmp.mount
grep -rR "tmp.mount" /usr/lib/systemd
grep -rR "tmp.mount" /etc/systemd
输出:
/usr/lib/systemd/system/basic.target:After=sysinit.target sockets.target paths.target slices.target tmp.mount
/usr/lib/systemd/system/basic.target:Wants=tmp.mount
清理引用
sudo nano /usr/lib/systemd/system/basic.target
内容:
[Unit]
Description=Basic System
Documentation=man:systemd.special(7)
Requires=sysinit.target
Wants=sockets.target timers.target paths.target slices.target
After=sysinit.target sockets.target paths.target slices.target tmp.mount
RequiresMountsFor=/var /var/tmp
Wants=tmp.mount
在这里我们发现tmp.mount
了After=
Wants=
我想删除这些条目以便systemctl --state=not-found --all
不再列出它,对于每个缺失的单元也是如此。
问题
删除系统上每个缺失单元的此类条目是否安全?