-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
WSL rootfs on newer OS builds is no longer "%LOCALAPPDATA%\lxss" #9298
Comments
@chrisroberts, I made a PR based on microsoft/WSL#2578 (comment) and would appreciate if you could take a look (since you were the initial author of WSL integration). |
Thanks for the patch it (kind of) worked. I'm on:
In the "/opt/vagrant/embedded/gems/gems/vagrant-2.0.1/lib/vagrant/util/powershell.rb" I had to change all the "powershell" references in "powershell.exe", otherwise vagrant would've complain that there was no powershell in the PATH. |
@AsharLohmar, you can just create a symlink. Example: https://github.com/BR0kEN-/cikit/blob/6f1b572e3f3a779a7a776e919c39e2a6cca77643/docs/_documentation/install-on-wsl/wsl-provision.sh#L14-L27 |
That's a good advice . Thanks |
Can I build this release for testing somehow without tainting my local WSL env? How do you build a deb from source? Thanks |
@atorstling, download deb from https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb and patch it with https://raw.githubusercontent.com/BR0kEN-/cikit/master/docs/_documentation/install-on-wsl/patches/vagrant-2.0.1-issue-9298.patch. cd ~
wget -q https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
sudo dpkg -i vagrant_2.0.1_x86_64.deb
rm vagrant_2.0.1_x86_64.deb
cd /opt/vagrant/embedded/gems/gems/vagrant-2.0.1
sudo wget -q https://raw.githubusercontent.com/BR0kEN-/cikit/master/docs/_documentation/install-on-wsl/patches/vagrant-2.0.1-issue-9298.patch
sudo patch -p1 < vagrant-2.0.1-issue-9298.patch |
@BR0kEN- Ok, I patched 2.0.2 and symlinked powershell, but I get the
The "/mnt/trstling" path looks iffy. I don't think it exists. Actually, looking closer into it the issue seems to be that you do |
Yeah, @atorstling, well noticed! I'll do an update on this today. |
@BR0kEN- Great, thanks! |
@atorstling, my tests says the |
@BR0kEN- yes, that got me further. But now I get
|
@atorstling, well, now it's a matter of the environment configuration you have.
|
Ensure VirtualBox's folder is in the PATH Side note: I don't think that VirtualBox can or should be ran from inside WSL |
@AsharLohmar, @atorstling has the |
@AsharLohmar, it calls interoperability. See https://docs.microsoft.com/en-us/windows/wsl/interop. You may symlink any sudo ln -fs "/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe" /usr/bin/VBoxManage
VBoxManage --version |
Could you give me a hint where the |
The |
@BR0kEN- Oh. Yes, virtualbox is at BTW, could you redact the UNC path a bit? I just redacted the ones I posted. Thanks. |
@atorstling, take a look at the
I'm asure that if What you have:
How it should look:
|
@atorstling, try to replace the |
@BR0kEN- Thanks. I tried experimenting on the command line, and the problem seems to be that And could you edit your posts to redact my company and project name in the folders please? Thank you. |
@atorstling, they are extra in a case you're wrapping the path into quotes. I think the problem with paths, having spaces, is not related to this topic. I'd be thankful if you could check, on an account with a spaceless username, whether the root issue can be fixed. |
@atorstling, you also can escape space characters by the backslashes (instead of quotes). Should be correct either:
My advice for wrapping into quotes was wrong, sorry. Seems instead of the |
@BR0kEN- When I entered the command in the terminal, removing extra backslashes worked. I also tried again with
Shall we continue in another channel perhaps? How can I reach you? |
…hell" is not available
…hell" is not available
Closing via #9525 |
* commit '04fdab961e258b6b05c10a26ab1f073bf0894439': Update CHANGELOG Handle pathing in lxrun generated WSL instances better. Don't include test files within gem package Add a custom path location to ignore Update the wording to not assume latest WSL features Include support for lxrun generated install hashicorp#9298: Fix typos in comments to the code hashicorp#9298: Try to fallback to "powershell.exe" on WSL if "powershell" is not available hashicorp#9298: Respect usernames with spaces hashicorp#9298: Improve error message when WSL rootfs cannot be found hashicorp#9298: Add debugging messages and explanations to the code hashicorp#9298: Increase stability of determination of a current WSL instance hashicorp#9298: Use a single-word distro name hashicorp#9298: Compute a correct path to the current WSL instance Update CHANGELOG (hashicorp#9059) Convert to windows path if on WSL during vbox export
I tried out Vagrant for the first time today, ran into this problem, and re-did all the work to figure it out before discovering this issue and recognizing that it addresses my exact situation. /sigh So, for the sake of posterity and searches, vboxsf mount failure with Vagrant in WSLIf you are a WSL user and you get this error while trying to
...it's because Vagrant is trying to mount the wrong Windows path to your WSL directory as a shared folder in your VM. You can see that in the VirtualBox GUI by looking at the VM's Settings > Shared Folders > Machine Folders entry. If it has Should Vagrant mount WSL rootfs directories as shared folders at all?To the subscribers/contributors on this thread: are there any concerns with having Vagrant just mount the new rootfs location as a shared folder into a VM? I'm wondering because the WSL devs strongly advise, "Do not change Linux files using Windows apps and tools." In other words, what's the risk that mounting a WSL rootfs subdirectory into a VirtualBox VM will lead to file corruption? I am totally new to Vagrant and don't really know what it's doing under the hood here. I have had luck just making a project directory in a non-hidden location elsewhere under |
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. |
Vagrant version
Vagrant 2.0.2
Host operating system
Windows 10 (version
1709
, build16299.125
).Expected behavior
Vagrant is to detect current WSL container and compute a proper path to it.
Actual behavior
Vagrant handles only the WSL that is installed via
lxrun
.References
Additional information
Before the
16215
build of Windows, there was a way to install a WSL usinglxrun
. After mentioned build this way has been deprecated and, since then, it's recommended to use Microsoft Store for installing a WSL. Moreover, since that version, you can have multiple instances of Linux subsystem.When the installation is done by
lxrun /install
thenrootfs
of a WSL will be in%LOCALAPPDATA%\lxss
and Vagrant will operate correctly since its codebase relies on this location (https://github.com/hashicorp/vagrant/blob/v2.0.1/lib/vagrant/util/platform.rb#L286-L289).When the installation is done from the Microsoft Store, then
rootfs
of a WSL will be in%LOCALAPPDATA%\Packages\<WSL_ID>\LocalState
. Pay your attention at the<WSL_ID>
token in the path which is completely dynamic.The path of the particular container can be obtained from the registry at
HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss
- a listing of installed subsystems.For instance, using the following PowerShell script, the path of default subsystem can be gained.
The text was updated successfully, but these errors were encountered: