I am trying to start xrdp from Windows with the method described here, but when I run the command wsl sudo service xrdp start, xrdp doesn't start up properly. Running service xrdp statusas my linux user returns
* could not access PID file for xrdp-sesman * xrdp is not runningand I can't connect via RDP. Running wsl -u USER sudo service xrdp start gives me the same result. How can I fix this and run the service properly?
1 Answer
The problem is xrdp service init script does not detach stdout before returning and once wsl.exe exits, it closes all pipes which terminates the script.
Straightforward *nix tool for this problem is nohup, but it redirects output to file.
>wsl nohup sudo service xrdp start
nohup: ignoring input and appending output to 'nohup.out'Somewhat weird workaround I've found is passing command output to cat which prevents premature termination of script and passes output.
wsl bash -c "sudo service xrdp start |cat"In the end I resorted to a script in the external file. However, it can be written in one line. Fortunately, cmd passes everything to bash in this line.
wsl sudo service xrdp start; until service xrdp status; do sleep 1; done 1