diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 67ed5c54a..bc4b9731b 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -70,7 +70,8 @@ module Vagrant @_wsl = false SilenceWarnings.silence! do # Find 'microsoft' in /proc/version indicative of WSL - if File.file?('/proc/version') + # When VAGRANT_WSL_NESTED_VIRTUALIZATION is true, @_wsl will remain false, acting as if not on WSL + if File.file?('/proc/version') && !ENV["VAGRANT_WSL_NESTED_VIRTUALIZATION"] osversion = File.open('/proc/version', &:gets) if osversion.downcase.include?("microsoft") @_wsl = true diff --git a/templates/locales/en.yml b/templates/locales/en.yml index a63be4cb2..f5b0ef398 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -2020,6 +2020,8 @@ en: Please ensure both installation of Vagrant are the same. If you do not want update your Vagrant installations you can disable Windows access by unsetting the `VAGRANT_WSL_ACCESS_WINDOWS_USER` environment variable. + You can also use nested virtualization within WSL2 by setting + the `VAGRANT_WSL_NESTED_VIRTUALIZATION` environment variable. Windows Vagrant version: %{windows_version} Windows Subsystem for Linux Vagrant version: %{wsl_version} @@ -2027,16 +2029,21 @@ en: Vagrant will not operate outside the Windows Subsystem for Linux unless explicitly instructed. Due to the inability to enforce expected Linux file ownership and permissions on the Windows system, Vagrant will not make modifications to prevent - unexpected errors. To learn more about this, and the options that are available, + unexpected errors. You can use nested virtualization within WSL2 by setting + the `VAGRANT_WSL_NESTED_VIRTUALIZATION` environment variable. + To learn more about this, and the options that are available, please refer to the Vagrant documentation: https://www.vagrantup.com/docs/other/wsl.html wsl_virtualbox_windows_access: |- Vagrant is unable to use the VirtualBox provider from the Windows Subsystem for Linux without access to the Windows environment. Enabling this access must be - done with caution and an understanding of the implications. For more information - on enabling Windows access and using VirtualBox from the Windows Subsystem for - Linux, please refer to the Vagrant documentation: + done with caution and an understanding of the implications. + You can use providers within WSL2 via nested virtualization by setting + the `VAGRANT_WSL_NESTED_VIRTUALIZATION` environment variable. + For more information on enabling Windows access and using VirtualBox from the + Windows Subsystem for Linux, please refer to the Vagrant documentation: + https://www.vagrantup.com/docs/other/wsl.html wsl_rootfs_not_found_error: |-