Why does vzstart keep trying to start a CT while it's being backed up?

claytonbcollins

New Member
Nov 12, 2024
6
0
1
I've searched and searched, as well as gone round and round with AI's trying to troubleshoot the issue. No avail... Maybe I'm just not describing it correctly to get to the answers? I have multiple CT's setup in my Proxmox, one of which is Nextcloud, which obviously takes a while. I have the Mode set to Stop, for the safest data integrity. In the interim, vzstart keeps trying to start the CT every ~6 minutes. Thus, I end up w/ red-colored errored-out tasks at the bottom of my Proxmox dashboard. After the CT is finished backing up, the CT starts back up. How can I keep vzstart from trying to start it during the backup?
BTW, the error I'm getting is
Code:
TASK ERROR: CT is locked (backup)
 
YES! Thank you! I have added a script that checks that if a backup is underway, it will wait until it's complete, checking every 5 min:
Code:
bash
#!/bin/bash

#Name of file: vzstart-delay.sh

# Stop the ping-instances service to prevent it from running during backup
systemctl stop ping-instances

while true; do
        # Check if a backup is running
        if ! proxmox-backup-client status | grep -q "running"; then
                #If no backup running, exit the loop
                break
        else
                #Check if ping-instances is running
                if systemctl status ping-instances | grep -q "running"; then
                        # Stop the ping-instances service to prevent it from running during backup
                        systemctl stop ping-instances
                fi

                #Wait 300 seconds before checking again
                sleep 300

        fi
done

# Once the backup is complete, reload the systemd daemon and start the ping-instances service
if ! systemctl status ping-instances | grep -q "running"; then
        systemctl daemon-reload
        systemctl start ping-instances
fi

It gets called at the beginning of ping-instances.sh:
Code:
#######################
# Check if a backup is running and delay the script if necessary
# Log the start of the script
echo "Starting ping-instances.sh script" >> /var/log/ping-instances.log

# Run the vzstart-delay.sh script and log the event
echo "Running vzstart-delay.sh script to wait for backup completion and start v>
/usr/local/bin/vzstart-delay.sh
#Clay added this script with assistance from Meta AI (2024-12-26)
########################

Although I got assistance from Meta, it was more like I had to teach it LOL
But I'm sure I probably missed something in cleaning up the suggestions it made. Let me know if I need to make any edits.
 
Last edited:
YES! Thank you! I have added a script that checks that if a backup is underway, it will wait until it's complete, checking every 5 min:
Code:
bash
#!/bin/bash

#Name of file: vzstart-delay.sh

# Stop the ping-instances service to prevent it from running during backup
systemctl stop ping-instances

while true; do
        # Check if a backup is running
        if ! proxmox-backup-client status | grep -q "running"; then
                #If no backup running, exit the loop
                break
        else
                #Check if ping-instances is running
                if systemctl status ping-instances | grep -q "running"; then
                        # Stop the ping-instances service to prevent it from running during backup
                        systemctl stop ping-instances
                fi

                #Wait 300 seconds before checking again
                sleep 300

        fi
done

# Once the backup is complete, reload the systemd daemon and start the ping-instances service
if ! systemctl status ping-instances | grep -q "running"; then
        systemctl daemon-reload
        systemctl start ping-instances
fi

It gets called at the beginning of ping-instances.sh:
Code:
#######################
# Check if a backup is running and delay the script if necessary
# Log the start of the script
echo "Starting ping-instances.sh script" >> /var/log/ping-instances.log

# Run the vzstart-delay.sh script and log the event
echo "Running vzstart-delay.sh script to wait for backup completion and start v>
/usr/local/bin/vzstart-delay.sh
#Clay added this script with assistance from Meta AI (2024-12-26)
########################

Although I got assistance from Meta, it was more like I had to teach it LOL
But I'm sure I probably missed something in cleaning up the suggestions it made. Let me know if I need to make any edits.


Well, this still didn't work. Not sure what to do to get it to stop trying to start a CT/VM while it's being backed up. Any thoughts??
 
  • Like
Reactions: Johannes S
leesteken has given you excellent advice.

But if I may, would just like to enquire:

When you manually enter (CLI) systemctl stop ping-instances & then do the above backup, does that vzstart still try starting the VM?

During a backup when you manually enter (CLI) proxmox-backup-client status what is the result? (Can you see which VM it is backing up then? I don't use PBC).

Concerning the script, I only skimmed through it, but 2 things come to mind. Firstly during a backup, it is going to shutdown the whole ping-instances service, so even other VMs & LXCs (not being backed up then) will not be monitored. (Probably an alternate idea, would be to edit the service to exclude that VM that is being backed up). Secondly your script will only work for backups being carried out by the PBC.

systemctl daemon-reload
Line does not look necessary - you've made no changes to the service.
 

About

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!