-
Notifications
You must be signed in to change notification settings - Fork 822
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
Location of WSL rootfs filesystem for post - Fall Creator's Update installations #2578
Comments
follow the course of a server install may be the answer: I got edit edit2 edit3: yet, edit4 sorry for the thread hijack |
I was wondering if a minimal GUI could be added. Not sure if it is worth the time investment from the BashOnWindows team, but my idea would be that people would start this, perhaps even from the subsystem itself, and it could then show lots of information, with tabs too, about all the subsystems on that machine (including where it is installed and which versions etc...). Like, where things are installed, how many and which distro-systems are available presently etc... The reason why I mean a GUI specifically is because it may be the simplest and most convenient way for people to query information. Sorry for being off-topic too. |
I keep looking at it on and off. Mostly off. I really wanted it to be a UWP GUI, but that turns out to be artificially difficult for reasons, and I time sunk a few evenings with not much of practical use to show for it. Vote for this User Voice (unrelated to WSL) if you have a chance. It is pretty straightforward to do with WPF and C++/CLI, but ick. |
Sometimes I think the WSL/Console team really doesn't like GUI's... |
@Biswa96 I would love to see FreeBSD as an instance Do you get the store infrastructure and is the instance possible to uninstall? |
I do think that there should be a more straightforward way to access the filesystem than having that whole path, especially since it can change depending on where you install the app too. Maybe an environment variable? |
Tangentially, I also wonder whether there's a better way to handle situations like this. There are definitely situations where we need access to the actual filesystem, but going via the app folder feels hacky in a way. |
@MikeGitb "Sometimes I think the WSL/Console team really doesn't like GUI's..." Command Line is the new Black :) Our stated and still remaining current goal is to deliver a command-line toolset & environment in which you can run your favorite Linux command-line tools. This has been our position since we first unveiled WSL back at Build 2016. While many people get their favorite GUI apps and desktops running via an X Server, we're not currently testing or improving GUI app experiences on WSL. Again, WSL is primarily a tool to enable dev's to build and run the *NIX & open-source tools & projects that they need to get their work done. HTH. |
@bitcrazed: I'm pretty sure I was not referring to graphical applications inside the WSL but to a GUI for the WSL as suggested by @shevegen. The windows console still doesn't have tabs, the options menu still doesn't allow us to configure colors from the full spectrum available and there is no nice management GUI showing us what distributions are installed or that would allow us to configure them (e.g. deciding whether we want interop activated and whether the windows path should be appended to the linux PATH variable. |
Ahhhh. Gotcha. Thanks for the clarification. Tabs: Not yet, but it's high on our backlog once we've completed our core re-engineering HOWEVER, note that it's unlikely allowing users to customize terminal colors will have the effect you expect: Many apps control color config themselves and emit specific RGB color VT sequences that bypass terminal settings. We wanted to add the WSL config settings you suggest above: Just didn't have time * resources necessary this time around. If it turns out to be something many are asking for, we'll reconsider. Be sure to let @tara-raj know if you think we should. |
No worries - except for the tabs I consider none of it a high priority feature (and I do come by without them) but couldn't resist making that comment. My personal top item on the whish list is running the clang sanitizers in wsl (#121) |
We have a LOOOONG list of things we need to address - all part of the biggest overhaul the Console's received in > 30 years! Tabs, replace text renderer, zoomable text, support for more Unicode/UTF-8 symbols, emoji, PowerLine, ..., etc. We're taking some time to address some core internal rearchitecture & feature work, after which we'll return to more user-visible features. Bear with us ;) |
This issue bit me as well. I use "git difftool --no-symlinks" from within Bash and it places the left/right output in my /tmp folder. I have my difftool configured to launch a script which opens the diff in a Windows application. The script points to the Windows path equivalent of /tmp. This stopped working with the Fall Creator's Update. |
@bitcrazed Is it possible to get the UUID of current WSL instance within itself? I'll try to clarify:
|
BR0kEN has a different question, and it's actually a pretty good one. I can't think of a straightforward way to get installation UUID of the running instance from inside WSL. Note the hypothetical registry entry If you just want to query the registry for whatever then use interop to spawn a powershell script from WSL and parse the output. Some info on querying the registry here. I suspect what you really want here though is just an environment variable passed from the windows side. |
@therealkenc, I've used the Example:Ubuntu -> $WSLREGKEY="HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss"
$WSLDEFID=(Get-ItemProperty "$WSLREGKEY").DefaultDistribution Above script will set |
I've realized that in WSL we have But still, I don't know how to get the ID of the current shell within itself. Will try to seek in processes/buses. ionescu007/lxss#3 (comment) |
Found the https://stackoverflow.com/questions/46877300/how-to-get-path-to-linux-installation-from-within-wsl-in-fall-creators-update which is more or less the answer to the question. All that should be known it's the name of a package. Now I'm wondering whether there's a nicer way to tackle this. |
That SO post will get you a known default distribution (such as Ubuntu), but not the one that is running. The instance that is running might or might not be the default. It might or might not be Ubuntu. It might be Arch Linux. It might be Gentoo. It might be KLD (Ken's Linux Distro) with GUID 5b43b5f9-111e-49fe-8de3-55efbcf3fd8f. The right approach here will depend a lot on why you want this GUID. That is, what you plan to do with it once you have it. |
I don't agree that SO approach is for getting the default distro. Let's have a look: (Get-ChildItem "HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss" -Recurse | ForEach-Object { Get-ItemProperty $_.pspath } | Where-Object { $_.PackageFamilyName -eq ($(get-appxpackage).PackageFamilyName | findstr SUSE) }).BasePath What will the above script return? IMO, the At the moment I need this GUID to get the |
But despite it's working it doesn't seem stable since you have to invent a way to realize what instance you are currently in. I can't believe there's no other and elegant way to get the concrete signs that I'm in particular WSL. By the way, the hashicorp/vagrant#9300 is a PoC implementation of SO post in Vagrant. |
That's because you knew to search for the magic four character string
Exactly. You can't know if you are in Ken's Linux Distro (KLD), because you've never heard of it. And KLD might not even have
I can have many GUIDs that return the same string ' All of which might be (and probably is) academic for your use case, whatever it is. So no need to explain that. I'm just sayin' how the relationship works, and why it is "a good question". |
Yeah, I do understand that and fully agree with all of the statements. That's why I don't really like the implementation I made. |
I found a weird and hacky way to get the information (from Based on that, whole entry from the registry could be looked up by the RUN_ID="/tmp/$(date +%s)"
# Mark our filesystem with a temporary file having an unique name.
touch "${RUN_ID}"
powershell.exe -Command '(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath.replace(":", "").replace("\", "/")' | while IFS= read -r BASEPATH; do
# Remove trailing whitespaces.
BASEPATH="${BASEPATH%"${BASEPATH##*[![:space:]]}"}"
# Build the path on WSL.
BASEPATH="/mnt/${BASEPATH,}/rootfs"
# Current WSL instance doesn't have an access to its mount from within
# itself despite all others are available. That's the hacky way we're
# using to determine current instance.
#
# The second of part of the condition is a fallback for a case if our
# trick will stop working. For that we've created a temporary file with
# an unique name and now seeking it among all WLSs.
if ! ls "${BASEPATH}" > /dev/null 2>&1 || [ -f "${BASEPATH}${RUN_ID}" ]; then
echo "${BASEPATH}"
# You can create and simultaneously run multiple WSL instances, comment
# out the "break", run this script within each one and it'll return only
# single value.
break
fi
done
rm "${RUN_ID}" Actually, it's not a Bash or PowerShell, - it's PowerBash. Does someone have a patent? 🤣 UPD 1: checked on the old distro, installed via UPD 2: modified a script that will continue operating correctly even if the directory with WSL FS will become available someday. A simple trick with creating a file having an unique name in |
I create a dir inside bash at /home/ubuntu how can I access read and write access outside bash? If its not possible would be the app almost useless. We still need to change the files using our tools! Why not? |
@jbarros35 Did you read the blog post mentioned above several times that explains why you cannot and should not try to access your Linux files from Windows or apps and tools running in Windows? We recommend storing files that you want to be able to access from both Windows and Linux in your Windows filesystem. This way, Windows tools can access said files, and so can Linux tools via |
Thanks for the discussion. |
Note: commentary here suggests that you cannot access Windows files from Linux, but see this https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/ which notes:
I discovered this article from the message at the top of https://devblogs.microsoft.com/commandline/do-not-change-linux-files-using-windows-apps-and-tools/ |
With the deprecation of the legacy WSL/lxss, the location of the new rootfs directory is seriously lacking in documentation.
From: https://stackoverflow.com/questions/46820268/where-has-c-users-username-appdata-local-lxss-gone-under-windows-fall-creator
For the Ubuntu on Windows app the location is:
EDIT: As noted in blog post
DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.
The rootfs location is useful for backing up files, symlinking for read only access, etc.
If anyone can add the roots location for the other distros, that would be much appreciated.
The text was updated successfully, but these errors were encountered: