Technical

Delaying a service on my proxmox with systemd drop-ins

Delaying a service on my proxmox with systemd drop-ins

Delaying a service on my proxmox is easy with a systemd drop-in. If a service starts too early and breaks because something else isn’t ready, don’t hack the unit file. Add an override that sleeps first.

Detailed close-up of computer components including RAM and cables inside a server or high-performance PC.

Why you’d delay a service

Proxmox boots fast. Sometimes a container or VM tries to mount a share before the network is up, or a service needs a disk that hasn’t been scanned yet. The fix is to add a delay to that service’s start.

The drop-in method

Systemd lets you override a unit without touching the original file. Create a directory for the service and drop a conf file in it. For example, to delay pve-guests by 10 seconds:

mkdir -p /etc/systemd/system/pve-guests.service.d
echo -e '[Service]\nExecStartPre=/bin/sleep 10' > /etc/systemd/system/pve-guests.service.d/override.conf
systemctl daemon-reload

That’s it. The service will now wait 10 seconds before it actually starts. You can adjust the sleep time to whatever you need.

Complex network of electrical wiring and control panels in an industrial setting.

Which services need it

Common culprits on Proxmox are pve-guests (starts VMs and containers), pvestatd, and anything that mounts network storage. If a container fails to mount an NFS share at boot, check Proxmox shared storage NFS: add the share and get the options right first. But if the share is fine and it’s just a timing issue, a drop-in delay fixes it.

My take

Sleep loops are a hack, but systemd drop-ins are the clean way to do a hack. They survive package updates, they’re easy to remove, and you don’t have to edit the original unit file. Just don’t go crazy with the delay—if you need more than 30 seconds, something else is wrong.

Leave a comment

Comments are reviewed before they appear. Your email is never published.