When provisioning a new machine in Google Compute Engine with Vagrant, I spotted the following error messages when updating the system:
1
2
Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
It appears to be that I was just behind on the race to grab the lock on the APT update. Without getting the latest index, I am not able to upgrade the packages. An simple solution is to wait it out:
Keep a single server up to date is easy, but updating multiple servers at once, you need tools like Ansible. For each server, here is a list of basic steps:
Check if there are packages available to be upgraded
Upgrade all packages to the latest version
Check if a reboot is required
Reboot the server
When we log into the remote server, we might see the message showing the number of packages can be updated. The message is generated by: