vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

Vagrant fails to ssh to the ubuntu/xenial64 (asks for password) when env vars are used in Vagrantfile

Open x-yuri opened this issue 10 years ago • 9 comments

Vagrant version

1.8.4

Host operating system

Arch Linux

Guest operating system

ubuntu/xenial64 box

Vagrantfile

Vagrant.configure('2') do |config|
  if ENV['B'] == 'ubuntu'
    config.vm.box = 'ubuntu/xenial64'
  else
    config.vm.box = 'centos/7'
  end
end

Debug output

~~https://gist.github.com/x-yuri/ef4dd24dbf72a2e5ffa0f28bbd46c9d0~~ https://gist.github.com/x-yuri/4bbcf7cf8c37746627409e34f00ea2e1

Expected behavior

It shouldn't ask for password when doing vagrant ssh.

Actual behavior

It asks for password.

Steps to reproduce

  1. B=ubuntu vagrant up
  2. vagrant ssh

References

This issue is related, but seems to be a separate one. The one I'm describing here looks like an issue with vagrant. With the following Vagrantfile it works:

Vagrant.configure('2') do |config|
  config.vm.box = 'ubuntu/xenial64'
end

If you have a workaround in mind, you're welcome.

More info

If you make ubuntu default box:

Vagrant.configure('2') do |config|
  if ENV['B'] == 'centos'
    config.vm.box = 'centos/7'
  else
    config.vm.box = 'ubuntu/xenial64'
  end
end

And do vagrant up && vagrant ssh, it logs in. So, it seems like something is grepping Vagrantfile and takes the last occurrence. Or the environment variable gets lost somewhere along the way.

x-yuri avatar Sep 04 '16 15:09 x-yuri

Same for me (on macOS). vagrant up always ask for password.

rap2hpoutre avatar Oct 04 '16 09:10 rap2hpoutre

👍 happens here as well. MacOS

nickescobedo avatar Oct 06 '16 01:10 nickescobedo

Happens to me, also.

Host operating system: Xubuntu 16.04 Guest operating system: ubuntu/xenial64 box Vagrant version: 1.8.6 Virtualbox version: 5.0.26 r108824

lekum avatar Oct 18 '16 12:10 lekum

the same issue, happens to me.

Host operating system: macOS Sierra Guest operating system: ubuntu/xenial64 box Vagrant version: 1.8.6 Virtualbox version: 5.0.26 r108824

encodiaweb avatar Oct 18 '16 18:10 encodiaweb

Affects me, too.

Host operating system: Sabayon Linux Guest operating system: ubuntu/xenial64 (box_version = "20161022.0.0") Vagrant version: 1.8.5 Virtualbox version: 5.1.6 r110634

Ryuno-Ki avatar Nov 03 '16 20:11 Ryuno-Ki

+1

xlvdk avatar Dec 08 '16 12:12 xlvdk

Same for me. I think this it the bug, so this issue should be closed here: https://bugs.launchpad.net/cloud-images/+bug/1569237

Host operating system: Ubuntu Guest operating system: ubuntu/xenial64 (box_version = "20170118.1.0") Vagrant version: 1.9.1 Virtualbox version: 5.1.14r112924

SamuelMarks avatar Jan 19 '17 02:01 SamuelMarks

Closing this as an upstream issue with box author. Cheers!

chrisroberts avatar Mar 02 '17 16:03 chrisroberts

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 avatar Apr 02 '20 02:04 ghost