Skip to content

wsl mount not working properly anymore in WSL #8611

Closed

Description

@Seeky90

Version

Version 10.0.22000.739

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.102.1

Distro Version

Ubuntu-20.04

Other Software

WSL Version 60.0 and higher

Repro Steps

In the past it was possible to run tasks for WSL in the task scheduler. You could tell powershell to restart your vmcompute (Necessary for me due to some domain policy causing WSL not being accessible upon boot).

Also I have created a part that runs wsl --mount \.\PHYSICALDRIVE1 --partition 2 --name data

For simplicity follow these repro steps:
Create a task scheduler task:

<?xml version="1.0" encoding="UTF-16"?> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2022-02-17T07:48:10.6191908</Date> <Author>username</Author> <URI>\test</URI> </RegistrationInfo> <Triggers /> <Principals> <Principal id="Author"> <UserId>S-1-5-21-2139355670-3375578443-2995265674-8217</UserId> <LogonType>InteractiveToken</LogonType> <RunLevel>HighestAvailable</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>C:\Windows\System32\wsl.exe</Command> <Arguments>--shutdown</Arguments> </Exec> <Exec> <Command>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</Command> <Arguments>-windowstyle hidden -ExecutionPolicy Bypass C:\Users\username\test.ps1</Arguments> </Exec> </Actions> </Task>

Add into the Powershell script C:\Users\username\test.ps1:
wsl --mount \\.\PHYSICALDRIVE1 --partition 2 --name data

Expected Behavior

It is expected that the partition is mounted at /mnt/wsl/data.

Actual Behavior

Instead sometimes the partition is mounted at /mnt/wsl/PHYSICALDRIVE1 even though the script has successfully been run.

This happens since WSL Version 0.60.0
Before this did not happen.

Diagnostic Logs

No response

Activity

  1. benhillis commented on Jul 19, 2022

    @benhillis
    Member

    @owenschupp - can you please take a look?

  2. Seeky90 commented on Jul 20, 2022

    @Seeky90
    Author

    I have run some deeper analysis with some logging and discovered that before the two updates my WSL also was kept alive when running the SSHD server and CRON. Now it seems like the process is somehow terminated after some minutes and my WSL is shut down, so when I open it I get a fresh instance. That's not what I want.

    Now the weird thing is that sometimes the WSL instance keeps running without having any Terminals open.
    What could cause the issue that WSL is suspended despite running tasks?

  3. microsoft-github-policy-service commented on Jan 23, 2025

    @microsoft-github-policy-service
    Contributor

    This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions