Comments (11)
Any great tip like the 0x08 for this one or should I just make my commands more strict?
I'm not the right one to comment on that. But if this was not for Ubuntu or any stable software I have some dangerous tricks in my sleeve 🤐
from wsl-distrolauncher.
Just curious where it is used.
from wsl-distrolauncher.
Hi! We have a custom routine for both distro installation and later reconfiguration. Currently, the preparation for that routine requires detection of subsystem version (1 or 2) and of graphical capabilities. But that might be require us to look into other aspects, like the default environment variables.
For now you can see the usage below:
from wsl-distrolauncher.
I am kind of thinking that mistake (probably). I may be wrong. As far as I can remember, the distributionVersion parameter does not reflect whether the distribution is in WSL1 or WSL2 environment. It reflects lxfs vs. wslfs, old topic.
This is undocumented but works. The wslDistributionFlags provides WSL1 vs WSL2. For WSL2, wslDistributionFlags has 0x08 flag or-ed.
from wsl-distrolauncher.
There should be an official way to detect whether wslg is enabled or not without executing any ELF binary or poking a file.
from wsl-distrolauncher.
I am kind of thinking that mistake (probably). I may be wrong. As far as I can remember, the distributionVersion parameter does not reflect whether the distribution is in WSL1 or WSL2 environment. It reflects lxfs vs. wslfs, old topic.
This is undocumented but works. The wslDistributionFlags provides WSL1 vs WSL2. For WSL2, wslDistributionFlags has 0x08 flag or-ed.
You are indeed right. Thanks for spotting my bug. Really appreciate it. Yet, just by the WSL_DISTRIBUTION_FLAGS_DEFAULT
constant I wouldn't be able to detect WSL2.
It would be nice if the API itself provided a function for that specific piece of information. Would the 0x08
trick be documented anytime or you guys consider it an internal detail?
from wsl-distrolauncher.
There should be an official way to detect whether wslg is enabled or not without executing any ELF binary or poking a file.
While I totally agree with you, I didn't find any better way other than inspecting sockets.
from wsl-distrolauncher.
I didn't find any better way other than inspecting sockets.
Wondering what that will be.
from wsl-distrolauncher.
I didn't find any better way other than inspecting sockets.
Wondering what that will be.
You can have a look if you want 😅
https://github.com/ubuntu/WSL/blob/9cc33befc0f8af1b837212aa5190d111cbfef273/DistroLauncher/WSLInfo.cpp#L79-L97
from wsl-distrolauncher.
O, I thought AF_VSOCK vs. AF_INET.
In my opinion, the /tmp/.X11-unix path is not only for wslg. A program may use AF_UNIX socket even in WSL1 or in WSL2 for X servers only (like vcxsrv). AF_UNIX was added in 17063 build of Windows 10 whereas WSL2 was added 18362 build.
from wsl-distrolauncher.
O, I thought AF_VSOCK vs. AF_INET.
In my opinion, the /tmp/.X11-unix path is not only for wslg. A program may use AF_UNIX socket even in WSL1 or in WSL2 for X servers only (like vcxsrv).
That sounds as interesting as challenging. AFAIK, AF_VSOCK would help to be sure I'm under WSL 2, but would it tell anything about WSLg? While I can ls -l /tmp/.X11-unix | grep wslg
, doesn't tell the whole story either, since it also appears mounted on WSL 1 instances. Besides the fact that it still feels a bit hacky to my taste.
Any great tip like the 0x08
for this one or should I just make my commands more strict?
from wsl-distrolauncher.
Related Issues (20)
- Wsl distrol luncher HOT 1
- 'HCS_E_HYPERV_NOT_INSTALLED': undeclared identifier HOT 3
- Building distro-launcher failing HOT 3
- Error:0x80070002 HOT 3
- Running build.bat builds both the x64 and ARM64 platforms HOT 1
- Cannot acquire developer license when installing sideload on another computer
- The root certificate of the signature in the app package must be trusted
- This repo is missing important files HOT 5
- Error code: Wsl/0x80070424
- WslRegisterDistribution failed with error: 0x80070057 HOT 1
- Solving building warnings
- Wrong output name for the message catalog
- Building on Linux / without Visual Studio?
- Is this maintained or planned to continue to be maintained?
- Use the windows user CN as WSL2 distro username HOT 1
- Unattended Install HOT 3
- MakeAppx : error : 0x80080215 HOT 3
- Custom Distro CI/CD build using github workflow HOT 1
- Add `BuildTools` and Visual Studio 2022 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wsl-distrolauncher.