Could not get lock /var/lib/apt/lists/lock – open (Resource temporarily unavailable)

Recently I was trying to install an application using the apt command on Ubuntu when I encountered the following error: 

  • 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?

In fact, there is a similar error you may see:

  • E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
  • E: Unable to lock directory /var/lib/apt/lists/
  • 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?
These errors are very similar to another common Ubuntu error, Unable to lock directory /var/cache/apt/archives/, and the interesting thing is that the fixes are similar as well.

Fixing “Unable to lock the administration directory (/var/lib/dpkg/)” error

You see this error because some other program is trying to update Ubuntu. When a command or application is updating the system or installing a new software, it locks the dpkg file (Debian package manager). 

This locking is done so that two processes don’t change the content at the same time as it may lead to unwarranted situation and a possible broken system. 

Let’s see what steps can you take to fix this issue of ‘unable to lock administration directory’.

You can now safely remove the lock files using the commands below:  

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

After that, reconfigure the packages:

sudo dpkg --configure -a

Now if you run the sudo apt update command, everything should be fine.

Troubleshooting 1: “Unable to acquire the dpkg frontend lock”
 If you see an error like this:

  • E: Could not get lock /var/lib/dpkg/lock-frontend – open (11: Resource temporarily unavailable) 
  • E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
If the COMMAND is something else, you may kill the process and then remove the lock file. You can see the process id under the PID column. Use this PID to kill the process. After that, remove the lock file and run the update command to see if it’s been fixed.
sudo kill -9 PID
sudo rm /var/lib/dpkg/lock-frontend
sudo apt update

Troubleshooting 2: “dpkg: error: dpkg frontend is locked by another process” 

If you see the error “dpkg frontend is locked by another process” while running the steps in method 2, you need to one additional step. 

First, find out the id of the process that is holding the lock file.

sudo lsof /var/lib/dpkg/lock-frontend

The above command will give you the details of the processes using the lock files. Use the process ID to kill this program:

sudo kill -15 PID

Now you can remove the lock and reconfigure dpkg:

sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a
Did it work for you? Which method fixed it for you? Let us know in the comment….
– Originally posted by itsfoss
Abdullah Al Naiem

Abdullah Al Naiem

Web application developer. Loves IT, Programming, and being connected with tech.

Share this article

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on skype
Skype
Share on telegram
Telegram
Share on reddit
Reddit
Share on whatsapp
WhatsApp
Share on email
Email
Share on print
Print

Tags

Author Info

Abdullah Al Naiem

Abdullah Al Naiem

Web application developer. Loves IT, Programming, and being connected with tech.

Popular Articles

© 2021 || All rights reserved by NAIEM.INFO

Could not get lock /var/lib/apt/lists/lock – open (Resource temporarily unavailable)

Why Direct Contracts?

How it works

Direct Contracts allow you to work with freelancers on Upwork when you don’t have an Upwork account.

With escrow service, your funds are protected and won’t be released until the work has been completed. This gives your freelancer assurance that the project funds are available, and they can be certain of your payment upon the successful completion of the job. You also have the ability to cancel the contract at any point before you approve the release of funds. If you cancel, the funds are returned to your original payment method within seven business days.

All Direct Contracts will be managed by email. We’ll provide you with simple, easy-to-follow instructions every step of the way. We’ll also send you invoices with all the relevant contract details, including the contract name, description, price, your company name, and the freelancer’s name.

Freelancers with Upwork accounts can create and send both hourly and fixed-price contract proposals to their clients that aren’t registered on Upwork.

Review and accept a Direct Contract

Once a freelancer has sent you a Direct Contract offer, you’ll receive an email from Upwork detailing the freelancer’s proposal. You will receive all the key information, including the contract amount, title, and description. You will have the option to either “Accept and Fund Contract” or “Decline.”

Fund a Direct Contract

After you have agreed to the terms of the contract, you’ll be asked to deposit the funds for the contract in escrow via a credit card or PayPal. For an hourly contract, you’ll be asked for a one-time deposit for the equivalent of one week’s worth of contracted work, plus a small payment processing fee, if applicable.

Once you have deposited funds, the contract starts and your freelancer can begin the project. All transactions will take place in USD.

If you have a fixed-price contract, your freelancer may choose to add milestones to divide the job into a series of phases, due dates, or deliverables based on your needs. Milestones are individually funded, and provide a way to work through a large project in smaller steps.

If your contract has milestones, you will only need to fund one milestone at a time. For example, if the contract has five milestones at $100 for each milestone, the contract total is $500. However, you’ll only need to fund Milestone 1 with $100 (plus any payment processing fees) to get started. Once that milestone is complete, you can choose to fund and activate the next one. 

Fixed-price Contracts

Once the freelancer has completed and submitted work for the project, they will send you a request for payment. You’ll receive an email notification with the option to “Accept” or “Decline” the request.

If you accept the request, the funds are immediately released to the freelancer and the contract is closed.

If you reject the request, the funds remain in escrow and the contract is kept open, the freelancer can then make any necessary changes to the work and resubmit their payment request.

Hourly Contracts

Once the freelancer has logged hours, you will have the opportunity to review them. You’ll see what was logged in the previous week, and what is being logged in the current week. The hours will be charged automatically unless you take action.

If a freelancer logs extra hours outside of the limit on your contract, you’ll be able to approve or decline them. If you do not approve the extra hours, they will not be charged.

Note: When your freelancer submits a payment request you have 14 days to review. If you do not take action, that is considered approval and funds will be automatically released to the freelancer.

Direct Contract rights reserved by Upwork Global Inc.