vk4tec
Posts: 131
Joined: Thu Mar 07, 2013 9:05 am
Location: Brisbane QLD
Contact: Website

Sending a display from SSH

Tue Mar 06, 2018 6:05 pm

Does anyone know how to start up a program and send it to display 0 ?

I can SSH into the pi

I have a HDMI screen connected

I want to start say a browser but have it come up in display 0

Andrew
---------------------------------
Andrew Rich
email: [email protected]
http://www.tech-software.net/ ( hobby website )
http://59.167.159.165/ ( Raspberry Pi ADS-B server ) RTL SDR

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5116
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 6:41 pm

vk4tec wrote:
Tue Mar 06, 2018 6:05 pm
Does anyone know how to start up a program and send it to display 0 ?
I can SSH into the pi
I have a HDMI screen connected
I want to start say a browser but have it come up in display 0
Andrew
I'm not quite sure what you mean by "send it to display 0". What you can do, if using something like PuTTY to login to a Pi via SSH from another (Linux) computer that supports X-Windows is enable X-Forwarding in PuTTY**. In that situation any GUI-based program can/will display on the remotely logged in m/c. (I do this quite regularly from my Debian 8 PC**** w/o using full VNC methods). Of course you could use full VNC methods:
http://www.cpmspectrepi.uk/raspberry_pi ... Pixel.html (see the blog archive for more up to date info: https://www.raspberrypi.org/blog/archive/ )
Trev.
** FWIW some (old) notes here: http://www.cpmspectrepi.uk/raspberry_pi ... aspPi.html
**** Some PuTTY screenshots for three Pi's on said PC here: http://www.cpmspectrepi.uk/raspberry_pi ... iPiTV.html
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

vk4tec
Posts: 131
Joined: Thu Mar 07, 2013 9:05 am
Location: Brisbane QLD
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 6:44 pm

In LINUX or UNIX you can specify a destination such as display :0

Andrew
---------------------------------
Andrew Rich
email: [email protected]
http://www.tech-software.net/ ( hobby website )
http://59.167.159.165/ ( Raspberry Pi ADS-B server ) RTL SDR

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 7:12 pm

vk4tec wrote:
Tue Mar 06, 2018 6:05 pm
Does anyone know how to start up a program and send it to display 0 ?

I can SSH into the pi

I have a HDMI screen connected

I want to start say a browser but have it come up in display 0

Andrew

Code: Select all

DISPLAY=:0 chromium-browser
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

fbe
Posts: 529
Joined: Thu Aug 17, 2017 9:08 pm

Re: Sending a display from SSH

Tue Mar 06, 2018 7:20 pm

Code: Select all

DISPLAY=:0 chromium-browser
It works if you ssh into the Pi as user pi and your Pi boots into desktop with automatic login as user pi (which is the default).

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Sending a display from SSH

Tue Mar 06, 2018 7:28 pm

fbe wrote:
Tue Mar 06, 2018 7:20 pm

Code: Select all

DISPLAY=:0 chromium-browser
It works if you ssh into the Pi as user pi and your Pi boots into desktop with automatic login as user pi (which is the default).
True, but it kinda begs the question of why we are doing this.

Some people interpreted the problem as being "How do I forward X connections back to my main computer?" (using something like PuTTY or similar). That may be closer to the mark even though the above answers well the question as posted literally.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5116
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 7:47 pm

vk4tec wrote:
Tue Mar 06, 2018 6:44 pm
In LINUX or UNIX you can specify a destination such as display :0
Andrew
True, but IIRC that's the main display (and therefore doesn't/shouldn't need to be specified) but does assume that a desktop is "up and running". Hence, my question as to what you meant by it. Historically, and again IIRC, the only reason for specifying (or setting the equivalent environment variable) a "display" was if "x-forwarding" or its equivalent was being/had been set up manually to enable (GUI-)programs running on one m/c to display (and be controlled from) another. Sometimes that manual process wasn't performed correctly leading to unwanted windows "popping up" on the "wrong" m/c. So, to clarify the situation for us, what, exactly were you wanting to do or expecting to happen?
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

vk4tec
Posts: 131
Joined: Thu Mar 07, 2013 9:05 am
Location: Brisbane QLD
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 8:11 pm

Trying to make a browser come up on boot
---------------------------------
Andrew Rich
email: [email protected]
http://www.tech-software.net/ ( hobby website )
http://59.167.159.165/ ( Raspberry Pi ADS-B server ) RTL SDR

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5116
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 8:19 pm

vk4tec wrote:
Tue Mar 06, 2018 8:11 pm
Trying to make a browser come up on boot
O.K. But that requires booting to desktop to have completed (and be enabled) and knowing where and when to start up said browser (I haven't needed to do anything like that so can't "fill in any details"). I wonder if you really need something like a "Kiosk Browser" system (Kweb suite).
Trev.
**
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

vk4tec
Posts: 131
Joined: Thu Mar 07, 2013 9:05 am
Location: Brisbane QLD
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 8:28 pm

This all stems from not being able to get kiosk working

Tried the auto start file

No luck

Trying to make a car display

Andrew
---------------------------------
Andrew Rich
email: [email protected]
http://www.tech-software.net/ ( hobby website )
http://59.167.159.165/ ( Raspberry Pi ADS-B server ) RTL SDR

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Sending a display from SSH

Tue Mar 06, 2018 8:40 pm

vk4tec wrote:
Tue Mar 06, 2018 8:28 pm
This all stems from not being able to get kiosk working

Tried the auto start file

No luck

Trying to make a car display

Andrew
Edit autostart:

Code: Select all

nano /home/pi/.config/lxsession/LXDE-pi/autostart
The command to add to autostart should look something like this:

Code: Select all

@chromium-browser -kiosk http://www.raspberrypi.org
Use [Alt] [F4] to exit
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

vk4tec
Posts: 131
Joined: Thu Mar 07, 2013 9:05 am
Location: Brisbane QLD
Contact: Website

Re: Sending a display from SSH

Wed Mar 07, 2018 2:54 am

[email protected]:~$ chromium-browser -kiosk http://www.raspberrypi.org
[1344:1344:0307/025418.852772:ERROR:browser_main_loop.cc(582)] Failed to put Xlib into threaded mode.

(chromium-browser:1344): Gtk-WARNING **: cannot open display:
[email protected]:~$
---------------------------------
Andrew Rich
email: [email protected]
http://www.tech-software.net/ ( hobby website )
http://59.167.159.165/ ( Raspberry Pi ADS-B server ) RTL SDR

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Sending a display from SSH

Wed Mar 07, 2018 3:32 am

vk4tec wrote:
Wed Mar 07, 2018 2:54 am
[email protected]:~$ chromium-browser -kiosk http://www.raspberrypi.org
[1344:1344:0307/025418.852772:ERROR:browser_main_loop.cc(582)] Failed to put Xlib into threaded mode.

(chromium-browser:1344): Gtk-WARNING **: cannot open display:
[email protected]:~$
Not clear what you are doing or wanting?????

To start Chromium or any other GUI from a SSH session and have it open on the local console (HDMI monitor) then:

Code: Select all

DISPLAY=:0 chromium-browser -kiosk http://www.raspberrypi.org
If you want to have Chromium autostart on each boot then see my previous reply. No SSH login needed.

To start from a LXterminal prompt:

Code: Select all

chromium-browser -kiosk http://www.raspberrypi.org
As has been mentioned in all cases above, Raspbian must be set to boot to desktop with either an HDMI monitor attached or force hotplug setting enabled in config.txt
Last edited by klricks on Wed Mar 07, 2018 3:42 am, edited 1 time in total.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

vk4tec
Posts: 131
Joined: Thu Mar 07, 2013 9:05 am
Location: Brisbane QLD
Contact: Website

Re: Sending a display from SSH

Wed Mar 07, 2018 3:37 am

I did the autostart

Nothing happened

Rebooted

Andrew
---------------------------------
Andrew Rich
email: [email protected]
http://www.tech-software.net/ ( hobby website )
http://59.167.159.165/ ( Raspberry Pi ADS-B server ) RTL SDR

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Sending a display from SSH

Wed Mar 07, 2018 4:02 am

Did you do exactly as I wrote? Same CaSe and no extra spaces.....
Note that there is more than one autostart file. If you edit the wrong one then it won't work. Many tutorials on the web show the wrong one.
FYI - For testing you can logout and back in..... Much faster than rebooting.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

Return to “General discussion”