I have a fresh installation of Ubuntu 18.04-x64.
In the terminal I enter the command:
sudo apt update
And I get the following error:
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
When I run sudo apt update
again, the command runs successfully and I get:
Reading package lists... Done
Building dependency tree
Reading state information... Done
103 packages can be upgraded. Run 'apt list --upgradable' to see them.
This behaviour is consistent. I have a VM snapshot of the fresh Ubuntu installation and everytime the first sudo apt update
fails with this error and the second sudo apt update
completes successfully.
EDIT: Should have mentioned that the sudo apt update
command lies inside a script. Running the script with sudo privileges seems to have fixed the problem.