从 Linux 到 Mac 的 SSH X11 转发停止工作(只是挂起)

从 Linux 到 Mac 的 SSH X11 转发停止工作(只是挂起)

一段时间以来,我一直使用 Mac 登录 Linux 机器并运行 X 应用程序。最近,它突然停止工作了。故障模式很奇怪:我没有收到通常的“由于身份验证错误而拒绝 X11 连接”提示。相反,XQuartz 会打开,X 客户端也会启动,但它只是挂起,不会显示任何内容。

例如:

chris@Ghost % ssh blackbox -Y -v
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/chris/.ssh/config
debug1: /Users/chris/.ssh/config line 1: Applying options for blackbox
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: /etc/ssh/ssh_config line 51: Applying options for *
debug1: Connecting to <remote host>.
debug1: Connection established.
...
Authenticated to <remote host>.
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: exec
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
Last login: Sat Mar 27 21:52:41 2021 from gateway

[chris@blackbox ~]$ xclock
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 59248
debug1: x11_connect_display: $DISPLAY is launchd
debug1: channel 1: new [x11]
debug1: confirm x11

[hangs here until I press Ctrl+C]

^Cdebug1: channel 1: FORCE input drain

[chris@blackbox ~]$ <Ctrl+D>
debug1: channel 1: free: x11, nchannels 2
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
logout
debug1: channel 0: free: client-session, nchannels 1

如果我跟踪客户端,我可以看到它在发送魔术饼干后挂起了:

getsockname(3, {sa_family=AF_INET6, sin6_port=htons(35366), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{"l\0\v\0\0\0\22\0\20\0\0\0", 12}, {"", 0}, {"MIT-MAGIC-COOKIE-1", 18}, {"\0\0", 2}, {"\23\264\342)\n\226\"6G\213\201\372wk~\225", 16}, {"", 0}], 6) = 48
recvfrom(3, 0x963920, 8, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}], 1, -1

什么原因可能导致这种情况?我该如何调试/修复它?

答案1

重新启动似乎已经解决了这个问题,所以我无法再重现,抱歉。

相关内容