Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 2 tasks
hipengwen opened this issue Dec 26, 2022 · 6 comments
Open
1 of 2 tasks

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

hipengwen opened this issue Dec 26, 2022 · 6 comments
Labels

Comments

@hipengwen
Copy link

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

@pmartincic
Copy link
Collaborator

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

@hipengwen
Copy link
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

@ghost ghost removed the needs-author-feedback label Dec 30, 2022
@ygqygq2
Copy link

ygqygq2 commented Jan 13, 2023

Facing the same issues. But we can try this.
https://askubuntu.com/questions/1435938/is-it-possible-to-run-a-wsl-app-in-the-background

@pmartincic
Copy link
Collaborator

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

Can you show the output of ps -auxf? If the process in question is not parented to relay init (Pid 564 in my case) then it will not keep the distro alive.

image

@jw-redpanda
Copy link

jw-redpanda commented May 4, 2023

@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

@haoenz
Copy link

haoenz commented Sep 21, 2023

Will this fix in version 2.0.0 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants