Vagrant up failing: Could not get lock /var/lib/dpkg/lock
1 min readJul 11, 2016
I ran into a problem recently where vagrant failed to bring up new vagrant boxes that were based on Ubuntu 16.04 (Xenial) boxes.
The problem was we were using NFS mounts and vagrant had to install nfs-common and portmap packages. Before it did so, it ran apt-get -yqq update, and this failed with error:
==> default: Could not get lock /var/lib/dpkg/lock — open (11: Resource temporarily unavailable)While troubleshooting I found Ubuntu apt-daily service runs on boot and this runs apt-get update as part of its unattended installation system.
To work around this problem, I disabled the apt-daily systemd service from the Vagrantfile we use to build new vagrant boxes.
config.vm.provision "shell", inline: <<-SHELL
..
..
systemctl disable apt-daily.service
systemctl disable apt-daily.timer
SHELL