TASK ERROR: can't lock file '/run/lock/lxc/pve-config-100.lock' - got timeout

rubiotelmo0

New Member
Aug 18, 2024
2
0
1
Hi!

I've been facing the above mentioned error (check the tread title) for the past few days and I've got no solution yet.

The error appears every single time I create & start a new LXC using OpenTofu and Ansible from a remote machine (using Debian through WSL). Actually OpenTofu doesn't detect this error since the log containing the "TASK ERROR" appears on the Proxmox VE Tasks log (check the added image). Additionally, once the container is created using OpenTofu and it's started manually (through the Proxmox VE web UI) the problem disappears.

1723980119670.png

I don't now were the problem is, some suggest it might be related to the hardware I have proxmox installed in. I've also checked the used code several times but I didn't find any errors (This can be provided if necesary).

Thanks in advance!
 
Seems like a timing issue, can you add a 30 second delay before starting the container? Not sure what your playbook is set to but assuming you have something like:

command: pvesh to create
<try adding a pause: seconds:30 and see if that helps>
command: pvesh to start
 
Hi sva!

Thank you very much for your response. This is how I create the LXC (I use Telmate's Proxmox provider's last version, 3.0.1-rc3). I tryed adding a local another "local-exec" before the "start=true" line but nothing changed.

Code:
resource "proxmox_lxc" "ct" {

  depends_on = [
    null_resource.pm_ct_template
  ]

  target_node  = var.pm_node
  ostemplate   = var.pm_ct_ostemplate
  cores        = var.pm_ct_cores
  memory       = var.pm_ct_memory_mb
  hostname     = "${var.pm_ct_hostname}"
  password     = var.pm_ct_password
  unprivileged = true
  start        = true

  ssh_public_keys = file("${path.module}/../..***/${var.pm_ct_hostname}.pub")

  rootfs {
    storage = "local-lvm"
    size    = var.pm_ct_rootfs_size_gb
  }

  network {
    name    = var.pm_ct_network_name
    bridge  = var.pm_ct_network_bridge
    ip     = "${var.pm_ct_ip}/${var.pm_ct_network_mask}"
    gw      = var.pm_ct_network_gw
  }

  features {
    nesting = true
  }

  provisioner "local-exec" {
    command = "ANSIBLE_CONFIG=../../ansible/ansible.cfg ansible-playbook -e 'ansible_ssh_private_key_file=../../***/${var.pm_ct_hostname}' -i ${var.pm_ct_ip}, ../../ansible/docker_install.yaml"
  }
}

I could first create the container ("start=false") and then use an ansible playbook to start it. However, this isn't a real solution since the "proxmox_lxc" resource should be able to correctly start the container itself.

Thanks again!
 
Last edited:
Interesting! Thanks for providing that feedback!

I am mobile started taking a look at Telmate as I know it’s Terraform related but not too familiar. I see the following known limitation on their Github (https://github.com/Telmate/terraform-provider-proxmox)


  • Updates to proxmox_vm_qemu resources almost always result as a failed task within the Proxmox UI. This appears to be harmless and the desired configuration changes do get applied.
  • When using the proxmox_lxc resource, the provider will crash unless rootfs is defined

Seems like you’ve accounted for the second point by defining rootfs, but I wonder if the issue you’re seeing is some side effect of the top bullet.

Perhaps you can enable more verbose logging for Terraform itself and see if you get any more pointers? I personally don’t see any glaring red flags in the config you posted.


I also found this post which may lead you down the right rabbit hole. This sounds like a VM-related issue but very similar to what you’re experiencing. At the end there is a user who complained about the exact same thing two weeks ago without any response yet.

https://github.com/Telmate/terraform-provider-proxmox/issues/173
 

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!