0

Host: Raspberry Pi 4B Host Display: Osoyoo 3.5" DSI Touch Screen Host OS: Raspbian (Buster) Client: MacBook Air 2011 Client OS: MacOS Big Sur Client App: Terminal Connection string: ssh -Y pi@pihost.local

What happened: a broken pipe occurred due to loss of wi-fi connection. Consequence: "X11 connection rejected because of wrong authentication." appears each time I try to run my python3 code that was fully functional before losing the X connection.

I've tried several reported solutions listed on this and other sites and none have worked so far. xeyes works fine. I'm the only user on ssh. Here's my xauth output after renaming my ~/.Xauthority and reconnecting.

pi@pihost:~ $ xauth list
pihost/unix:10  MIT-MAGIC-COOKIE-1  495386a19d88503faea5d118e41ce73e

Before the rename and reconnect, my ~/.Xauthority file had similar lines for :11 and :12 as well as a more generic looking line. This change didn't seem to change anything.

I stepped through the solution shown at the following URL and it also had no visible effect.

[https://superuser.com/questions/805725/how-do-i-debug-x11-connection-rejected-because-of-wrong-authentication][1]

Here's my active sessions list:

pi@pihost:~ $ w
 18:44:12 up  6:25,  3 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:19    6:25m 10.71s  0.88s /usr/bin/lxsession -s LXDE-pi -e LXDE
pi       tty1     -                12:19    6:25m  0.12s  0.09s -bash
pi       pts/0    <<hidden IP>>: 18:20    2.00s  0.14s  0.04s w
pi@pihost:~ $ 

Note: The actual host name and IP address are replaced here for security purposes.

I previously had a similar problem and had to build my raspbian installation all over again, with several add-ons I need for this project. I'm hoping there's an easier solution this time around, as it took several days to get that all installed and working before. I'm still in the process of creating a shell script to do the full installation, so it'll mean piecemeal installation for now and a great loss of time if I have to repeat that.

Any further ideas would be greatly appreciated.

1 Answers1

0

I've found a solution at https://www.raspberrypi.org/forums/viewtopic.php?t=97451. I entered the command line: sudo xauth add $(xauth -f ~pi/.Xauthority list|tail -1) and it now runs correctly. For regular use, I've added that command line in ~/.bashrc.