vagrant resume runs provisioners

Created on 4 Jan 2016  ยท  19Comments  ยท  Source: hashicorp/vagrant

Hi,

Im experiencing what seems to be a bug:

I run vagrant up and it boots and provisions the box properly, using my customized box which already has most of my required packages installed.

I run vagrant suspend and it suspends the box properly.

I run vagrant resume and it resumes the box BUT it also starts running the provisioners.

Is this a bug or am I doing something wrong?
Any hint as to why this might be happening?

Using:
Vagrant 1.8.1
vbox 5.0.12r104815

This is my vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

required_plugins = %w(vagrant-bindfs vagrant-vbguest vagrant-triggers vagrant-s3auth)

plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?
  puts "Installing plugins: #{plugins_to_install.join(' ')}"
  if system "vagrant plugin install #{plugins_to_install.join(' ')}"
    exec "vagrant #{ARGV.join(' ')}"
  else
    abort "Installation of one or more plugins has failed. Aborting."
  end
end

Vagrant.configure(2) do |config|
  config.vm.box = "<my_vendor>/base-trusty64"
  config.vm.box_check_update = false
  config.vm.box_url = "https://s3.amazonaws.com/<my-boxes>/base-trusty64.json"

  config.vm.network "private_network", ip: "172.16.0.100"

  if Vagrant.has_plugin?('vagrant-bindfs')
     config.vm.synced_folder "./www", "/mnt/vagrant", type: 'nfs'
     config.bindfs.bind_folder "/mnt/vagrant", "/var/www/<my_vendor>", owner: "<my_vendor>", group: "<my_vendor>", perms: "u=rwx:g=rwx:o=rwx", o: "nonempty"
  else
     exit;
  end

  config.vm.provider "virtualbox" do |vb|
    require 'time'
    vb.memory = "2048"
    vb.cpus = 4
    vb.name = "<my_vendor>.webshopapp.dev___" + Time.now.utc.iso8601
  end

  config.vm.provision "Fix for 'stdin: is not a tty'", type: "shell" do |s|
    s.inline = "sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
  end

  config.vm.provision "Provisioning", type: "shell"  do |s|
    s.path = 'var/setup/execute-files.sh'
  end

  config.trigger.after [:up,:reload,:resume] do
    run_remote  "/bin/bash /vagrant/var/sh/startup/restart-supervisor.sh"
  end

  config.trigger.before [:up,:reload] do |s|
    system('vagrant box outdated')
  end
end
bug core has-pr

Most helpful comment

Vagrant has not been abandoned. We are a very small team and have not had the opportunity to test these new changes yet. Sorry!

All 19 comments

I have the same issue, with the same version for Vagrant and vbox, and a Vagrant file generated with puphpet. What is worst is that some changes on disk are not persisted (like changing .bashrc), possibly due to the reprovision.

I'm seeing this as well with v1.8.1

Same problem with Vagrant 1.8.1:
vagrant resume -> runs provision

Doesn't fix the core issue, but after vagrant suspend I always run vagrant up to bring the VM back up, and provisioner is not run.

This has happened to me on two different VMs now when resuming with 1.8.1.

Here it is also going the same problem.

- Windows 10
- Virtualbox 5.0.14
- Vagrant 1.8.1
(Always running vagrant as administrator)

the same problem .

  1. vagrant suspend then vagrant resume ==> run provision
  2. vagrant snapshot save init then vagrant snapshot restore init ==> run provision

I have to vagrant halt first and then go to vritualbox , restore the snapshot , then vagrant up.

Confirm the problem vagrant resume runs provision.
Windows 10 host
Vagrant 1.8.1
Virtualbox 5.0.14

Same problem here, this is the workaround to resume and skip provision:

vagrant up --no-provision

facepalm

Any progress on this since we generated the inifite loop with #7133 ?

Same here. A coworker was wonderung why I complained about resume running a provisioner. It turned out he was running a 1.7.x. We agreed that he shouldn't upgrade until this issue is fixed.

is there an ETA on when this will be solved?

is there an ETA on when this will be solved?

Apparently the Vagrant was abandoned by @hashicorp :cry:

Vagrant has not been abandoned. We are a very small team and have not had the opportunity to test these new changes yet. Sorry!

Thanks guys for all your hard work. Vagrant is a hugely useful tool. @sethvargo

Oh my! It seems I have been bitten by this bug, and damn it's a pain in the...

The documentation specifically says that resume does NOT run provisioners.

From https://www.vagrantup.com/docs/cli/resume.html :

Command: vagrant resume [name|id]

This resumes a Vagrant managed machine that was previously suspended, perhaps with the suspend command.

The configured provisioners will not run again, by default. You can force the provisioners to re-run by specifying the --provision flag.

Also vagrant up was changed at some point (when I began using vagrant a couple years ago to require --run-provisioners to run provisioners. Before that, vagrant resume had to be used to resume a suspended vm without provisioning.)

As this is a destructive bug (I just lost a fine working development environment for a project), I hope this bug will get some attention, I am using 1.8.1, and now I see this issue has been closed, so I will upgrade and see if it remains a problem. Anyway, Ubuntu seems to still provide version 1.8.1, so it may be helpful to edit the docs to warn unsuspecting people of the potential destructiveness of resume in some versions.

/Lasse, still feeling kicked in the guts and ass simultaneously

I am experiencing this issue with 1.8.1. (because i did just 'apt-get install vagrant' ...)

update : forgot about https://releases.hashicorp.com/vagrant/
update: works in 2.1.5. slap

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cbeck527 picture Cbeck527  ยท  3Comments

jazzfog picture jazzfog  ยท  3Comments

RobertSwirsky picture RobertSwirsky  ยท  3Comments

rhencke picture rhencke  ยท  3Comments

lebogan picture lebogan  ยท  3Comments