Skip to content
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

vagrant resume runs provisioners #6787

Closed
hgraca opened this issue Jan 4, 2016 · 19 comments · Fixed by #7059
Closed

vagrant resume runs provisioners #6787

hgraca opened this issue Jan 4, 2016 · 19 comments · Fixed by #7059

Comments

@hgraca
Copy link

hgraca commented Jan 4, 2016

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
@sbocconi
Copy link

sbocconi commented Jan 7, 2016

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.

@westse
Copy link

westse commented Jan 14, 2016

I'm seeing this as well with v1.8.1

davidmnoriega added a commit to davidmnoriega/docker-registry-proxy that referenced this issue Jan 20, 2016
@brasileric
Copy link

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

@jtreminio
Copy link

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.

@jwarkentin
Copy link

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

@thiagotalma
Copy link

Here it is also going the same problem.

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

@yoke88
Copy link

yoke88 commented Feb 6, 2016

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.

@Tobion
Copy link

Tobion commented Feb 12, 2016

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

@mauricios
Copy link

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

vagrant up --no-provision

photon-gerrit pushed a commit to vmware-archive/photon-controller that referenced this issue Feb 19, 2016
Use newer release of Photon plugin

Workaround 'vagrant resume' bug outlined here
hashicorp/vagrant#6787

Change-Id: Ia094b578c440b9e659ea3345a2ab6d9cad7a8472
markpeek added a commit to markpeek/vagrant that referenced this issue Feb 20, 2016
The sentinal file was always being ignored when running the
resume command. This is fixed along with allowing provision
options to be used with resume. Fixes hashicorp#6787
@davidsalazar
Copy link

facepalm

@cheeryfella
Copy link

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

@masi
Copy link

masi commented May 4, 2016

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.

@dvlancer
Copy link

is there an ETA on when this will be solved?

@thiagotalma
Copy link

is there an ETA on when this will be solved?

Apparently the Vagrant was abandoned by @hashicorp 😢

@sethvargo
Copy link
Contributor

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

@leoquijano
Copy link

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

@lassehp
Copy link

lassehp commented Jun 12, 2017

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

@axd1967
Copy link

axd1967 commented Oct 9, 2018

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

@ghost
Copy link

ghost commented Mar 29, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.