×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Running KStars/Ekos on a desktopless remote computer

  • Posts: 269
  • Thank you received: 53
Running KStars/Ekos on a desktopless remote computer

So you want to run KStars/Ekos/INDI all on one small computer, like a Raspberry Pi, connecting via network, but it is a bit low on power.
One option I'd like to explore is to install a server only OS, like Ubuntu Server, to remove the overhead of a desktop environment.

But how can you run a GUI program like KStars/Ekos without a GUI desktop? Well it turns out there are a few ways to go:
One is to do something like I did with WSL at indilib.org/forum/ekos/8596-re-re-re-re-...m-for-linux-wsl.html
But the problem with that is that if you lose network connection then KStars/Ekos closes down - not good.

I tried a few other options but the best I've found so far is a tool called xpra.: xpra.org/
You install xpra on both the remote computer at the scope and the local one you want to work from. A bit like VNC. xpra on the remote computer creates a kind of dummy display (xvfb or X virtual frame buffer for the techincally minded) that receives the KStars/Ekos screens. On the locl computer you run xpra to connect to that remote dummy display. If you lose network connection, KStars/Ekos keeps running on the dummy display and you can reconnect to it. The nice thing is that, unlike with VNC, each window on the remote computer shows up as a separate window on the local computer and you can rearrange them just as if they were running locally.

Other approaches I tried were:
Use x11vnc which can also utilise the same dummy display (also xvfb) and you connect to it with the familiar VNC n the local computer. So far I have found that only returns the current window so its hard to work with. This may be down to some program options but needs more investigation.
Use a lightweight window manager like fluxbox and once again the dummy display (xvfb again). This also uses VNC across the network and provides a kind of desktop bakground. But as with the x11vnc option, sofar I can only see one window at a time. It may also be possible to use xpra with fluxbox but I have not got that to work yet.

The instructions for using xpra are quite confusing. Especially if your local computer is Windows as it is not as easy to use as the Mac and Linux verions. On Windows you also need to install an X Server e.g. vcXsrv, Xming, X410

The most useful instructions for xpra are here: wiki.archlinux.org/index.php/Xpra

Basically you start xpra on the remote computer (e.g. through an SSH session) and associate a dummy display with it.
You can then start a GUI program using that dummy display (again - possible through SSH)
You can alternatively start a Windows Manager (e.g. screen) on that dummy display and run individual programs within the windows manager
On the local machine run xpra to attach to the remote dummy display. On Windows, Xpra runs as a popup window. It can also run on command line but needs the full path
You can detach and attach again to the remote display as often as you like
You can close KStars and open other GUI programs on the remote dummy display as often as you like
When you finally stop xpra, any programs using the dummy display that are still running are stopped

Picture shows a Windows display with KStars/Ekos running on a RPi3. The browser in the background is running on Windows as is the Xpra popup
The following user(s) said Thank You: Brian
3 years 2 months ago #67604
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 269
  • Thank you received: 53
I've dived in a bit deeper and found how to imrpove running xpra from a Windows environment. Like most things there are many ways to skin the cat.
First up was how to make it easier to work across SSH which requires a password every time you connect. The answer is to set up a key pair with ssh-keygen. This creates a private key file (id_rsa) and a public key file (id_rsa.pub) in the .ssh folder under your userid's home folder. You append the public key to the "authorized_keys" file on the remote machine which is also under the .ssh folder. When that is done you can login without a password.
Since things are generally harder to do on Windows than elsewhere, here is how to do that on Windows client using PowerShell. Replace <userid> with the userid on the remote machine and <ip address> with its IP Address. For this operation you will need to enter the password on the remote machine - for the last time if it works properly.

ssh-keygen -t rsa -b 2048
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh <userid>@<ip address> "cat >> .ssh/authorized_keys"
ssh <userid>@<ip address>

Now you can start xpra and run any gui programs you like and have them show up as windows on your Windows computer as if they were running locally. I recommend to specify which X Display to use and prefer to use the command line as it seems more reliable and certainly gives you more control. I use xeyes and xclock as simple examples of GUI apps you can install with.

sudo apt-get install x11-apps

Here is a typical sequence of commands run from PowerShell

#Start an xpra session on display :100
ssh <userid>@<ip address> "xpra start :100"

# Attach to display :100. Note the & needed by PowerShell. You
& 'C:\Program Files\xpra\xpra.exe' attach ssh:<userid>@<ip address>:100

# Start the xeyes program on display :100. It shows up on Windows
ssh <userid>@<ip address> "DISPLAY=:100 xeyes"

# Start the xclock program on display :100. It shows up on Windows
ssh <userid>@<ip address> "DISPLAY=:100 xclock"

# Detach from display :100. You can attach again any time and the remote programs continue running
& 'C:\Program Files\xpra\xpra.exe' detach ssh:<userid>@<ip address>:100

# Stop xpra on display :100. This stops any programs running on that display
ssh <userid>@<ip address> "xpra stop :100"

If you can do these things in a command line it is then relatively simple to set up a script to run them.
3 years 1 month ago #67728

Please Log in or Create an account to join the conversation.

Time to create page: 0.199 seconds