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 up crashes with rsa_compat_build_request': undefined method '[]' for nil:NilClass (NoMethodError) #12408

Closed
ggiesen opened this issue Jun 3, 2021 · 4 comments · Fixed by #12415

Comments

@ggiesen
Copy link

ggiesen commented Jun 3, 2021

Vagrant version

Vagrant 2.2.16

Host operating system

CentOS Linux release 8.3.2011

Guest operating system

Cisco IOS-XE 16.09.07

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.provider "virtualbox" do |vb|
    vb.gui = true
    vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
  end
  config.vm.define "router1" do |router1|
    router1.vm.box = "cisco/csr1000v"
    # Turn off shared folders
    router1.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true
    # Do not try to insert new SSH key
    router1.ssh.insert_key = false
    # Give the VM time to boot as Vagrant cannot tell when it is booted
    router1.vm.boot_timeout = 900
    router1.vm.network :private_network, virtualbox__intnet: "link1", ip: "192.168.50.21", auto_config: false, nic_type: "virtio"
    router1.vm.network "forwarded_port", guest: 22, host: 20001
    router1.trigger.after :up do |trigger|
      trigger.info = "Configuring interfaces"
      trigger.run = {inline: "./configure_ips.py -P 20001 127.0.0.1"}
    end
  end

Debug output

https://gist.github.com/ggiesen/7d97219467a4ebb3d82899262963eb9a

The Gist contains 3 files:

  1. vagrant_up_router1-debug-1.txt - The first time vagrant up router1 is run
  2. vagrant_up_router1-debug-2.txt - The second time vagrant up router1 is run
  3. vagrant_ssh_router1-debug.txt - Then vagrant ssh router1 is run

Expected behavior

Bring up box

Actual behavior

The first time I run vagrant up router1, vagrant provisions the VM, and then crashes with the following error:

/opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/patches/net-ssh.rb:10:in rsa_compat_build_request': undefined method []' for nil:NilClass (NoMethodError)

The VM is left running, however, and I can run vagrant up router1 a second time and finishes running the trigger. I also encounter no issues using vagrant ssh router1

If I use password-based authentication, vagrant does not crash (but I have to log into all devices manually).

Steps to reproduce

  1. Use above Vagrantfile with Cisco CSR1000v box built using https:/hpreston/vagrant_net_prog
  2. Run vagrant up router1
@ggiesen ggiesen changed the title vagrant up crashes with rsa_compat_build_request': undefined method []' for nil:NilClass (NoMethodError)` vagrant up crashes with rsa_compat_build_request': undefined method '[]' for nil:NilClass (NoMethodError) Jun 3, 2021
@ggiesen ggiesen changed the title vagrant up crashes with rsa_compat_build_request': undefined method '[]' for nil:NilClass (NoMethodError) vagrant up crashes with rsa_compat_build_request': undefined method []' for nil:NilClass (NoMethodError) Jun 3, 2021
@ggiesen ggiesen changed the title vagrant up crashes with rsa_compat_build_request': undefined method []' for nil:NilClass (NoMethodError) vagrant up crashes with rsa_compat_build_request': undefined method \[]' for nil:NilClass (NoMethodError)` Jun 3, 2021
@ggiesen ggiesen changed the title vagrant up crashes with rsa_compat_build_request': undefined method \[]' for nil:NilClass (NoMethodError)` vagrant up crashes with rsa_compat_build_request': undefined method '[]' for nil:NilClass (NoMethodError) Jun 3, 2021
@gdams
Copy link

gdams commented Jun 8, 2021

I'm also getting this error and it's driving me crazy

@gdams
Copy link

gdams commented Jun 10, 2021

This was broken in vagrant 2.2.16, reverting to 2.2.15 fixes this for me

@ggiesen
Copy link
Author

ggiesen commented Jun 10, 2021

This was broken in vagrant 2.2.16, reverting to 2.2.15 fixes this for me

I can also confirm that reverting to 2.2.15 solves the issue.

@chrisroberts I'm guessing it was broken with this commit: a08597d

chrisroberts added a commit to chrisroberts/vagrant that referenced this issue Jun 11, 2021
    Set flag on RSA keys of deprecated RSA SHA1 support when loading
    keys based on server version of the transport. This ensures keys
    are properly flagged. Flag name has been updated to provide context
    on usage.

    Version matching on the OpenSSH server version has also been updated
    to handle customized naming in the version string (as seen in the
    Windows port) and to properly handle when no match is found.

    Fixes hashicorp#12344 hashicorp#12408 hashicorp#12381
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants