question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vagrant driver - lock file lookup error

See original GitHub issue

Issue Type

  • Bug report

Molecule and Ansible details

ansible 2.9.10
  config file = None
  configured module search path = ['/Users/amuhammad/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.6 (default, Oct  8 2020, 14:06:32) [Clang 12.0.0 (clang-1200.0.32.2)]

molecule 3.1.2

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

Desired Behavior

Execution of molecule test to run based on the default scenario for molecule in the ansible role.

Actual Behaviour

The default scenario sequence is as the following in molecule.yml:

---
dependency:
  name: galaxy
driver:
  name: vagrant
  provider:
    name: virtualbox
  options:
    memory: 1024
    cpus: 1
lint: |
    yamllint .
    ansible-lint
    flake8
platforms:
  - name: ${BOX:-ubuntu1804}
    box: "darkwizard242/ansible${BOX:-ubuntu1804}"
provisioner:
  name: ansible
  log: true
scenario:
  name: default
  test_sequence:
    - lint
    - destroy
    - syntax
    - create
    - converge
    - idempotence
    - verify
    - destroy
verifier:
  name: testinfra
  options:
    verbose: true

Right after lint sequence, molecule test tries a destroy in that an instance already exists. However, it has been failing due to the following error:

    PLAYBOOK: destroy.yml **********************************************************
    1 plays in /usr/local/lib/python3.8/site-packages/molecule_vagrant/playbooks/destroy.yml

    PLAY [Destroy] *****************************************************************
    META: ran handlers

    TASK [Destroy molecule instance(s)] ********************************************
    task path: /usr/local/lib/python3.8/site-packages/molecule_vagrant/playbooks/destroy.yml:8
    <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: amuhammad
    <127.0.0.1> EXEC /bin/sh -c 'echo ~amuhammad && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/amuhammad/.ansible/tmp `"&& mkdir /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441 && echo ansible-tmp-1602928552.746901-45666-137287224933441="` echo /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441 `" ) && sleep 0'
    Using module file /usr/local/lib/python3.8/site-packages/molecule_vagrant/modules/vagrant.py
    <127.0.0.1> PUT /Users/amuhammad/.ansible/tmp/ansible-local-45662thzh_ne7/tmp939vjszx TO /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441/AnsiballZ_vagrant.py
    <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441/ /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441/AnsiballZ_vagrant.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/python@3.8/bin/python3.8 /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441/AnsiballZ_vagrant.py && sleep 0'
    <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/amuhammad/.ansible/tmp/ansible-tmp-1602928552.746901-45666-137287224933441/ > /dev/null 2>&1 && sleep 0'
    failed: [localhost] (item=ubuntu1804) => {
        "ansible_loop_var": "item",
        "changed": false,
        "item": {
            "box": "darkwizard242/ansibleubuntu1804",
            "name": "ubuntu1804"
        },
        "module_stderr": "",
        "module_stdout": "Retrying to acquire lock on /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default, waiting for 30 seconds\nRetrying to acquire lock on /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default, waiting for 60 seconds\nRetrying to acquire lock on /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default, waiting for 90 seconds\nRetrying to acquire lock on /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default, waiting for 120 seconds\nTimedout trying to acquire lock on /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default\n",
        "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
        "rc": 3
    }

    PLAY RECAP *********************************************************************
    localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

ERROR:

I am not sure why it is failing to acquire a lock file and I was able to confirm that a .lock file exists in /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default :

$ find /Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default -type f -name *lock*
/Users/amuhammad/.cache/molecule/ansible-role-node_exporter/default/.lock

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
GitBytescommented, Oct 20, 2020

I was able to get it to start VMs in VirtualBox 6.1.12 using Vagrant 2.2.10 but downgraded molecule to 3.0.8 per diff provided in https://github.com/Graylog2/graylog-ansible-role/pull/161

Odd behavioral note, this combo works but creates two VMs, one running the other not running in a kind of orphaned state. Might be a side effect of my Mac environment as well but I have a hard time settling on that thought at this time. Update: Confirmed that the VM is in fact orphaned by molecule and does not perform cleanup on the dead VM that was not used for the molecule run.

0reactions
darkwizard242commented, Dec 5, 2020

@dennycrane0 - What problem is not related to this ticket? The description in the your comment above was a little vague. A little more information would be more beneficial.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Permission Denied error for Vagrant - Stack Overflow
The issue is related with permission which you accidentally run the application with root. Follow the steps:.
Read more >
OSX: Locking in vagrant with Ubuntu guest using NFS doesn't ...
I checked the /etc/expoerts system and made sure it was a clean file with no broken/old leftovers once the VM was shut down....
Read more >
vagrant up fails stating that the vm is not found - Google Groups
I have tried several setup tutorials but seem to get this same error stating that the machine can not be found. I see...
Read more >
How to Solve “Could not open lock file /var/lib/dpkg/lock ...
This error usually occurs when a process is functioning to update the system, and you try to access the system for some other...
Read more >
linux - What does 'no locks available' mean? - Server Fault
The user account that is doing the SVN update may not have update permission on the repository directory · The NFS file system...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found