Intro
One of the nodes in my lab runs pfSense and if the vm is down, my network is down. This prevents my nodes from reaching quorum, and thus preventing pfSense from starting. To solve this, I needed a way for the vm to start without quorum. This was achieved by creating a oneshot service that runs at system startup.
Create the script
Create a script in a folder of your choice, like /root/startpfSense.sh
.
Place the following inside it, replacing the vmID for the id of the vm you want to start:
#!/bin/bash
sleep 5
systemctl stop pve-cluster
pmxcfs -l
qm start $vmID
sleep 5
killall pmxcfs
systemctl start pve-cluster
After this, make sure to give it the proper permissions to make it executable.
Create the service file
Now, create a service file like /etc/systemd/system/startpfSense.service
and using a text editor add the following:
[Unit]
Description=Start pfSense without quorum
After=pve-cluster.service
[Service]
type=oneshot
ExecStart=/root/startpfSense.sh
[Install]
WantedBy=multi-user.target
Enabling the service
To enable the service, you would do systemctl daemon-reload
and later systemctl enable startpfSense.service
. To check the status of the service, you would run systemctl status startpfSense
.
Done!
Now, your vm will be started on your next reboot.