Win32-OpenSSH
Win32-OpenSSH copied to clipboard
Unable to run commandline-based AppX (Store Apps)
"OpenSSH for Windows" version
((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)
7.7.2.3 (Installed through optional features)
8.1.0.0 (Installed manually)
Server OperatingSystem
((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName)
Windows 10 Pro (x64, 2004, 10.0.19041.329), freshly-installed from an ISO created with the Media Creation Tool yesterday, fully updated and no other software installed.
Client OperatingSystem Linux (Kubuntu 20.04)
What is failing I installed Python 3.8 through the Windows Store, expecting to be able to execute Python scripts remotely through ssh. Everything works fine on the machine itself (directly or over RDP) but the interpreter won't start over ssh. One or more log entries appear in Event Viewer\Applications and Services Logs\Microsoft\Windows\AppModel-Runtime\Admin in either case. I have tried both the OpenSSH server version bundled with Windows, and the latest 8.1.0.0p1-Beta release. I have not had them installed side-by-side.
Expected output Using cmd over RDP, both in regular and elevated prompts, in powershell as well:
C:\Users\Username>python3
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
or
C:\Users\Username>"c:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\python3.8.exe"
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Event log (excerpts):
Created Desktop AppX container 4c052416-bd27-11ea-9194-000c29ce0202 for package PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0.
Event ID: 210
Keywords: DesktopAppXContainer
User: SYSTEM
Added process 6184 to Desktop AppX container 4c052416-bd27-11ea-9194-000c29ce0202 for package PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0.
Event ID: 211
Keywords: DesktopAppXContainer
User: SYSTEM
Created process 6184 for application PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0!Python in package PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0. [FinishPackageActivation]
Event ID: 201
Keywords: DesktopAppXProcess
User: SYSTEM
EventData:
ProcessID 6184
PackageName PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0
ImageName python3.8.exe
ApplicationName PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0!Python
Message [FinishPackageActivation]
Actual output Using cmd over ssh:
username@MACHINENAME C:\Users\Username>python3
The system cannot execute the specified program.
or
username@MACHINENAME C:\Users\Username>"c:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kf
ra8p0\python3.8.exe"
Access is denied.
Event log (excerpts):
0x5200000: Cannot create the process for package because an error was encountered. 耇[GetPackageToken]
Event ID: 202
Keywords: DesktopAppXProcess
User: SYSTEM
EventData:
PackageName
ImageName 邅翹
ApplicationName L>
ErrorCode 85983232
Message 耇[GetPackageToken]
Note the Chinese/garbled characters here as opposed to the cmd over RDP case.
Using powershell over ssh:
PS C:\Users\Username> python3
Program 'python3.exe' failed to run: The file cannot be accessed by the systemAt line:1 char:1
+ python3
+ ~~~~~~~.
At line:1 char:1
+ python3
+ ~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
or
PS C:\Users\Username> & "c:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\python3.8.e
xe"
Program 'python3.8.exe' failed to run: Access is deniedAt line:1 char:1
+ & "c:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ & "c:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
Event log shows the same as cmd over ssh, but three times (all identical) in the same second instead of once.
Oddity Maybe interesting is that the Chinese/garbled characters in the Event Log are identical for each log entry in the same boot, even when changing OpenSSH versions (without reboot), restarting OpenSSH or reconnecting to it, also with different user accounts. After a reboot, the characters remain the same in all EventData fields except for ImageName, which gets different characters. Seems to be some uninitialised, though constant, buffer or pointer. None of the fields have garbled characters when starting python successfully (i.e. over RDP).