oracle-java icon indicating copy to clipboard operation
oracle-java copied to clipboard

Could not get lock /var/lib/dpkg/lock

Open mauriziod opened this issue 5 years ago • 2 comments

Seems like following step or the one before is leaving the dpkg lock file behind.

amazon-ebs: TASK [ansiblebit.oracle-java : debian | ensure the apt repository key is present] ***
    amazon-ebs: changed: [127.0.0.1]
    amazon-ebs:
    amazon-ebs: TASK [ansiblebit.oracle-java : debian | ensure the apt repository is present] ***
    amazon-ebs: changed: [127.0.0.1]
    amazon-ebs:
    amazon-ebs: TASK [ansiblebit.oracle-java : debian | set license as accepted] ***************
    amazon-ebs: changed: [127.0.0.1]
    amazon-ebs:
    amazon-ebs: TASK [ansiblebit.oracle-java : debian | ensure Java is installed] **************
    amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"cache_update_time": 1556186475, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"     install 'oracle-java11-installer'' failed: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)\nE: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?\n", "rc": 100, "stderr": "E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)\nE: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?\n", "stderr_lines": ["E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)", "E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?"], "stdout": "", "stdout_lines": []}[0m
    amazon-ebs: 	to retry, use: --limit @/tmp/packer-provisioner-ansible-local/5cc18532-7700-4008-eea8-f90ee8a93274/microservice-scala.retry
    amazon-ebs:
    amazon-ebs: PLAY RECAP *********************************************************************
    amazon-ebs: 127.0.0.1                  : ok=29   changed=20   unreachable=0    failed=1   [0m
    amazon-ebs:

mauriziod avatar Apr 25 '19 10:04 mauriziod

Obviously not the most elegant solution but ensuring the dpkg/lock fileis removed before the debian | ensure Java is installed worked.

amazon-ebs: TASK [oracle-java : debian | set license as accepted] **************************
    amazon-ebs: changed: [127.0.0.1]
    amazon-ebs:
    amazon-ebs: TASK [oracle-java : debian | remove apt-get lock] ******************************
    amazon-ebs: changed: [127.0.0.1]
    amazon-ebs:
    amazon-ebs: TASK [oracle-java : debian | ensure Java is installed] *************************
    amazon-ebs: changed: [127.0.0.1]
    amazon-ebs:

Definitely the step causing the troubles is:

debian | set license as accepted

mauriziod avatar Apr 29 '19 09:04 mauriziod

@mauriziod this seems to indicate that you had another process running apt-get update or apt-get install.

during my tests I haven't found this problem yet.

steenzout avatar May 20 '19 03:05 steenzout