5

Is it somehow possible to run minecraft-pi on a headless RPi using ssh -X? I had to add my user to the video group, but then I could start it via ssh, but all I get is a black, non-responsive window on the SSH client.

How may I get to play minecraft-pi on a headless RPi using ssh -X?

boolean.is.null
  • 175
  • 1
  • 6

3 Answers3

3

It's not possible using ssh-x. It's like trying to watch a video on a terminal. Terminals are text-only.

You could, however, install a VNC server as suggested by some comments. This way, you can have a desktop and use the pi without a monitor (the experience is similar to TeamViewer).

EDIT: I think I have tried this before, both ssh -x and VNC. Yes, I also got a blank Minecraft window. I think this is the case because Minecraft somehow makes the GPU draw directly on-screen (aka overlay). Because of that, your game session would be visible on a monitor if you have one plugged in but not on your terminal/vnc session.

X would see everything that's going on, but not the overlay since it's drawn directly on-screen. That's why you can see the window but not the dirt blocks.

EDIT: After a bit of research, I found these. We almost said the exact thing:

Aloha
  • 7,176
  • 1
  • 29
  • 52
2

The prior answers to this question were written as early as 2015, before Raspbian's introduction of the open-source driver.

On a Pi 2 or higher, run:

sudo raspi-config

and enable the OpenGL desktop (Mesa) driver under Advanced Options -> GL Driver. Note that on a Pi 4, OpenGL with Fake KMS is already the default configuration.

When the Legacy driver has been disabled, the helper script at /usr/bin/minecraft selects Mesa via an injected library in /opt/minecraft-pi/lib/mesa.

ssh -X then works as expected to play Minecraft Pi Edition remotely. Moreover, this achieves higher remote framerates compared to RealVNC's experimental direct capture mode.

Despite comments saying the contrary, use of ssh -X does not require an X session to be running on the Pi server. A session is needed only on the client which may be a Linux x86 or even Windows PC, another advantage over VNC.

jdonald
  • 2,972
  • 14
  • 39
1

Although you can't do it with ssh or with tightvnc, RealVNC have released an alpha version that gets around this. On your Pi do:

curl -OL https://github.com/RealVNC/raspi-preview/releases/download/5.3.1.18206/VNC-Server-5.3.1-raspi-alpha1.deb
sudo dpkg -i VNC-Server-5.3.1-raspi-alpha1.deb

To run VNC Server in Service Mode:

sudo systemctl start vncserver-x11-serviced.service

To have VNC Server start automatically when you power the Pi on:

sudo systemctl enable vncserver-x11-serviced.service

Create a file in /home/pi/.vnc/config containing -geometry 1280x720 to set the window size.

Download the viewer for Windows https://www.realvnc.com/download/viewer/

To make the most of VNC Server's hardware acceleration, configure VNC Viewer in the following way:

  • Run VNC Viewer and connect to the Raspberry Pi.
  • On the VNC Viewer toolbar, click the Options button. Click Advanced..., then the Expert tab.
  • Set PreferredEncoding to JPEG
  • AutoSelect to False
  • ColorLevel to Full.
opticyclic
  • 215
  • 3
  • 8