After start, Synaptic Manager in Ubuntu sometimes gives error
Unable to get exclusive lock. This usually means that another package management application(like apt-get or aptitude) is already running. Please close that application first.
In this post, we will learn about the causes and solutions for this error.
There are multiple causes for this error. As the message says, it means that package manager is already running.
After Boot
Cause
By default, Ubuntu runs a check after reboot automatically — not immediately, but some time within. So, during this time if you try to run the update command, you will get this error.
Solution
For Ubuntu automatic system checks, you have to wait for it to complete and then run your update command.
You can check, if any system check is running or not using the following command,
ps aux | grep dpkg | grep -v grep
If it shows any text then it means system is still updating, just wait for it to completed.
Software Updater is Running
Cause
Sometimes after boot, system software updater popup comes with many system updates. You can cancel this update and it will close. But, if you accept the updates, it will start updating the system.
If this updater is running and you try to run the update command, you will get same error as above.
Solution
Generally, it is not advised to pause the updater. Once an update has started, allow it to run its course. So, wait for some time till it completes and then run your update command.
Otherwise, you can pause the updater to run update command from terminal and restart the updater later after your update command completes.