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
Store WSL isn't accessible from Session 0 #9231
Comments
|
I think this issue is already tracked internally.
https://learn.microsoft.com/en-us/windows/wsl/store-release-notes#known-issues |
|
Known issue, we're working on a solution. |
|
This is a deal breaker for some. Would be nice to get notice when it is solved. Thanks! |
|
Please fix this - I cannot remotely login to WSL using the builtin OpenSSH server, my scheduled tasks also stopped working. |
I had to uninstall store version of WSL to be able to run ssh server at system startup again |
|
If policies make it difficult to enable Windows openssh to run WSL, an alternative/workaround might be to run a second openssh server (using a different port) within WSL. At the moment this seems not to be possible. But maybe that possibility can be enabled? |
|
I am surprised by this. By default, I can access wsl from the native OpenSSH server by setting My problem is actually this: every time I initiate a SSH connection, I get a new WSL shell. I am unable to return back to the same session in case of disconnection events; all my background processes are gone. Each connection is therefore a new WSL instance. Should I open another ticket for this ? |
I've tried it back and forth on different installs several times, and it never worked. It's a few months ago - should it be fixed and noone here knows? Many have the issue, and it's even acknnowledged by MS... Weird!
I don't think so: interrupted ssh sessions are like logoffs, like closing a terminal emulator (historically speaking closing a terminal emulator is like logging off ;-) ) - you wouldn't expect to get your jobs back there, right... You want to look into tmux or something alike. They keep processes running wile you're off, and you can attach back to them from another shell... |
This looks weird indeed. Let me know if any of you would like more details. I just installed the "Ubuntu" app in the store using a local account.
It's exactly that! I don't find my tmux sessions when I log back in. In fact, I don't find the tmux process at all! |
I have no experience with tmux in WSL, so I can't comment from experience. But I'd think about whether your WSL - instance keeps running all the time, or wheter it has had a "reboot" in your time off - even tmux doesn't survive that ;-) Though maybe it can be made to autostart and continue processes? Dunno. I know that WSL's wakeup behavior from suspend is broken (it was in my version) - maybe another reason why tmux might vanish? Or maybe you need to start your tmux processes in a local shell and let that run? Maybe you can then attach to running tmux from ssh and not shut WSL down by logging off? And just to let others know: I did install the MS Store update again, and was immediately cut out of ssh-ing in. Fortunately it is enough to uninstall via the App-Icon that appears after the update, and the previous state returns... (i.e. no total reinstall of WSL required) And yes, if I started tmux in a local shell and kept it running, I can ssh in and out multiple times and see that tmux live on happily... Final remark for others like me who didn't realize (what for again others is likely self-evident): if it's just about ssh-ing into a running WSL from the outside (i.e. not about actually "booting" wsl): that is possible with the store version of wsl too. You access the host into a shell that doesn't depend on wsl, and from there you ssh into the running wsl: |
|
As @bagong mentioned it is possible to install and run a second OpenSSH server (using a different port) in your WSL instance as a workaround. This can then be combined with using the Host openssh_win32
Hostname your_computer.local
User windows_username
Host openssh_wsl
ProxyJump openssh_win32
User wsl_username
HostName localhost
Port 2222The above example assumes that the second OpenSSH server in wsl is running on port 2222. Using this configuration it is then possible to connect to the wsl instance via the hostname ssh openssh_wsl |
|
While it is possible to get inside the WSL instance based on the proxy jump idea from @joes, this issue still needs to be fixed for use cases such as attempts to install a new WSL distribution on a remote Windows system over SSH. In other words anything involving the WSL executable besides getting into an instance. |
|
My use case is accessing WSL remotely after a cold boot. I can turn on the PC remotely via WOL and SSH into a win32 OpenSSH server, but cannot start WSL from said SSH connection (session 0). Nor is it possible to start WSL automatically on boot before a user logs in to Windows (also session 0?). For example, you cannot use Task Scheduler's "Run whether user is logged on or not" option to start My workaround has been to use RDP just to login remotely and start WSL (which is started automatically on user login by Task Scheduler). Then I can SSH directly into WSL. Does anyone know of a solution for either remotely initiating a Windows user login or remotely obtaining session 1 without the GUI overhead of the RDP/Remote Desktop app? Ideally command-line only. |
|
@yo1dog In an entirely different context, I know of a solution (batch file) that runs from the command line with GUI overhead, but:
This batch file uses openssl, sed to obtain, mangle and register the cert hash for a given server to avoid that cert warning. On the server, I place a different batch file in the Startup folder (your idea uses Task Scheduler). This could use the timeout command to sleep for a bit, and then logoff from the server (to gracefully terminate the RDP client) after your WSL instance has started.
To avoid OOB prompts, this needs to run even before the logon: For the script to be run at logon, I believe you already have one.
|
|
@benhillis Has the team made any progress on this issue? And if not is there any quick fix to make this work? |
|
Also curious here - this is a bit painful, can't execute a WSL (bash) script from a service (Session ID 0). Thanks! |
Trying this! 😆. This is the one that gives me the error, Not running it from Task Scheduler, rather telegraf (service) is calling it. Different for some reason? FYI, just tried updating again, but see ... Thanks! |
|
@arrmo: Could you share the log file please ? I'd be curious to see why the installation failed on your machine. |
|
Absolutely! Here you go, Let me know if you want me to try anything ... and of course, how to get past the ACCESSDENIED error when running wsl from telegraf 😄 Thanks! |
|
@arrmo: You're hitting the elevation issue: Error 1925. You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator and then retry this installation. Running wsl --update as administrator should solve the issue. |
|
That was it - thanks! My bad ... I thought I was, wrong window 🤣. Hmm - wondering if that's somehow related to my telegraf issue (and ACCESSDENIED)? The service runs as Local System Account ... thinking that should be fine? |
|
And that's it! Service was running as Local System Account ... manually changed it, to my account => works now. Nice! Thanks for the pointers! |
|
When I run WSL 2.0.2 from the local system account it shows So, running WSL as a service (or task scheduler job) under the local system account is apparently out of the scope of this fix. The supported scenario is to run WSL under a regular user account in session 0. I can confirm, with WSL 2.0.2, I am able to create a task scheduler job that runs WSL without a user being logged on to the desktop. In our scenario, we run WSL GitHub runners on Windows Server VMs, which can now successfully start up automatically using the user account of a technical user (i.e. using the option $trigger = New-ScheduledTaskTrigger -AtStartup
$trigger.Delay = "PT60S"
$action = New-ScheduledTaskAction -Execute "C:\Program Files\WSL\wsl.exe" -Argument "-- /bin/bash -i ~/runners/some-runner/actions-runner/run.sh"
Register-ScheduledTask -TaskName "Start WSL GitHub Runner" -User "some-user" -Password "some-password" -Action $action -Trigger $triggerThanks for making this work, @OneBlue! |
Just to make sure I understand 🤣. So you see the same as I noted above - you can't run this as a Local System Account, rather it has to be a "defined" user ... correct? Do we know if a fix is coming for this? Thanks! |
|
I switched from C:\Windows\System32\wsl.exe to "C:\Program Files\WSL\wsl.exe" for the Task Scheduler task. The Ubuntu-22.04 instance still starts up "At system startup", but when I use the psexec64.exe command "C:\PSTools\PsExec64.exe -i runas /profile /env /user:username c:\windows\system32\cmd.exe", and run "wsl -l -v", it reports that the instance is "Stopped". When I use C:\Windows\System32\wsl.exe for the Task Scheduler task, and run the psexec64.exe command and "wsl -l -v", it reports that the instance is "Running". I'm really confused what is happening with it. |
|
I would like to report that updating from 2.0.0 to 2.0.3 resulted in WSL disappearing from File Explorer and all my pinned directory pointing to WSL 9p share wiped :( |
|
For those who wan't to use WSL on a jenkins windows agent, here is my workaround. Instead of connecting via a task scheduler to the jenkins controller, after the startup of the machine, I have a jenkins job running on a linux agent, which initiates a remote desktop connection to the windows agent. In the windows task scheduler I have a task, which is started whenever a remote connection is made. This is then able to start the jenkins agent under a normal session, where wsl does in fact work. The pipeline looks something like this: |
|
From my side, seems like upgrading to wsl 2.0.6 (through My setup :
(Will try other tests, but it's encouraging !) |
|
OK, this is really screwy. I previously ran Thanks! |
@arrmo Are you running in an elevated terminal? There is more than one |
Yep! Very odd ... but I had to |
See microsoft/WSL#9231 (comment) for details
See microsoft/WSL#9231 (comment) for details
|
Is there any progress on this issue? I still can't use wsl with ssh |
Just to precise my answer : I found that this seems to work on all W11 workstation but only on some W10 ones. So the issue seems not resolve for every configurations 😒 |
I run WSL 版本: 2.0.9.0
内核版本: 5.15.133.1-1
WSLg 版本: 1.0.59
MSRDC 版本: 1.2.4677
Direct3D 版本: 1.611.1-81528511
DXCore 版本: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows 版本: 10.0.22621.2715but this problem still exists. |
|
This is my setup: I tried:
What actually WORK for me:
|
|
@litian1992 upgrading to 2.0.11 and executing still, there's use-case that is not working here. using an ssh client from linux to remotely invoke wsl as |
|
@rgl New install after upgrade to 2.0.11 works fine with microsoft ssh server - 2.0.9 does not work. Connecting from Linux with |
|
@montvid ah, without |
|
Here is a summary of a method I've been experimenting with to access WSL remotely via SSH, particularly effective post-reboot. Hopefully, this might be helpful for others:
|
Version
Multiple versions are affected
WSL Version
Kernel Version
No response
Distro Version
No response
Other Software
No response
Repro Steps
Store WSL currently isn't accessible from session 0 contexts.
This means that it's not possible to interact with WSL from remote sessions such as ssh or psremote.
If wsl.exe is called from session 0, it will exit and display:
on stdout.
The text was updated successfully, but these errors were encountered: