NFS Server stopped before VMs during shutdown


New Member
Jul 3, 2023
After upgrading to Proxmox v8, I noticed that powering off / rebooting the host stops the nfs-server immediately, while VM are still running and connected to the NFS server.

I compared the systemd unit and this is what changed, but I'm not sure if the problem is here:

--- /tmp/pve1/lib/systemd/system/nfs-server.service    2021-06-28 09:15:06.000000000 +0200
+++ new-nfs-server.conf    2023-07-03 22:09:54.490884616 +0200
@@ -3,36 +3,31 @@
 DefaultDependencies=no proc-fs-nfsd.mount
+Wants=rpc-statd.service nfs-idmapd.service
+Wants=nfsdcld.service proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service
+After=proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service
 After=nfs-idmapd.service rpc-statd.service
 # GSS services dependencies and ordering
+Wants=auth-rpcgss-module.service rpc-svcgssd.service
 After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
-# start/stop server before/after client
-ExecStartPre=/usr/sbin/exportfs -r
-ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
+ExecStartPre=-/usr/sbin/exportfs -r
 ExecStop=/usr/sbin/rpc.nfsd 0
 ExecStopPost=/usr/sbin/exportfs -au
 ExecStopPost=/usr/sbin/exportfs -f
-ExecReload=/usr/sbin/exportfs -r
+ExecReload=-/usr/sbin/exportfs -r

  • Like
Reactions: gseeley
I'm having the same issue and it prevents vm's from shutting down which ends with a dead lock and thus total crash of the system.
Last edited:
I got it sorted out, I watched the journalctl log and found nfs-server.service was stopping before pve-manager.service.

I made the following edit with:

systemctl edit pve-manager.service

#Add this to the file (be sure to read how this works, you need to add it in the empty space specified.)


Save and exit and then perform a:
systemctl daemon-reload

Reboots are now smooth, all my VMs shutdown before the nfs-server ends.

Good luck!
Yeah, we cannot hedge against all possible configurations users can make, and we certainly do not want to limit power users that understand their systems by restricting access to create NFS servers or the like (which is rather impossible to do for certain any way).

Anyhow, if you add custom services where your VMs then depend on that without telling PVE it won't work, the simplest way to tell PVE that it needs to stop the NFS server unit after the guests is to add an ordering constraint for pve-guests.service

systemctl edit nfs-server.service (or whatever your NFS server unit is named)

Then add

This ensures that the NFS server unit is started before the pve-guests.service, as systemd reversed this on shutdown it will then ensure that it's stopped after pve-guests.service there.

Note that if we would add such a blanket statement in there we might break other use cases, e.g. where network is provided through a VM and NFS should be stopped before that VM is shut down.
Last edited:
  • Like
Reactions: gseeley


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!