使用systemd启动ntpd时,为什么ntpd pid的挂载命名空间与pid 1不同?
当使用systemd启动ntpd时
仅挂载命名空间与 pid 1 不同;
你看到 ntpd mnt:[4026532696] ,但是 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]
何时不使用systemd启动ntpd
如果不使用 systemd 启动 ntpd ,则 ntpd pid 的挂载命名空间与 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]
由 systemd 启动的其他守护进程看起来不错
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]