4

systemd シャットダウンの問題をデバッグしています。ここでの問題は、サービスがまだ実行されている間に一部のファイルシステムがアンマウントされることです。

一般に、systemd は最初にサービスをシャットダウンしてから、マウント ポイントをアンマウントします。

しかしここでは、サービスのアンマウントと停止が並行して行われています。(下記参照)。また、最初にルートファイルシステムをアンマウントします。

#        Unmounting /root...
         Unmounting /var/lib/ntp...
         Unmounting /etc/cron.d/local...
[  OK  ] Stopped Apply Kernel Variables.
         Unmounting /proc/fs/nfsd...
         Unmounting /tmp/rshell/trace...
         Stopping Availability of block devices...
         Unmounting /etc/timestamp...
         Unmounting /var/lib/nfs/rpc_pipefs...
         Unmounting /etc/sysconfig/clock...
[  OK  ] Removed slice system-getty.slice.
[  OK  ] Stopped Load Kernel Modules.
         Unmounting /etc/ssh/ssh_external_host_rsa_key...
[  OK  ] Stopped Create Static Device Nodes in /dev.
         Unmounting /mnt/log...
[  OK  ] Stopped Resets System Activity Logs.
         Stopping Crond Periodic Command Scheduler...
[  OK  ] Stopped Mount Restricted SFTP Jail Folders.
[  OK  ] Stopped Mount Restricted Shell Folders.
         Stopping Runs processtat...
         Unmounting /etc/ssh/ssh_external_host_ecdsa_key.pub...
[  OK  ] Stopped target RPC Port Mapper.
         Unmounting /boot...
         Unmounting /srv...
         Stopping Initializes network console logging...
[  OK  ] Stopped Crond Periodic Command Scheduler.
[FAILED] Failed unmounting /root.
[  OK  ] Unmounted /var/lib/ntp.
[  OK  ] Unmounted /etc/cron.d/local.
**[FAILED] Failed unmounting /mnt/sysimg.**
[  OK  ] Unmounted /etc/sysconfig/clock.
[  OK  ] Unmounted /usr/share/cracklib.
**[FAILED] Failed unmounting /run/netns.**
[  OK  ] Unmounted /tftpboot/state.
**[FAILED] Failed unmounting /tmp/ldap.**

これをsystemdでどのように同期しますか?

通常、systemd-reboot.service は final.target、shutdown.target、および umount.target に依存します。

ここでは、umount.target と shutdown.target が並行して実行されているようです。

# cat /usr/lib/systemd/system/systemd-reboot.service 
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Reboot
Documentation=man:systemd-halt.service(8)
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --force reboot

umount.target は shutdown.target に依存していますが、役に立ちませんでした。これらのアンマウントとサービスのシャットダウンは常に並行して行われているようです。私の理解が間違っている場合は、修正してください。

最初にサービスを適切にシャットダウンしてから、マウント ポイントをアンマウントするためのヒントや提案をお寄せください。

4

1 に答える 1