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 fails due to locked file #11083

Closed
AdityaGovardhan opened this issue Sep 23, 2019 · 3 comments
Closed

vagrant up fails due to locked file #11083

AdityaGovardhan opened this issue Sep 23, 2019 · 3 comments

Comments

@AdityaGovardhan
Copy link

Vagrant version

Vagrant 2.2.5

Host operating system

Windows 10 + WSL
I have created the box using packer and powershell. The box was created successfully. I added the box to vagrant using WSL and vagrant box add command.

Guest operating system

The guest operating system is Windows 10. I tried to run the box using WSL and vagrant up command.

Vagrantfile

Vagrant.require_version ">= 2.2.2"

Vagrant.configure("2") do |config|

  # disable mounted shared folders
  config.vm.synced_folder ".", "/vagrant", disabled: true

  # Custom Packer built Windows 10 box
  config.vm.define "vagrant-windows10", primary: true do |windows10|
    windows10.vm.box = "windows10"  # ensure to add box to vagrant
    windows10.vm.communicator = "winrm"
    windows10.vm.guest = :windows
    windows10.vm.network "forwarded_port", guest: 3389, host: 33389  # Allows RDP
    windows10.windows.halt_timeout = 30
    windows10.winrm.password = "123"
    windows10.winrm.username = "abc"
    windows10.vm.provider :vmware_desktop do |vd, override|
      vd.vmx["memsize"] = "2048"
      vd.vmx["numvcpus"] = "1"
    end

    # Use `CANARY=true vagrant up` to test the latest local box build
    if ENV["CANARY"] == "true"
      windows10.vm.box_url = "file://packer/packer_output/windows10.box"
    end
  end
end

Debug output

https://gist.github.com/AdityaGovardhan/5d18e74b840819d47f0fdada5cb950f8

Expected behavior

vagrant up should have executed successfully

Actual behavior

vagrant up didn't execute successfully due to some kind of file lock

Steps to reproduce

  1. packer build (not possible to provide packer file)
  2. vagrant box add
  3. vagrant up

References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

@AdityaGovardhan
Copy link
Author

So, I was able to get some clue of what's happening.

I am able to vagrant up, status and destroy the machine using powershell separately. I am able to view the correct state of this machine through VMware workstation since vagrant-vmware-utility for Windows is running correctly. Now, I am able to vagrant up, status and destroy the machine using WSL separately. However, I am not able to view the correct state of this machine through VMware workstation since vagrant-vmware-utility for WSL is not running correctly.

I might have mixed up running commands through powershell and WSL leading to different permissions on file, thus not being able to remove the lock files.

That's one issue resolved. Now regarding vagrant-vmware-utility not running correctly inside WSL and thus VMware workstation not being able to detect the correct state of created machine. I believe that the utility's function is to collect state information from vagrant and pass it to VMware workstation. I read somewhere that WSL cannot create background services and also, following issue occurs which I am not able to understand:

$ sudo service vagrant-vmware-utility status
/etc/init.d/vagrant-vmware-utility: line 23: /etc/init.d/functions: No such file or directory
/etc/init.d/vagrant-vmware-utility: line 36: pidofproc: command not found

I downloaded and installed the general vagrant-vmware-utility for general linux from here and followed this guide. It doesn't have any specific installation instructions for WSL.

So I think using WSL + vagrant + vagrant-vmware-plugin for creating virtual machine and operating on it using VMware workstation pro is not possible (except this).

However, if I am missing out on some steps please let me know.

@chrisroberts
Copy link
Member

Hi there,

The vagrant-vmware-utility should only be running on the host windows system (it should not be running within the WSL). This is because it is communicating with the VMware installation that's on the host system, not within the WSL. So you won't need the utility installed and running within WSL.

As for seeing the VM within the VMware GUI itself, you have two options:

  1. In your provider configuration section in your Vagrantfile add:
vd.gui = true
  1. From the VMware GUI, you can do a File -> Open and open the path to the VM file on the system. This will be in ProjectDir\.vagrant\machines\MACHINE_NAME\vmware_desktop\UUID\VMFILENAME.vmx

The file with the .vmx extension is what you'll want to open to get it loaded in the GUI.

Cheers!

@ghost
Copy link

ghost commented Jan 28, 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 Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants