The pi is configured to start into text mode so that no xorg libraries are loaded during normal operation. Yet I would like to be able to occasionally run an xorg desktop session when connected to an HDMI display.

I already have enabled HDMI display with:


The HDMI screen is working in text mode. I have no keyboard connected to the pi and therefore would like to control it via ssh which is already working.

I tried starting the xorg session via ssh with startx -- -layout HDMI but this did not work for obvious reasons, since xorg is not gonna run through a ssh connection.

So the question is how to start xorg on the physical HDMI display via an ssh connection?

Running e.g.

startx -- vt7

results in the following error:

(EE) xf86OpenConsole: Cannot open virtual console 7 (Permission denied)

Using export DISPLAY=:0.0 did not make any difference.

I am currently using the workaround of changing the boot type using sudo raspi-config > Boot Options > Desktop GUI but would like to be able to start xorg on-demand via an ssh session.

  • what happens if you run startx when you're logged in with ssh?
    – Dirk
    Sep 15, 2018 at 12:43
  • it fails with an error message
    – ccpizza
    Sep 15, 2018 at 12:52
  • an error message What error message?
    – Dirk
    Sep 15, 2018 at 13:27
  • added error message to the question
    – ccpizza
    Sep 16, 2018 at 0:25

1 Answer 1


Given that you have no keyboard, I assume you want to run X for some specific program, other than a login screen. Specify that program as an argument to xinit, for example run xinit /usr/bin/chromium.

  • I want to run the full-blown desktop and use some kind of virtual onscreen keyboard which I can operate with a USB mouse. The temporary workaround I'm using is running raspi-config and enabling passwordless xorg autostart but that loads xorg unconditionally on every boot..
    – ccpizza
    Sep 15, 2018 at 13:00
  • in fact, found a working onscreen keyboard: apt-get install matchbox-keyboard
    – ccpizza
    Sep 15, 2018 at 13:17
  • Can you xinit your window manager? Sep 15, 2018 at 19:42
  • not when I am connected via ssh
    – ccpizza
    Sep 15, 2018 at 20:53
  • Can you please provide details of the command and the corresponding error message? Sep 15, 2018 at 22:41

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.