Could not get Lock/var/lib/dpkg/lock-open workaround

Source: Internet
Author: User
unable to get lock/var/lib/dpkg/lock e:could not get Lock/var/lib/dpkg/lock-open (one Resource temporarily unavailable)

An output error similar to the following occurs when you perform the command of sudo apt-get XXX:

E:could not get Lock/var/lib/dpkg/lock-open (one Resource temporarily unavailable)
e:unable to lock the Administra tion directory (/var/lib/dpkg/) is another process using it?

Or:

E:could not GE Lock/var/lib/apt/lists/lock-open (11:resource temporarily
unavailable)
e:unable to lock Direc  tory/var/lib/apt/lists/ 
e:could not get Lock/var/lib/dpkg/lock-open (11:resource temporarily unavailable) 
E: Unable to lock-administration directory (/var/lib/dpkg/), is another process using it?
explain

This problem occurs because there is another thread that is using apt-get for downloading. But strangely enough, I just didn't find any other terminal interface using the apt-get directive. So how to solve this problem, do you want to restart the computer, restart the computer can solve the problem, but the next way I teach you is the real solution. Solutions

Search for all running threads first

ps-a | grep apt-get

You will get output similar to the following:

Root        752  0.0  0.0   4508  1628?        Ss   01:13   0:00/bin/sh/usr/lib/apt/apt.systemd.daily
_apt       2098  0.1  0.1  49572  5524?        S    01:18   0:06/usr/lib/apt/methods/http
aobo       4425  0.0   0.0 18484 980 PTS/1    s+   02:13   0:00 grep--color=auto Apt

The 2nd column is the thread number (kill Processnumber). We have closed the process of apt , and need to use sudo permissions:

# sudo kill processnumber
sudo kill 2098

Output:

Bash:kill: (2098)-Operation not permitted

Now close the current terminal , and then reopen a terminal, sudo apt-get command can be used.

Reference website:
Http://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process
Http://askubuntu.com/questions/452638/how-can-i-solve-unable-to-lock-the-administration-directory-var-lib-dpkg

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.