Skip to content

wsl doesn't keep running in background after closing window #9401

Closed

Description

@hipengwen

Version

Microsoft Windows [版本 10.0.25267.1000]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.15.79.1

Distro Version

Ubuntu

Other Software

WSL 版本: 1.0.3.0
内核版本: 5.15.79.1
WSLg 版本: 1.0.47
MSRDC 版本: 1.2.3575
Direct3D 版本: 1.606.4
DXCore 版本: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows版本: 10.0.25267.1000

Repro Steps

After closing the wsl window

Expected Behavior

ubuntu stops working after closing the window

K1650CPN) )B`F9(F5@{$R0

Actual Behavior

no

Diagnostic Logs

No response

Activity

  1. hipengwen commented on Dec 30, 2022

    @hipengwen
    Author

    Howdy. Do you have any daemonized processes running inside wsl? If not then this looks like expected behavior to me.

    There is a docker daemon running.

    HZR30O7$ 2)SP{{KK6N89ND

  2. jw-redpanda commented on May 4, 2023

    @jw-redpanda

    hipengwen Can you try the below?

    I have several WSL2 environments, using a startup script will autorun the WSL2 Ubuntu instance and it will keep running in the background.

    Put a cmd script file, e.g. startwsl.cmd in the Windows startup folder.
    (For Windows 10/11, press WIN+R, enter shell:startup.)

    :: This keeps a process running under init
    wsl bash -c "nohup bash -c 'while true; do sleep 1h; done &' &>/dev/null "
    timeout /t 3
    

    WSL2 version info

    WSL version: 1.2.5.0
    Kernel version: 5.15.90.1
    WSLg version: 1.0.51
    MSRDC version: 1.2.3770
    Direct3D version: 1.608.2-61064218
    DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows version: 10.0.22621.1555
    
  3. haoenz commented on Sep 21, 2023

    @haoenz

    Will this fix in version 2.0.0 ?

  4. OneBlue commented on Mar 26, 2025

    @OneBlue
    Collaborator

    Thank you for patience !

    This is solved by 2.5.4.

    Setting:

    [general]
    instanceIdleTimeout=-1
    

    in .wslconfig

    Will prevent WSL distributions from timing out

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions