Fix "Unable to lock the administration directory ... https://www.tecmint.com/fix-unable-to-lock-the...
1. Find and Kill all apt-get or
apt Processes Run the command below to generate a list of all processes whose name comprises of the word apt, you will get a list inclusive of all apt or apt-get processes by using ps and 1 of 4 3/7/18, 2:22 PM grep commands together with a pipeline. Fix "Unable to lock the administration directory ... https://www.tecmint.com/fix-unable-to-lock-the...
the word apt, you will get a list inclusive of all
apt or apt-get processes by using ps and grep commands together with a pipeline.
$ ps -A | grep apt
Find apt and apt-get Processes
For each apt-get or apt process that you can
see in the output of the command above, kill each process using the command below.
The process ID (PID) is found in the �rst
column from the screenshot above.
$ sudo kill -9 processnumber
OR $ sudo kill -SIGKILL processnumber
For instance, in the command below where
9 is the signal number for the SIGKILL signal, will kill the �rst apt process:
$ sudo kill -9 13431
OR $ sudo kill -SIGKILL 13431
2. Delete the lock Files
A lock �le simply prevents access to another �le(s) or some data on your Linux system, this concept is present in Windows and other operating systems as well.
Once you run an apt-get or apt command, a
lock �le is created under the any of these directories /var/lib/apt/lists/, /var/lib/dpkg/ and /var/cache/apt/archives/.
This helps to avoid the apt-get or apt
process that is already running from being interrupted by either a user or other system processes that would need to work with �les being used by apt-get or apt. When the process has �nished executing, the lock �le 2 of 4 is then deleted. 3/7/18, 2:22 PM
Important: In case a lock is still exiting in the
Fix "Unable to lock the administration directory ... https://www.tecmint.com/fix-unable-to-lock-the...
being used by apt-get or apt. When the
process has �nished executing, the lock �le is then deleted.
Important: In case a lock is still exiting in the
two directories above with no noticeable apt- get or apt process running, this may mean the process was held for one reason or the other, therefore you need to delete the lock �les in order to clear the error.
important methods to deal with a common problem faced by Ubuntu (and its derivatives) users, while running apt-get or apt as well as aptitude commands.
Do you have any other reliable methods to
share meant for deal with this common error? Then get in touch with us via the feedback form below. 3 of 4 3/7/18, 2:22 PM In addition, you may as well want to learn how to �nd and kill running processes and Fix "Unable to lock the administration directory ... https://www.tecmint.com/fix-unable-to-lock-the...
error? Then get in touch with us via the
feedback form below.
In addition, you may as well want to learn
how to �nd and kill running processes and read through a simple guide to kill, pkill and killall commands to terminate a process in Linux.