Listar serviços ausentes
systemctl --state=not-found --all
Saída:
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
Encontre unidades que fazem referência a serviços ausentes
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
Amostra paratmp.mount
grep -rR "tmp.mount" /usr/lib/systemd
grep -rR "tmp.mount" /etc/systemd
Saída:
/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
Limpar referências
sudo nano /usr/lib/systemd/system/basic.target
Conteúdo:
[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
Aqui encontramos tmp.mount
abaixo After=
eWants=
Quero excluir essas entradas para que systemctl --state=not-found --all
não sejam mais listadas, e assim por diante para cada unidade ausente.
Pergunta
É seguro excluir essas entradas para cada unidade ausente no sistema?
Não. Você pode perceber que eles estão lá para o caso de, em algum momento, algum serviço ser introduzido.
Ao removê-los, você obtém:
você não consegue:
Mas por quê? Elas não "custam" nada, não são problemáticas, na verdade, elas são feitas para serem suportadas dessa forma.
Então, deixe-os em paz.
E esse seria seu primeiro erro de quebra de sistema.
tmp.mount
não ser encontrado não significa que especificá-lo não seja importante. Este não é um arquivo de serviço comum, mas uma unidade de montagem... então, realmente, mãos das coisas.