From 19339205d42a3177709ba346c33ca27d63746351 Mon Sep 17 00:00:00 2001 From: Shuo Li <240384561@qq.com> Date: Sat, 11 Jul 2026 18:53:24 +0800 Subject: [PATCH 1/2] Start the plan9 server on WSL2 even when automount and mountFsTab are disabled The (AutoMount || MountFsTab) guard exists because on WSL1 the plan9 socket file lives on a DrvFs mount. WSL2 serves over an hvsocket and never uses the socket path, so the guard unintentionally disabled \\wsl.localhost access for distros with both options turned off. Fixes #41056 --- src/linux/init/config.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/linux/init/config.cpp b/src/linux/init/config.cpp index 93a87a1d45..8a17d303e8 100644 --- a/src/linux/init/config.cpp +++ b/src/linux/init/config.cpp @@ -845,16 +845,21 @@ try } // - // Run the Plan 9 server. This requires a DrvFs mount for the socket file, - // so either fstab or automount must be enabled to have a chance for the - // mount to be available. - // - // N.B. Failure to start the server is non-fatal. - // - - unsigned int Plan9Port = LX_INIT_UTILITY_VM_INVALID_PORT; - if ((WI_IsFlagClear(Config.FeatureFlags.value(), LxInitFeatureDisable9pServer)) && (Config.Plan9Enabled) && - (Config.AutoMount || Config.MountFsTab)) +// +- // Run the Plan 9 server. This requires a DrvFs mount for the socket file, +- // so either fstab or automount must be enabled to have a chance for the +- // mount to be available. ++ // Run the Plan 9 server. On WSL1 this requires a DrvFs mount for the socket ++ // file, so either fstab or automount must be enabled to have a chance for ++ // the mount to be available. WSL2 serves over an hvsocket and has no such ++ // dependency. + // + // N.B. Failure to start the server is non-fatal. + // + unsigned int Plan9Port = LX_INIT_UTILITY_VM_INVALID_PORT; + if ((WI_IsFlagClear(Config.FeatureFlags.value(), LxInitFeatureDisable9pServer)) && (Config.Plan9Enabled) && +- (Config.AutoMount || Config.MountFsTab)) ++ (UtilIsUtilityVm() || Config.AutoMount || Config.MountFsTab)) { std::tie(Plan9Port, Config.Plan9ControlChannel) = StartPlan9Server(Plan9SocketPath, Config); } From 228a5e030bbbace4e66af78eb62c2c05911e27a9 Mon Sep 17 00:00:00 2001 From: Shuo Li <240384561@qq.com> Date: Sat, 11 Jul 2026 19:02:04 +0800 Subject: [PATCH 2/2] Refactor comments for Plan 9 server setup Updated comments for clarity regarding Plan 9 server requirements on WSL1 and WSL2. --- src/linux/init/config.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/linux/init/config.cpp b/src/linux/init/config.cpp index 8a17d303e8..19dfb77a59 100644 --- a/src/linux/init/config.cpp +++ b/src/linux/init/config.cpp @@ -845,21 +845,16 @@ try } // -// -- // Run the Plan 9 server. This requires a DrvFs mount for the socket file, -- // so either fstab or automount must be enabled to have a chance for the -- // mount to be available. -+ // Run the Plan 9 server. On WSL1 this requires a DrvFs mount for the socket -+ // file, so either fstab or automount must be enabled to have a chance for -+ // the mount to be available. WSL2 serves over an hvsocket and has no such -+ // dependency. - // - // N.B. Failure to start the server is non-fatal. - // - unsigned int Plan9Port = LX_INIT_UTILITY_VM_INVALID_PORT; - if ((WI_IsFlagClear(Config.FeatureFlags.value(), LxInitFeatureDisable9pServer)) && (Config.Plan9Enabled) && -- (Config.AutoMount || Config.MountFsTab)) -+ (UtilIsUtilityVm() || Config.AutoMount || Config.MountFsTab)) + // Run the Plan 9 server. On WSL1 this requires a DrvFs mount for the socket + // file, so either fstab or automount must be enabled to have a chance for + // the mount to be available. WSL2 serves over an hvsocket and has no such + // dependency. + // + // N.B. Failure to start the server is non-fatal. + // + unsigned int Plan9Port = LX_INIT_UTILITY_VM_INVALID_PORT; + if ((WI_IsFlagClear(Config.FeatureFlags.value(), LxInitFeatureDisable9pServer)) && (Config.Plan9Enabled) && + (UtilIsUtilityVm() || Config.AutoMount || Config.MountFsTab)) { std::tie(Plan9Port, Config.Plan9ControlChannel) = StartPlan9Server(Plan9SocketPath, Config); }