Cannot Shut Down Container

kirkofthefleet

New Member
Apr 18, 2020
4
23
1
35
I have a container that I cannot get into. It was set up as an internet facing mail server that may have taken a DoS hit. I was only testing things out so I didn't go all the way with my security. I need to remove this container but I am unable to shut it down. When I try through the GUI I get this message:
1588982168768.png
After some googling on this issue, which looks like it happens more often than it should, I found MANY answers that were similar to this issue. The people that were most successful were able to use lxc-destory commands to remove the VMs. When I try lxc-destory <vm_name> it tells me it doesn't exist even though its listed.

The closest I got was using pct commands, but all of those got pretty much the same timeout message I got through GUI.

Here is the CLI output from the commands I tried.

Code:
root@proxmox:~# pct destroy 101
unable to destroy CT 101 - container is running
root@proxmox:~# pct shutdown 101
trying to acquire lock...
can't lock file '/run/lock/lxc/pve-config-101.lock' - got timeout
root@proxmox:~# pct status 101
status: running
root@proxmox:~# pct status suspend
400 Parameter verification failed.
vmid: type check ('integer') failed - got 'suspend'
pct status <vmid> [OPTIONS]
root@proxmox:~# pct suspend 101
trying to acquire lock...
can't lock file '/run/lock/lxc/pve-config-101.lock' - got timeout
root@proxmox:~# pct suspend 101 ?
400 too many arguments
pct suspend <vmid>

I am currently totally at a loss for how to get this VM out. I've been digging around this and other forums since noon, and I've officially given up. I'm sure the answer is there somewhere, but I think I'll need somebody to say "dummy type this".

Thanks for any help!
 
So literally 60 seconds after writing this.....I figured out how to fix it. Here is what I did in CLI:

lxc-list --fancy
this command will list the running containers with their "names" I'm pretty sure this is where I went wrong. I was using the name name instead of the number

lxc-destroy <name>
this errored out because the container was still running

lxc-stop <name>
this command stops the VM you specify

lxc-destroy <name>
since the VM is now stopped, I was able to destroy it.

Here is the actual output for what I did.
1588983015451.png
 
So with that figured out, does anyone have an idea on how to prevent this? I'd hate to have to destroy a container that I actually use just because I can't log into it, or shut it down in GUI.
 
After some googling on this issue, which looks like it happens more often than it should, I found MANY answers that were similar to this issue. The people that were most successful were able to use lxc-destory commands to remove the VMs. When I try lxc-destory <vm_name> it tells me it doesn't exist even though its listed.
While PVE uses lxc for running containers, pct and other wrappers usually make it unnceccessary to run lxc commands directly.

the error message you describe have to do with a lock on the lxc config-file generated by PVE - it's more likely to be related to a hanging/aborted process on your PVE node

-> check the journal of the PVE node for potential issues

I hope this helps!
 
I had containers getting stuck, in particular a Ubuntu container in which I am running software using snap.
The only way to resolve the issue was rebooting the PVE node. Not nice.

I found this solution:

Check the content of /sys/fs/cgroup/freezer/lxc/[container_number]/freezer.state.

If it shows anything but "FREEZING" it hangs, will sometimes not even respond to ping.

echo "THAWED" > /sys/fs/cgroup/freezer/lxc/[container_number]/freezer.state solves the problem for me and the container just works again as before.
 

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!