1. 作成/etc/systemd/system/nfs-common.service

1. 作成/etc/systemd/system/nfs-common.service

私のRaspbian(Debian Jessieベース)では、NFSマウント用に起動時に起動する必要があるため、起動時に起動してrpcbindサービスnfs-commonする必要があります。autofs

Debian Jessieが現在Debianに移行されたので、systemd問題を回避するために、この3つのサービス(rpcbind、nfs-commond、autofs)を正しい順序で開始するための最良の方法を知りたいです。

NFS共有を手動でマウントすると機能します。 autofs サービスを使用し、rpcbind および nfs-common が実行されている場合にも機能します。

autofs は systemd 単位スクリプトを使用します。他の2つのサービスに対してinit.dスクリプトを作成する必要がありますか、またはシステム単位ファイルを作成する必要がありますか?どのように書くべきですか?

ベストアンサー1

問題の原因は不足です。システム構成ファイル。に基づいてMatt Grantの記事以下は、debian-devel実行すべきステップです。

1. 作成/etc/systemd/system/nfs-common.service

cat >/etc/systemd/system/nfs-common.service <<\EOF
[Unit]
Description=NFS Common daemons
Wants=remote-fs-pre.target
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/nfs-common start
ExecStop=/etc/init.d/nfs-common stop

[Install]
WantedBy=sysinit.target
EOF

2. 作成/etc/systemd/system/rpcbind.service

cat >/etc/systemd/system/rpcbind.service <<\EOF
[Unit]
Description=RPC bind portmap service
After=systemd-tmpfiles-setup.service
Wants=remote-fs-pre.target
Before=remote-fs-pre.target
DefaultDependencies=no

[Service]
ExecStart=/sbin/rpcbind -f -w
KillMode=process
Restart=on-failure

[Install]
WantedBy=sysinit.target
Alias=portmap
EOF

3.作成/etc/tmpfiles.d/rpcbind.conf

cat >/etc/tmpfiles.d/rpcbind.conf <<\EOF
#Type Path        Mode UID  GID  Age Argument
d     /run/rpcbind 0755 root root - -
f     /run/rpcbind/rpcbind.xdr 0600 root root - -
f     /run/rpcbind/portmap.xdr 0600 root root - -
EOF

4. 起動時に実行するサービスの構成

systemctl enable rpcbind.service
systemctl enable nfs-common

おすすめ記事