When you run any apt or apt-get command, a lock file is usually created. The lock file blocks two or multiple processes from accessing the same data. In some situations, the root cause could be the lock file. If they have all cleared, you can proceed to update the system without a problem. Once done, verify again if the processes have ended using the ps command. Execute the kill -9 command followed by the process ID as follows. You can do so by sending a SIGKILL command to shut down the process immediately. To clear the error, you need to kill the processes that are associated with the apt command. To do so, use the ps command as shown: $ ps aux | grep - i apt The first step in diagnosing this problem is listing the processes that are using the apt package manager. Solution 1) Killing all processes which are using the APT manager A couple of options are available to fix this issue. There’s absolutely no need to panic in case you run into this error. A second attempt to use apt or apt-get command will yield the error. It can also occur when you prematurely cancel an update/upgrade that is in progress, accidentally or otherwise. Such happens when you have 2 or more terminals running a system update or upgrade. If the error still persists then you need to remove the lock files created under the /var/lib/dpkg/ directory.As the error suggests, this error usually happens when another process is currently using the /var/lib/dpkg/lock or /var/lib/dpkg/lock file. Sudo kill -SIGKILL 3499 Clear the Lock Files Now, if we want to kill it to unlock the apt, we use the command in this form: sudo kill -9 3499 sudo kill -9 processIDįor example, in step 3 of this tutorial, the two process uses the apt is 3499. Step 4: Replace the ProcessID with the ID you noted in the previous step that has locked and uses the apt. Just write down all the process IDs of processes using the apt (red in color) command. You will see a process ID (PID) of each process in the first column. Now find the process those showing the apt in red color as shown in the above screenshot. This command will show all the active processes and those using apt. To find out all apt-get or apt processes use the following command: ps aux | grep apt Step 3: The errors shown above are because there would some process running in the background that has locked the apt and we need to find out which process using it. Step 2: Switch to root using the command suĪnd enter the password for the root user. Step 1: First of all you should have root access to your Ubuntu Linux to unlock the locked apt-get. Here are some other error examples you might be faced: E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)Į: Unable to lock directory /var/lib/apt/lists/Į: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)Į: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? This tutorial is applicable for all Ubuntu versions such as Ubuntu 20.04, 19.04, 18.04, 16.04… including Linux Mint, Debian, and other similar OS. Clear the Lock Files Unlock the administration directory (/var/lib/dpkg/) in Ubuntu
0 Comments
Leave a Reply. |