Unable to use package manager due to "exclusive lock" error [duplicate]

I had the same problem. This post helped however, the pa aux command and the Kill command were ineffective. sudo rm /var/lib/dpkg/lock seemed to work, and I followed it up by another Linux post.

  1. You need sudo rights, so the full command is:

    sudo dpkg --configure -a
    
  2. Try using Konsole terminal program instead. Make sure that all package managers are closed! Issue the commands:

    sudo apt-get update  
    sudo apt-get upgrade
    

The sudo apt-get update command worked.

The sudo apt-get upgrade one did not as it stated could not get dns proxy.

Also the following came up:

some files failed to upload using old files.

At least the update was able to fetch 39 of them. The other is irrelevant as this is the latest Ubuntu 12.04 64-bit.


I had interrupted a sudo apt-get upgrade, and I was unable to get a lock on anything. I simply fixed it by running sudo dpkg --configure -a, and it let me pick up where I left off. Dunno if it helps, might as well share.