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?

9
  • I don't know about ssh -X but I know you can use vnc. Commented Dec 5, 2015 at 21:13
  • Doesn't the RPI need a running X for vnc to work? Commented Dec 5, 2015 at 21:14
  • There's a X-server running on the machine that dials into the Pi?
    – Ghanima
    Commented Dec 5, 2015 at 21:21
  • I'm not exactly sure how it works, the Raspberry Pi Organization has a page on the topic here: raspberrypi.org/documentation/remote-access/vnc Commented Dec 5, 2015 at 21:21
  • Since vnc only relays the graphical screen of the host to the client, it would be in need of x running on the Pi.
    – Ghanima
    Commented Dec 5, 2015 at 21:23

3 Answers 3

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:

8
  • I don't know whether I was not clear or if you don't know the ssh -X option. This allows the GUI to be displayed on the ssh client. If in the ssh -X session a graphical window is opened, it is opened on the client, as a new window, NOT in the terminal. Commented Dec 6, 2015 at 12:18
  • 1
    fyi, ssh -x needs X running on both machines for it to work @boolean.is.null
    – Aloha
    Commented Dec 6, 2015 at 12:29
  • @boolean.is.null The VNC software on the pi will take care of running a virtual X session for you. You don't need to mess around with X. All you have to do is connect.
    – Aloha
    Commented Dec 6, 2015 at 12:30
  • well, I'm afraid I don't understand my situation then. I don't have X running on the RPi, but the ssh -X session, gives me a working GUI on the client, for instance when I run leafpad. I'll try to get the VNC server running, thanks. Commented Dec 6, 2015 at 13:18
  • @boolean.is.null 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. 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.
    – Aloha
    Commented Dec 6, 2015 at 13:41
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.

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.
1
  • 1
    Note that this answer is now outdated. The latest version of RealVNC Server (which is installed by default in Raspbian) includes the direct capture feature, and doesn't require any special configuration to be done on the VNC Viewer. All you need to do to enable it is tick "Experimental direct capture mode" in the Server options under "Troubleshooting". Commented Nov 15, 2017 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.