Could Not Get Lock /var/lib/dpkg/lock

Fixing the common Ubuntu error: Could not get lock /var/lib/dpkg/lock

1.Installing a program in the terminal with sudo apt-get install xxx produces this 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 2.Another program may be running and holding the lock. The lock may also remain because a previous installation or update did not complete normally. The solution described here is simple:
    • sudo rm /var/cache/apt/archives/lock
    • sudo rm /var/lib/dpkg/lock
Stay updated

Get weekly research updates, market signals, and listing intelligence — follow along on Telegram or X.