Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
The lock file /var/lib/dpkg/lock-frontend still exists between apt-update and apt-install
I am creating a droplet (nyc1/4vcpu-8gb/ubuntu-20-04-x64) with doctl and, when accessible (ping on ip address followed by nc on ssh port) I send and run the following bash script:
#!/bin/bash apt-get update apt-get install -y apt-transport-https \ curl \ tmux \ zsh \ zip \ inotify-tools
But for some reason there is some kind of race condition between the apt-update and apt-install because the lock file (/var/lib/dpkg/lock-frontend) seems not to be released, like the following snippet:
Get:29 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [2,568 B] Get:30 http://archive.ubuntu.com/ubuntu focal-backports/main Translation-en [1,120 B] Get:31 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [400 B] Get:32 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [5,800 B] Get:33 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [2,068 B] Get:34 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [288 B] Fetched 5,354 kB in 2s (2,995 kB/s) Reading package lists... Done E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 2194 (apt-get) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
Am I doing something wrong or maybe is it a bug?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×