@samitouri / QOSAMI-WSL / commits / 7741740f

Add back WSL2_VM_ID environment varialbe to the system distro. (#13835)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>

Ben Hillis committed Dec 5, 2025 at 15:06 UTC 7741740f871fca8731c4987c5ae44e76d02a65d3
1 file changed +10 -1
src/linux/init/init.cpp
+10 -1
@@ -2258,7 +2258,16 @@ Return Value:
2258 if (Value != nullptr)
2259 {
2260 Config.VmId = Value;
2261 - unsetenv(LX_WSL2_VM_ID_ENV);
2261 +
2262 + //
2263 + // Unset the environment variable for user distros.
2264 + //
2265 +
2266 + Value = getenv(LX_WSL2_SHARED_MEMORY_OB_DIRECTORY);
2267 + if (!Value)
2268 + {
2269 + unsetenv(LX_WSL2_VM_ID_ENV);
2270 + }
2271 }
2272
2273 //