JMpi82
Posts: 8
Joined: Fri Jul 13, 2018 5:02 pm

Ssh with GUI

Sat Jul 14, 2018 4:05 am

I am running Xquartz on a MacBook pro. I can connect to the Raspberry Pi Zero W through Terminal using
ssh -Y [email protected],<ip.address>

This works fine. I can then type "idle3" and the python editor comes up in an Xwindow.

However, using a MacBook air with the same version of Xquartz I can connect to the Pi using the same terminal command, but I receive an error when I try to access idl3. is says something about tkinter and no display $DISPLAY.

I have checked the settings and cannot figure out why I can connect on one laptop but no the other.

Thanks for the help.

I have another thread in the beginners where I ask a few other basic questions, but it's not getting too many views. Check it out if you can. I'd like to learn a few of the basics.

User avatar
scruss
Posts: 1978
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Ssh with GUI

Sat Jul 14, 2018 12:54 pm

What's the difference in the output from

Code: Select all

echo $DISPLAY
on both macs? This would be from the Terminal once you'd issued the ssh command.

There may also be some sharing settings in your mac preferences or in XQuartz.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

JMpi82
Posts: 8
Joined: Fri Jul 13, 2018 5:02 pm

Re: Ssh with GUI

Sat Jul 14, 2018 4:29 pm

scruss wrote:
Sat Jul 14, 2018 12:54 pm
What's the difference in the output from

Code: Select all

echo $DISPLAY
on both macs? This would be from the Terminal once you'd issued the ssh command.

There may also be some sharing settings in your mac preferences or in XQuartz.
Connecting via ssh on both machines (one at a time) and then the pi typing "echo $DISPLAY" results in the following:

Macbook (the one working) - localhost:11.0
Macbook Air (not working) - localhost:10.0

RobLewis
Posts: 10
Joined: Wed Oct 17, 2018 10:36 pm

Re: Ssh with GUI

Sat Jan 05, 2019 9:20 pm

Trying to access my new Pi 3B+ GUI from xQuartz on a Mac. Installed xauth, connected with ssh -X.
But when I enter

Code: Select all

startlxde-pi
, I get this:

Code: Select all

** Message: main.vala:102: Session is LXDE-pi
** Message: main.vala:103: DE is LXDE
(lxsession:7421): Gtk-WARNING **: cannot open display: 

Code: Select all

echo $DISPLAY
outputs nothing. What's the problem? The Pi's GUI works on the local monitor.

User avatar
scruss
Posts: 1978
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Ssh with GUI

Sat Jan 05, 2019 10:10 pm

Remote X doesn't do whole desktops too well, but individual windows should be openable. I just ran leafpad over ssh -X, and it worked, although DISPLAY had set itself to localhost:10.0. If you want the whole desktop, VNC is better and comes installed on Raspbian by default.

XQuartz can be a bit weird. Maybe you're hitting some ssh X forwarding debugging issues?
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

RobLewis
Posts: 10
Joined: Wed Oct 17, 2018 10:36 pm

Re: Ssh with GUI

Sat Jan 05, 2019 10:57 pm

Thanks. How do you open an individual window? I'm seeing nothing.

User avatar
scruss
Posts: 1978
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Ssh with GUI

Mon Jan 07, 2019 1:55 am

I had to try this on my old Macbook to remember what you need to do. You might not have noticed this, but you were probably getting a message
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
every time you did ssh -X. This is because XQuartz's xauth program lives in a non-standard folder. You can fix this by ensuring that your ~/.ssh/config on the Mac contains the lines:

Code: Select all

Host *
XAuthLocation /opt/X11/bin/xauth
The next time you ssh in, DISPLAY will be set to a reasonable value. Mine was set to localhost:10.0
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

RobLewis
Posts: 10
Joined: Wed Oct 17, 2018 10:36 pm

Re: Ssh with GUI

Mon Jan 07, 2019 8:15 am

Thanks, but my ~/.ssh directory contains only this:

-rw------- 1 rob staff 1766 Jul 11 2014 github_rsa
-rw-r--r-- 1 rob staff 401 Jul 11 2014 github_rsa.pub
-rw-r--r-- 1 rob staff 3907 Jan 1 13:22 known_hosts

User avatar
scruss
Posts: 1978
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Ssh with GUI

Mon Jan 07, 2019 3:03 pm

You can create ~/.ssh/config with a text editor and put the lines

Code: Select all

Host *
XAuthLocation /opt/X11/bin/xauth
in it. It's a useful config file to know about. You can put user names in it, so for my breadboard Zero I have

Code: Select all

Host=naan
user=pi
so I never need to type user names.

It's up there with knowing about ssh-copy-id to copy credentials to other hosts so you never need to enter passwords. If you're trying to ssh into a mac, though, it will always prompt for password unless you mess with system settings.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Troubleshooting”