0

I have two raspis and connect from one to the other using SSH and X11 forwarding, ssh pi@[pi's IP] -X -v. Displaying the remote GUI using X11 forwarding works fine for many applications. However, for one application it's not working. It's the demo application of the ADI tof sdk. When I start this in my "SSH -X" session I get an error (after some init steps already passed):

X11 connection rejected because of wrong authentication.

Gtk-WARNING **: 13:11:31.083: cannot open display: localhost:10.0
pi@aditofpi:~/Desktop $ ./aditof-demo.sh 
I0604 13:11:28.104044 28301 device_enumerator_raspberry.cpp:16] Looking for devices on the target
I0604 13:11:28.105119 28301 device_enumerator_raspberry.cpp:49] Looking at: /dev/video0 for an eligible TOF camera
I0604 13:11:28.106060 28301 system_impl.cpp:31] System initialized
I0604 13:11:28.106182 28301 camera_96tof1.cpp:47] Initializing camera
I0604 13:11:28.106228 28301 local_device.cpp:118] Opening device
I0604 13:11:28.309844 28301 calibration.cpp:230] EEPROM calibration data size 65044 bytes
I0604 13:11:31.062580 28301 camera_96tof1.cpp:64] Camera initialized
I0604 13:11:31.069535 28301 local_device.cpp:213] Starting device
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 52008
debug1: channel 1: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 1: free: x11, nchannels 2
Unable to init server: Could not connect: Connection refused

(aditof-demo 1.2.0:28301): Gtk-WARNING **: 13:11:31.083: cannot open display: localhost:10.0

This is no general X11 forwarding issue obviously since it works fine for other applications. Tested it with xclock and geany for example. Could it be related to the fact that the aditof-demo application has several GUI windows? I can see them when I start the application locally. Can X11 forwarding handle this at all (one app with several different windows)? I also tried starting the ssh session trusted with -Y instead of -X, same result. My ssh_config on both systems contain the following block, does this look ok?

Host *
#   ForwardAgent no
ForwardX11 yes
ForwardX11Trusted yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no

Any idea why X11 forwarding is not working only for this specific application and works fine for others?

UPDATE: I tried to start the aditof application as pi user and also as sudo user. Both did not work and the output is the same. However, when I test with geany there IS actually a difference. It works as user pi, but NOT as sudo. As sudo, geany fails with the same error as the aditif application. Hmmm, that's strange.

pi@aditofpi:~/Desktop $ geany
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 56062
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
debug1: channel 1: free: x11, nchannels 2
pi@aditofpi:~/Desktop $ sudo geany
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 56066
debug1: channel 1: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 1: free: x11, nchannels 2
Unable to init server: Could not connect: Connection refused

Geany: cannot open display
9
  • Could it be related to the fact that the aditof-demo application has several GUI windows when I start it locally? Yes, it could and it's easy to check. Close them all and check if it works when the only instance is the one launched via ssh -X. Jun 5 '20 at 3:34
  • Hi, Eduardo. The one launched via ssh -X is actually the only instance. When one instance of the application is launched several different windows will be opended at the same time. One for the user controls, one for a VIS image display, another one for the 3D depth image etc. So it's not several instances of the same window, it's different windows launched by the same application.
    – SeBASStian
    Jun 5 '20 at 7:14
  • edited the original post to make the "several different windows" thing a bit more clear.
    – SeBASStian
    Jun 5 '20 at 7:22
  • Can you check if that other application is running under the same user? Because X forwarding is working, and other applications too. This error X11 connection rejected because of wrong authentication. shows if you don't have the right to access the server, if you are another user for example or run sudo. Jun 5 '20 at 12:46
  • I wonder if it could be something to do with IPv6 ("request from ::1"), and the X11UseLocalhost setting? Jun 5 '20 at 16:15
0

I just found out that this is actually not related to a specific application as described above but a general problem for all applications when I run a program as sudo! I always get this error X11 connection rejected because of wrong authentication. when starting something in the ssh -X session as sudo. And it always works fine when starting the same applications as user pi. The reason why I did not see this in the beginning is that the sudo for the aditof application is hidden in the .sh file. I started this as user pi, but inside the .sh file there is the following:

#!/bin/sh
cd /home/pi/aditof_sdk/build/examples/aditof-demo
sudo ./aditof-demo

After changing it to:

#!/bin/sh
cd /home/pi/aditof_sdk/build/examples/aditof-demo
./aditof-demo

and doing this:

pi@raspberrypi:~ $ ssh pi@aditofpi'sID -X
pi@aditofpi'sID's password: 
Linux aditofpi 4.19.86-v7l+ #1 SMP Tue Dec 3 17:21:04 EET 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jun  9 15:09:15 2020 from aditofpi'sID
pi@aditofpi:~ $ ~/Desktop/aditof-demo.sh

the aditof application starts! :) Intermediate Yeah! Same behavior with other applications like xclock or geany. Works as user pi, does not work and fails with X11 connection rejected because of wrong authentication. when starting as sudo. But this is another topic.

1
  • Just as a side note: I finally could solve the "could not start programs as sudo" problem by following this instruction thegeekdiary.com/…
    – SeBASStian
    Jun 9 '20 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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