quando usar systemd start ntpd mount namespace é diferente de pid 1

0

quando usar o systemd para iniciar o ntpd, por que o namespace de montagem do ntpd pid é diferente do pid 1?

quando usar o systemd start ntpd

apenas o namespace mount é diferente do pid 1;

você vê ntpd mnt: [4026532696], mas, pid 1 é mnt: [4026531840]
#ll /proc/'pidof ntpd'/ns
total 0
lrwxrwxrwx 1 root root 0 Jun  7 17:58 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 mnt -> mnt:[4026532696]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 uts -> uts:[4026531838]

#ll /proc/1/ns
total 0
lrwxrwxrwx 1 root root 0 Jun  7 17:58 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 uts -> uts:[4026531838]

quando não usa o systemd para iniciar o ntpd

se não usar o systemd para iniciar o ntpd, o namespace de montagem do ntpd pid é o mesmo com o namespace de montagem do pid 1

#systemctl stop ntpd

#/usr/sbin/ntpd -u ntp:ntp -g

#ll /proc/'pidof ntpd'/ns
total 0
lrwxrwxrwx 1 root root 0 Jun 20 19:46 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 uts -> uts:[4026531838]

#ll /proc/1/ns
total 0
lrwxrwxrwx 1 root root 0 Jun  7 17:58 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 uts -> uts:[4026531838]

outro daemon iniciado pelo systemd parece ser bom

sshd pid é 1252

#ll /proc/1252/ns/
total 0
lrwxrwxrwx 1 root root 0 Jun 20 19:52 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 uts -> uts:[4026531838]
    
por 穆阿浩 20.06.2017 / 13:49

1 resposta

1

Isso variará de uma distro para a próxima, mas acho que isso é resultado do uso do recurso PrivateTmp: true do systemd.

Conforme descrito na seção Service-Private / tmp da esta postagem do blog de Lennart Poettering:

Internally, this feature makes use of file system namespaces of the kernel. If enabled a new file system namespace is opened inheritng most of the host hierarchy with the exception of /tmp

Veja, por exemplo, este relatório de erros solicitando que esta opção seja adicionada ao Fedora.     

por 20.06.2017 / 15:27