Open ghost opened 1 year ago
i have the same issue and i have set
Set VAGRANT_WSL_ENABLE_WINDOWS_ACCESS variable to "1" Set PATH variable to export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
but not luck
Hi @DaneParcJr @vtimbadiya have you been able to resolve this issue?
@javelwill No it still has the issue ,but the root cause is security software, which blocks the sub process Lunch. Tested in another machine where it worked
@DaneParcJr @vtimbadiya I had a similar issue. The error I encountered was:
Permission denied - /mnt/c/Program Files/Microsoft System Center/Service Manager//powershell (Vagrant::Util::Subprocess::LaunchError)
It seems Vagrant was trying to find powershell and found /mnt/c/Program Files/Microsoft System Center/Service Manager/powershell
which was appended from the Windows PATH before it could find the actual powershell.exe executable in its correct location.
I removed that path by appending the following line at the end of my .bashrc file - nano ~/.bashrc
:
export PATH=$(echo $PATH | sed 's|:/mnt/c/Program Files/Microsoft System Center/Service Manager/||g')
After doing so I loaded the changes - source ~/.bashrc
and my issue was resolved.
I hope this helps!
I had the same issue but in my case I added export VAGRANT_DEFAULT_PROVIDER="virtualbox"
in the .bashrc file and it worked!
Now I have another error but that's not related to this issue 😅
edit: the other issue was related to some host path, but that was fixed using: issues/10576
This is working after export VAGRANT_DEFAULT_PROVIDER="virtualbox"
Thanks @Gjovani
Looks like this is not working for hyperv export VAGRANT_DEFAULT_PROVIDER="hyperv"
Same issue here with windows 11 and WSL2 and using hyperv
hey @helarnl and @abh80 , do you have the same version of Vagrant installed on WSL and Windows?
If so, you could also try and add export PATH="$PATH:/mnt/c/ProgramData/Microsoft/Windows/Hyper-V"
in the .bashrc file (don't forget to load the changes with the command source ~/.bashrc
, as mentioned above)
@Gjovani Thanks for the reply. Just tested it both my Windows and WSL are using Vagrant 2.3.7. The error is still same after adding it to PATH
.
/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:160:in `rescue in execute': Permission denied - /mnt/c/Windows/system32/powershell (Vagrant::Util::Subprocess::LaunchError)
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:153:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:22:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:191:in `version'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:212:in `validate_install!'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:113:in `execute_cmd'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/platform.rb:82:in `block in windows_admin?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/platform.rb:84:in `windows_admin?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/providers/hyperv/provider.rb:20:in `usable?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:156:in `machine_config'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:49:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:740:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:180:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:204:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:186:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:186:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/commands/up/command.rb:87:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/cli.rb:67:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:301:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/bin/vagrant:248:in `<main>'
/opt/vagrant/embedded/gems/gems/childprocess-4.1.0/lib/childprocess/unix/fork_exec_process.rb:66:in `launch_process': Permission denied - /mnt/c/Windows/system32/powershell (ChildProcess::LaunchError)
from /opt/vagrant/embedded/gems/gems/childprocess-4.1.0/lib/childprocess/abstract_process.rb:81:in `start'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:155:in `block in execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/safe_chdir.rb:26:in `block (2 levels) in safe_chdir'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/safe_chdir.rb:25:in `chdir'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/safe_chdir.rb:25:in `block in safe_chdir'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/safe_chdir.rb:24:in `synchronize'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/safe_chdir.rb:24:in `safe_chdir'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:154:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:22:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:191:in `version'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:212:in `validate_install!'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:113:in `execute_cmd'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/platform.rb:82:in `block in windows_admin?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/platform.rb:84:in `windows_admin?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/providers/hyperv/provider.rb:20:in `usable?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:156:in `machine_config'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:49:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:740:in `machine'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:180:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:204:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:186:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:186:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/commands/up/command.rb:87:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/cli.rb:67:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:301:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/bin/vagrant:248:in `<main>
I have also tried running wsl as admin and it dosent work still
@DaneParcJr @vtimbadiya any update on this? I am trying this with WSL2 and Windows 11 with hyper v. The details are above
@abh80 try this
add this :WSLInterop:M::MZ::/init:PF to /usr/lib/binfmt.d/WSLInterop.conf
sudo systemctl restart systemd-binfmt
sudo apt update
sudo apt install binfmt-support
sudo ls -Fal /proc/sys/fs/binfmt_misc
Same issue
/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:160:in rescue in execute': Permission denied - /mnt/c/WINDOWS/system32/powershell (Vagrant::Util::Subprocess::LaunchError) from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:153:in
execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/subprocess.rb:22:in execute' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:191:in
version'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:212:in validate_install!' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/powershell.rb:113:in
execute_cmd'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/platform.rb:82:in block in windows_admin?' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/util/platform.rb:84:in
windows_admin?'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/providers/hyperv/provider.rb:20:in usable?' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:156:in
machine_config'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:49:in machine' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:740:in
machine'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:180:in block in with_target_vms' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:204:in
block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:186:in each' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/plugin/v2/command.rb:186:in
with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/commands/up/command.rb:87:in execute' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/cli.rb:67:in
execute'
from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:301:in cli' from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/bin/vagrant:248:in
My VARS
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1" export PATH="$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0" export PATH="$PATH:/mnt/c/WINDOWS/system32" export VAGRANT_DEFAULT_PROVIDER="hyperv" export PATH="$PATH:/mnt/c/ProgramData/Microsoft/Windows/Hyper-V"
When using WSL2 on Windows 11 (Ubuntu 22.04 LTS Distro), and installing both Vagrant on the Windows Machine and WSL2, setting up the environment variables and running any vagrant command. I get a permission denied issue. Virtual Box and Vagrant are both installed on the windows machine, I'm running WSL2 as an admin.
Debug output
https://gist.github.com/DaneParcJr/3a938d7eb241d406410517f32c36ea3b
Expected behavior
Actual behavior
Expected Vagrant to run without a permission denied error.
Reproduction information
Vagrant version
2.3.7 Linux 2.3.7 Windows
Host operating system
Windows 11
Guest operating system
Ubuntu 22.0.4 LTS
Steps to reproduce
VAGRANT_WSL_ENABLE_WINDOWS_ACCESS
variable to "1"PATH
variable toexport PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
Vagrantfile