As we all knows, Kali Linux is one of the best pentesting distribution used by security professionals and hackers too but its so annoying when you see these kind of errors while installing any tool/package with apt-get command.
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?
This error may be caused by the Update Manager trying to automatically refresh the list of packages in background, usually right after your login, thus locking the directory.
So its either your apt-get command is busy in some other installation or your resources are busy somewhere else. This error can be so annoying especially for new Linux (Kali) users who may not know exactly the cause of the error.
There are basically two ways to fix this error:
In first method, you need to find all the processes who are using apt or apt-get process by typing the below command:
Command: ps -A | grep apt
If it shows some kind of apt process, then you should kill that process with the help of kill command:
Command: sudo kill -9 <processnumber>
In second method, you need to remove all the files mentioned in below screenshot.
Command: sudo rm /var/lib/dpkg/lock
Command: sudo rm /var/lib/apt/lists/lock
Command: sudo rm /var/cache/apt/archives/lock
Basically, once you run an apt-get or apt command, a lock file is created under the any of these directories /var/lib/apt/lists/, /var/lib/dpkg/ and /var/cache/apt/archives/ which actually helps you 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 files being used by apt-get or apt.
When the process has finished executing, the lock file is then deleted.
After that you need to reconfigure your package forcefully by typing the following command in your same terminal:
Command: sudo dpkg –configure -a
Now you can install any package in your Kali Linux machine.
But don’t be so fast to remove something, it may totally damage your system; rather wait until the currently installing or uninstalling program finishes its task and after that you will get access. If you think that there is nothing currently installing or uninstalling, then just follow the above steps or reboot your system with the command sudo reboot.
You may also like:- Most Common DNS Record Types and Their Roles
- Top Skills Needed to Become a Cybersecurity Analyst
- Mastering Windows Management with WMIC Commands – Top 20 Examples
- Edit and Compile Code with the Best 5 Code Editors
- 50+ Top DevSecOps Tools You Need To Know
- Learn How to Add Proxy and Multiple Accounts in MoreLogin
- Some Useful PowerShell Cmdlets
- Create Free SSL Certificate – ZEROSSL.COM [2020 Tutorial]
- Generate Self-Signed SSL Certificate with OPENSSL in Kali Linux
- RDP – CredSSP Encryption Oracle Remediation Solution 2020
Thanks it really helped