How to fix E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) in APT

APTBEGINNERMEDIUMUpdated Dec 29, 2025· 235 views

This error occurs when another apt or package manager process is holding the lock on the package lists directory. The solution is to wait for the background process to complete, or identify and safely stop any blocking processes before running apt commands.

Quick fix

Fixes E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)

# Check what process is holding the lock
sudo lsof /var/lib/apt/lists/lock
  1. Wait for background package processes to finish
  2. Identify which process is holding the lock
  3. Force-terminate stuck processes
  4. Remove stale lock files
apt — error
# Check what process is holding the lock
sudo lsof /var/lib/apt/lists/lock
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)

What this error means

The apt package manager uses lock files to prevent multiple processes from modifying the package lists simultaneously. The lock file at /var/lib/apt/lists/lock is a safety mechanism that ensures package operations remain consistent. When you see "Resource temporarily unavailable" (errno 11), it means apt tried to acquire the lock but another process already has it. This commonly happens when Ubuntu's automated update system (unattended-upgrades) is running in the background, or when the Software Center or another package manager is actively downloading and updating the package cache.

Typical symptoms

  • apt or apt-get update commands fail with lock error
  • Cannot install packages while background updates are running
  • Error appears even with sudo when system updates are in progress
  • Software Center or update manager is open or running
  • Getting lock errors immediately after system startup
  • Multiple "Resource temporarily unavailable" errors

Common causes

  1. Unattended-upgrades or automated security updates running in background (most common)
  2. Another apt or package manager process actively updating package lists
  3. Software Center or GNOME Software Center downloading package metadata
  4. A previous apt operation crashed and left a stale lock file
  5. Multiple terminals or scripts trying to run apt simultaneously
  6. System update daemon (apt.systemd-daily) checking for updates

How to fix "E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)"

1Wait for background package processes to finish

The simplest and safest solution is to wait for any running package manager to complete. Close any GUI package managers (Software Center, Update Manager) and wait a few minutes:

bash
# Check what process is holding the lock
sudo lsof /var/lib/apt/lists/lock

If you see "unattended-upgrade" in the output, your system is installing security updates. Let this complete before running apt. You can monitor its progress:

bash
sudo systemctl status apt-daily-upgrade.service

Wait until the service shows "inactive" status.

2Identify which process is holding the lock

Use lsof to see which process holds the lock file:

bash
sudo lsof /var/lib/apt/lists/lock

You may also check other related lock files:

bash
sudo lsof /var/lib/dpkg/lock-frontend
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/cache/apt/archives/lock

The output will show the process name and PID. Common processes include:
- unattended-upgrade: Automatic security updates
- apt-get: Another apt operation
- apt: Direct apt command
- update-manager: Software update dialog

3Force-terminate stuck processes

If a process is genuinely stuck (not just slow), you can forcefully terminate it. This is safer than removing lock files:

bash
# Find the process ID from the lsof output above
sudo kill -9 <PID>

Or use fuser to terminate all processes holding the lock:

bash
sudo fuser -vik -TERM /var/lib/apt/lists/lock

After killing the process, repair the package database:

bash
sudo dpkg --configure -a
sudo apt update
4Remove stale lock files

If no process is using the lock (lsof shows no output), the lock file may be stale. Remove it:

bash
sudo rm /var/lib/apt/lists/lock
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
sudo rm /var/cache/apt/archives/lock

Then update your package lists:

bash
sudo apt update
5Fix permissions on apt directories

Verify that apt directories have correct ownership and permissions:

bash
sudo chown -R root:root /var/lib/apt/
sudo chmod 755 /var/lib/apt/lists
sudo chmod 755 /var/cache/apt/archives
sudo apt update

These commands ensure the apt directories are owned by root with proper permissions.

6Disable automatic updates if problems persist

If automated updates keep interfering with your work, you can disable them by editing the update configuration:

bash
sudo nano /etc/apt/apt.conf.d/20auto-upgrades

Comment out (add // to the beginning) these lines:

bash
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

Save with Ctrl+X, then Y, then Enter. This disables automatic background updates, allowing you to run apt manually when you choose.

Advanced notes

The /var/lib/apt/lists/lock file is separate from the dpkg lock files. It specifically protects the package list cache (in /var/lib/apt/lists/) which contains metadata about all available packages. The unattended-upgrades daemon is a systemd service that runs scheduled checks and installs security patches automatically. It uses the apt package manager in the background, which is why you see lock conflicts. On systemd-based systems (Ubuntu 15.04+), you can check the status of all apt-related services with: sudo systemctl list-units | grep apt. For containerized or minimal systems without systemd, the automatic update mechanism may be different. In rare cases where the filesystem is read-only or quotas prevent lock file creation, you might see this error even when no process holds the lock—in those cases, check disk space with df -h and inode usage with df -i.

Frequently asked questions

What does "E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem" mean?
The apt package manager uses lock files to prevent multiple processes from modifying the package lists simultaneously. The lock file at /var/lib/apt/lists/lock is a safety mechanism that ensures package operations remain consistent. When you see "Resource temporarily unavailable" (errno 11), it means apt tried to acquire the lock but another process already has it.
How do I fix "E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem"?
This error occurs when another apt or package manager process is holding the lock on the package lists directory. The solution is to wait for the background process to complete, or identify and safely stop any blocking processes before running apt commands.
What causes "E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem"?
Unattended-upgrades or automated security updates running in background (most common) Another apt or package manager process actively updating package lists Software Center or GNOME Software Center downloading package metadata
Is the "E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource tem" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading