0

I'm typing sudo apt upgrade

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?

What is the problem?

Pablo Bianchi
  • 15,657
parodi
  • 1

3 Answers3

0

More than likely your device is already running updates. There should be a window either minimized or behind another window that is the standard updater waiting for input.

Robby1212
  • 880
0
  1. Are your running another package manager? This includes Ubuntu Software, Synaptic, Terminal windows running apt/aptitude/dpkg, and others. It does NOT include Snapd, Pip, Flatpack, or Appimage managers since none of those use debs. You can only run one deb package manager at a time. Close the ones you are not using.

  2. It's possible that Unattended Upgrades is running. Here's how to check:

$ ls -la /var/lib/apt/periodic/

total 8
drwxr-xr-x 2 root root 4096 Sep 15  2017 .
drwxr-xr-x 5 root root 4096 Apr  2 19:08 ..
-rw-r--r-- 1 root root    0 Apr  2 19:06 download-upgradeable-stamp
-rw-r--r-- 1 root root    0 Apr  2 19:08 unattended-upgrades-stamp
-rw-r--r-- 1 root root    0 Apr  2 19:05 update-stamp
-rw-r--r-- 1 root root    0 Apr  2 19:05 update-success-stamp
-rw-r--r-- 1 root root    0 Apr  2 19:08 upgrade-stamp

Here you can see the entire process that Unattended Upgrades uses: update, update-success, download-upgradeable, upgrade, unattended-upgrades.

Look for that sequence of stamps, all within a few minutes of each other. If some stams are from a few minutes ago but others are from yesterday, then you know that UU is probably still running. Avoid interrupting it when possible - cleanup after an unclean shutdown can be tedious.

  1. After you have closed all open package managers, and you have confirmed that Unattended Upgrades seems to not be running, time to check for running processes:
$ ps -e | grep apt
   (no output)

$ ps -e | grep dpkg
   (no output)

$ ps -e | grep aptdaemon
   (no output)

If there IS output, then you have found the package management application that is running. When possible, let it finish. If you get a stuck process (very rare), kill the process and manually release the lockfile. DO NOT poweroff your computer or hold down the power button -- doing those may damage your system.

user535733
  • 62,253
  • ı did and again wrote sudo apt update – parodi Apr 03 '20 at 02:27
  • and Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Could not resolve 'security.ubuntu.com' Err:2 http://tr.archive.ubuntu.com/ubuntu bionic InRelease Could not resolve 'tr.archive.ubuntu.com' Err:3 http://tr.archive.ubuntu.com/ubuntu bionic-updates InRelease Could not resolve 'tr.archive.ubuntu.com' Err:4 http://tr.archive.ubuntu.com/ubuntu bionic-backports InRelease Could not resolve 'tr.archive.ubuntu.com' – parodi Apr 03 '20 at 02:28
  • W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not resolve 'tr.archive.ubuntu.com' W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Could not resolve 'tr.archive.ubuntu.com W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Could not resolve 'tr.archive.ubuntu.com W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Could not resolve 'security.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead. – parodi Apr 03 '20 at 02:28
  • Failure-to-resolve is a completely different problem, unrelated to your previous issue of the lockfile. Use the Search box at the top of the page - somebody asks about failure-to-resolve several times each week, and the answers are almost always the same. – user535733 Apr 03 '20 at 02:43
  • okey thank you :) – parodi Apr 03 '20 at 02:44
0

This error shows that you are using the apt from another terminal or used by the other process.

There are two ways to solve the problem.

  1. Reboot your PC and try the following command.

    sudo apt update
    
  2. Kill the process and try to update

    sudo ps -aux | grep apt
    kill -9 <Enter_the_proccess_id>
    kill -9 <Enter_the_proccess_id>
    sudo apt update
    
Pablo Bianchi
  • 15,657