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

Problem with "vagrant up" from local box repository for hyperv #13391

Open
Wolvverine opened this issue May 17, 2024 · 1 comment
Open

Problem with "vagrant up" from local box repository for hyperv #13391

Wolvverine opened this issue May 17, 2024 · 1 comment

Comments

@Wolvverine
Copy link

Wolvverine commented May 17, 2024

/Vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/providers/hyperv/action/import.rb:20:in call': undefined method directory' for nil:NilClass (NoMethodError)

Full debug logs:

https://pastebin.com/AG0d01B5

Host operating system

Problem on Windows with local store box with Mint linux.

Reproduction information

Steps to reproduce

vagrant box add --name mintv1 "e:\Hyper-V VMs\Exported\Mint-Vagrant-Box\linuxmint-21.3-cinnamon-64bit.box"

vagrant up testlocal

Vagrantfile

Vagrant.configure("2") do |config|
	
	config.vm.define "test" do |test|
		test.vm.box = "wolvverine/LinuxMintCinnamon"
		test.vm.box_version = "1"
		test.vm.hostname = "Test-Vagrant"
		test.vm.network 'public_network', bridge: 'Internal Switch', type: "dhcp"
		test.vm.network 'private_network', bridge: 'Private Switch', type: "dhcp"
		test.vm.guest = :linux
		test.vm.box_architecture = 'amd64'
		#test.vm.synced_folder '.', '/vagrant', disabled: false, mount_options: ['vers=3.0']
		test.vm.provider 'hyperv' do |h|
			h.vmname = 'Test-Vagrant'
			h.cpus = 2,
			h.enable_virtualization_extensions = false,
			h.enable_enhanced_session_mode = true,
			h.enable_checkpoints = true,
			h.enable_automatic_checkpoints = true,
			h.vm_integration_services = {
				guest_service_interface: true,
				CustomVMSRV: true,
				heartbeat: true
			}
		end
		Vagrant::Config.run do |config|
			#config.vm.synced_folder "/mnt/scripts", "E:\Vagrant_Home\scripts", create: true
			#config.vm.provision :shell, :path => "/mnt/scripts/test.sh"
			config.vm.provision :shell, :path => "./scripts/test.sh"
		end
	end
	
	config.vm.define "testlocal" do |testlocal|
		testlocal.vm.box = "linuxmint-21.3-cinnamon-64bit"
		testlocal.vm.hostname = "Test-Vagrant-local"
		testlocal.vm.network 'public_network', bridge: 'Internal Switch', type: "dhcp"
		testlocal.vm.network 'private_network', bridge: 'Private Switch', type: "dhcp"
		testlocal.vm.guest = :linux
		testlocal.vm.box_architecture = 'amd64'
		#testlocal.vm.synced_folder '.', '/vagrant', disabled: false, mount_options: ['vers=3.0']
		testlocal.vm.provider 'hyperv' do |h|
			h.vmname = 'Test-Vagrant-local'
			h.cpus = 2,
			h.enable_virtualization_extensions = false,
			h.enable_enhanced_session_mode = true,
			h.enable_checkpoints = true,
			h.enable_automatic_checkpoints = true,
			h.vm_integration_services = {
				guest_service_interface: true,
				CustomVMSRV: true,
				heartbeat: true
			}
		end
		Vagrant::Config.run do |config|
			#config.vm.synced_folder "/mnt/scripts", "E:\Vagrant_Home\scripts", create: true
			#config.vm.provision :shell, :path => "/mnt/scripts/test.sh"
			config.vm.provision :shell, :path => "./scripts/test.sh"
		end
	end
	
end
@Wolvverine Wolvverine changed the title /Vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/providers/hyperv/action/import.rb:20:in call': undefined method directory' for nil:NilClass (NoMethodError) Problem with up from local box repository for hyperv May 17, 2024
@Wolvverine Wolvverine changed the title Problem with up from local box repository for hyperv Problem with "vagrant up" from local box repository for hyperv May 17, 2024
@Wolvverine
Copy link
Author

Wolvverine commented Jun 14, 2024

Box list:

E:\Vagrant_Home
# vagrant box list
linuxmint-21.3-cinnamon-64bit (hyperv, 0)
mintv1                        (hyperv, 0)
wolvverine/LinuxMintCinnamon  (hyperv, 1.1, (amd64))

Output for vagrant up testlocal :

E:\Vagrant_Home # vagrant up testlocal
Bringing machine 'testlocal' up with 'hyperv' provider...
==> testlocal: Verifying Hyper-V is enabled...
==> testlocal: Verifying Hyper-V is accessible...
==> testlocal: Box 'linuxmint-21.3-cinnamon-64bit' could not be found. Attempting to find and install...
    testlocal: Box Provider: hyperv
    testlocal: Box Version: >= 0
==> testlocal: Box file was not detected as metadata. Adding it directly...
==> testlocal: Adding box 'linuxmint-21.3-cinnamon-64bit' (v0) for provider: hyperv
P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/providers/hyperv/action/import.rb:20:in `call': undefined method `directory' for nil:NilClass (NoMethodError)

          vm_dir = env[:machine].box.directory.join("Virtual Machines")
                                    ^^^^^^^^^^
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:117:in `block in finalize_action'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/builder.rb:183:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/runner.rb:104:in `block in run'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/util/busy.rb:22:in `busy'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/runner.rb:104:in `run'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/builtin/call.rb:56:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/builtin/config_validate.rb:28:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/builtin/handle_box.rb:59:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/providers/hyperv/action/check_access.rb:22:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/providers/hyperv/action/check_enabled.rb:21:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/builder.rb:183:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/runner.rb:104:in `block in run'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/util/busy.rb:22:in `busy'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/runner.rb:104:in `run'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/machine.rb:247:in `action_raw'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/machine.rb:216:in `block in action'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/environment.rb:649:in `lock'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/machine.rb:202:in `call'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/machine.rb:202:in `action'
        from P:/Program Files/Vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/batch_action.rb:89:in `block (2 levels) in run'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants