Natural selection is testing this #Altcoins season 🌊. In this cycle, many are once again diving deep into research, searching for “the best” after Bitcoin & @Joseinnewworld makes waves 124 #NFTs — Wow, a strong signal for those still weighing their moves. #eCash $XEC #CryptoNews pic.twitter.com/GB3dRvH01U
— NFToa (@nftoa_) September 26, 2025
Recently, I tried installing an application using the apt command in Ubuntu and encountered the following 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?
You might also encounter similar errors like these:
E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
In some cases, you may encounter this issue when using the Software Center:
This error is similar to another common Ubuntu error: Unable to lock directory /var/cache/apt/archives/. Interestingly, the solution is quite similar as well.
Cause of the Error
This error occurs because another program is trying to update Ubuntu. When a command or application updates the system or installs new software, it locks the dpkg (Debian package manager) files to prevent multiple processes from making changes simultaneously, which could lead to corruption.
Let’s explore the steps to resolve the "unable to lock the administration directory" issue.
Method 1: Check for Running Updates or Installations
First, check if any other program is running a system update or installing software. If you are using the command line, ensure that applications like Software Center, Software Updater, Synaptic Package Manager, or Gdebi are not running updates/installations. If they are, wait until they finish.
Also, check any open terminal windows for running updates or installations. If found, wait for them to complete.
To check if any other process is using apt, run:
ps aux | grep -i apt
Example output:
abhishek@nuc:~$ ps aux | grep -i apt
root 1464 0.0 0.0 4624 772 ? Ss 19:08 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily update
root 1484 0.0 0.0 4624 1676 ? S 19:08 0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held update
_apt 2836 0.8 0.1 96912 9432 ? S 19:09 0:03 /usr/lib/apt/methods/http
abhishek 6172 0.0 0.0 21532 1152 pts/1 S+ 19:16 0:00 grep --color=auto -i apt
If you see a process like apt.systemd.daily update, it indicates that automatic updates are running. Wait for it to finish before proceeding.
For Ubuntu servers, check if unattended upgrades are enabled:
cat /etc/apt/apt.conf.d/20auto-upgrades
If apt.systemd.daily is running, wait for it to complete. Alternatively, you can disable automatic updates, though it’s not recommended for security reasons.
Method 2: Kill the Apt Process Manually
If apt is still running, stop it manually. Use the following command:
ps aux | grep -i apt
Identify the process ID (PID) from the output and terminate it:
sudo kill <process_id>
To force-stop if the process persists, use:
sudo kill -9 <process_id>
Alternatively, kill all running apt processes with:
sudo killall apt apt-get
Method 3: Delete Lock Files
If no processes are running but the error persists, delete the lock files.
- Check for processes holding lock files:
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock
- If you find any process IDs, terminate them:
sudo kill -9 <process_id>
- Safely delete the lock files:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
- Reconfigure the package manager:
sudo dpkg --configure -a
Now, run the update command again:
sudo apt update
Dealing with Dpkg Frontend Lock
If you encounter the following error:
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?
Check the process holding the lock-frontend:
sudo lsof /var/lib/dpkg/lock-frontend
If it’s unattended-upgrades, wait for it to finish. Otherwise, kill the process using its PID:
sudo kill -9 <process_id>
sudo rm /var/lib/dpkg/lock-frontend
Finally, update the system:
sudo apt update
This should resolve the issue.
