Thursday, August 25, 2016

Failed to remove or destroy openvz container in Proxmox

Something went wrong when I was creating and removing containers on Proxmox 3.x

Somehow I can not remove one of my OpenVZ container from Proxmox UI, I got this error

stat(/var/lib/vz/root/285): No such file or directory
Container is currently mounted (umount first)
TASK ERROR: command 'vzctl destroy 285' failed: exit code 41


I searched all over Google and did not find a solution. I fix the issue and found the following commands executed in the hardware node will solve this problem:

The VM ID that I am trying to remove is 285
The RED color commands are the commands that you need to solve this Fail to Destroy OpenVZ container issue.

I tried to destroy the VM from CLI but received the following error:
root@a11:~# vzctl destroy 285
stat(/var/lib/vz/root/285): No such file or directory
Container is currently mounted (umount first)

Then I tried to unmount it and still received error:
root@a11:~# vzctl umount 285
stat(/var/lib/vz/root/285): No such file or directory
realpath(/var/lib/vz/root/285) failed: No such file or directory
Can't umount /var/lib/vz/root/285: No such file or directory

So I created an empty directory to satisfy it
root@a11:~# mkdir /var/lib/vz/root/285
root@a11:~# vzctl umount 285
stat(/var/lib/vz/private/285): No such file or directory
Can't umount /var/lib/vz/root/285: Invalid argument

Still complaining about missing one more directory, so I created that one too
root@a11:~# mkdir /var/lib/vz/private/285
root@a11:~# vzctl umount 285
CT is not mounted

Finally able to unmount it, so I executed the destroy VM command next
root@a11:~# vzctl destroy 285
Destroying container private area: /var/lib/vz/private/285
Container private area was destroyed

Awesome! it works! I hope this helps someone :-)

No comments:

Post a Comment