-
-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)" #7
Comments
To reproduce, use the following Vagrantfile with the current version of the Vagrant.configure(2) do |config|
config.vm.box = "geerlingguy/ubuntu1604"
config.vm.network "forwarded_port", guest: 22, host: 422, id: "ssh"
config.vm.network "forwarded_port", guest: 80, host: 480
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = 1
vb.name = "vagrant-geerlingguy-vm-test"
vb.linked_clone = true
end
config.vm.provision "shell", inline: <<-SHELL
sudo echo vagrant:vagrant | /usr/sbin/chpasswd
sudo apt-get update
sudo apt-get install apache2 -y
sudo service apache2 restart
SHELL
end |
Related earlier commit (which didn't quite do the job): dac33a6 |
Uploading box version 1.0.3 now. |
Testing... |
I think this is fixed now. Hopefully for good. |
@geerlingguy looks like i can get rid of https://gist.github.com/gretel/34008d667a8a243a9682e5207619ad95 now. regards |
Awesome! |
this is my VAGRANTFILE: Vagrant.configure(2) do |config| config.vm.network "public_network" , ip: "192.168.1.111" config.vm.provision "shell" do |s| end when i run vagrant up i get: ==> default: Reading package lists... but when i run: vagrant reload --provision it works. |
I had this "provisioners": [
{
"type": "shell",
"inline": [
"sleep 80", |
I ran into this issue with a different Ubuntu VM using Vagrant, and I thought I would post my workaround here for any future Googlers: wrap all your "apt" calls in this function: function wait_for_apt_lock() {
while [ "" = "" ]; do
eval "$1" 2>/dev/null
if [ $? -eq 0 ]; then
break
fi
sleep 1
echo "Waiting for apt lock..."
done
} Like so: wait_for_apt_lock "apt-get update" |
Rather than expecting More useful variant:
Example:
And instead of a
Keep in mind exporting The best would be to combine both, the function alias and the waiting loop cycle. |
@arno01, thanks, it works |
Looks like this error is rearing its ugly head again. We need to fix the automatic updates defaults fully.
See related bug in bento: chef/bento#609
The text was updated successfully, but these errors were encountered: