kusnier/vagrant-persistent-storage

Vagrant 1.7.2 prompts for password when config.persistent_storage.enabled = true

cjcdoomed opened this issue · 1 comments

After "vagrant up" with the Vagrantfile below, I'm prompted to enter a password when I "vagrant ssh".

If I set "config.persistent_storage.enabled = false" and "vagrant up", "vagrant ssh" correctly uses the ssh key and just logs in.

OS X 10.10.2
Vagrant 1.7.2
vagrant-hostmanager (1.5.0)
vagrant-persistent-storage (0.0.15)
vagrant-share (1.1.3, system)
vagrant-vbguest (0.10.0)

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

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # The URL that the configured box can be found at
  #config.vm.box_url = "http://repository.orbitz.net/vagrant/centos-6-5-x64-virtualbox.box"
  config.vm.box = "hashicorp/precise32"


  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.network "forwarded_port", guest: 5008, host: 5008 # Debug app


  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"
  if RbConfig::CONFIG['host_os'] =~ /darwin/ # use nfs for performance on OS X since it is available without any setup needed
    config.vm.synced_folder "~", "/host_profile_home", nfs: true
  else
    config.vm.synced_folder "~", "/host_profile_home"
  end

  # If true, then any SSH connections made will enable agent forwarding.
  # Default value: false
  config.ssh.forward_agent = true

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  config.vm.provider "virtualbox" do |vb|

    # Speed up dns
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
    host = RbConfig::CONFIG['host_os']

    # Give VM 1/4 system memory & access to all physical cpu cores on the host
    if host =~ /darwin/
      cpus = `sysctl -n hw.ncpu`.to_i
      # sysctl returns Bytes and we need to convert to MB
      vb.memory = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4

    elsif host =~ /linux/
      cpus = `nproc`.to_i
      # meminfo shows KB and we need to convert to MB
      vb.memory = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4

    else 
      cpus = ENV['NUMBER_OF_PROCESSORS'].to_i
      vb.memory = 4096
    end

    # OSs report number of logical cores, including hyper-threads. Per VBox docs, it's best to not assign more then the number of physical cores, so divide by two
    vb.cpus = cpus / 2 

    # Don't boot with headless mode
    # vb.gui = true

    # Use VBoxManage to customize the VM. For example to change memory:
    if vb.gui =~ true
      vb.customize ["modifyvm", :id, "--vram", "128"]
      vb.customize ["modifyvm", :id, "--accelerate3d", "on"]
      vb.customize ["modifyvm", :id, "--accelerate2dvideo", "on"]
    end

  end

$script = <<SCRIPT
  echo 'Fix dhcp issue'
  echo '# this is needed to fix an issue where dhcp is not updated properly after restarting following vagrant halt' 
  echo '# see https://github.com/mitchellh/vagrant/issues/391 for more background' 
  echo '/sbin/service network restart' >> /etc/rc.local

SCRIPT


  config.vm.provision "shell", inline: $script


  config.persistent_storage.enabled = true
  config.persistent_storage.location = "~/guest-config/persistent_user_disk.vdi"
  config.persistent_storage.size = 30000
  config.persistent_storage.mountname = 'user_disk'
  config.persistent_storage.filesystem = 'ext4'
  config.persistent_storage.mountpoint = '/home/vagrant'
  config.persistent_storage.volgroupname = 'myvolgroup'  
end

Please confirm if this problem still exists.