Thursday, December 20, 2018

apt - Cannot upgrade ubuntu 19.04 for a time




After I login ubuntu, as usual, I check upgradable packages by running: sudo apt update. Then the result is:





36 packages can be upgraded. Run 'apt list --upgradable' to see them.




I continue with the command:sudo apt upgrade but I got 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?





I waited for a few moments and then I rerun the previous command and it told me:




2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Is it an apt error or there's an update process running on the background?




You are duplicating the work being done by Unattended Upgrades, so encountering interference is expected behavior.




Take a look at the Software & Updates control panel, the 'Updates' tab:



enter image description here



Look at the line: When there are security updates



Those security updates are downloaded-and-installed-automatically using apt...just like updates that you initiate. Security updates can occur at any time, but often occur just after startup.



Since only one apt session can run at a time, one of you gets locked out with an error message until the current apt session completes. That lockout is the classic error message you encountered. Another process was indeed using apt at the time.




If you want to verify, look at /var/log/apt/history.log. You will likely see two sessions, one that installed the security updates, and another (yours) that installed the rest.



Interfering with Unattended Upgrades causes no damage. The same packages get installed regardless of who initiates the upgrade or when.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...