为什么X11输出"connect/tmp/.X11-unix/X1:没有这样的文件或目录"? [英] Why does X11 output "connect /tmp/.X11-unix/X1: No such file or directory"

查看:211
本文介绍了为什么X11输出"connect/tmp/.X11-unix/X1:没有这样的文件或目录"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想静静地从脚本中测试X11是否正常工作.

I want to silently test whether X11 is working, from a script.

即使使用(例如) xset q>将stdout和stderr重定向到/dev/null,我仍会收到"connect/tmp/.X11-unix/X1:无此类文件或目录"的消息./dev/null 2>& 1

我追踪了它,似乎没有被xset写入.我也跟踪了相关的sshd,它似乎也没有写它.

I strace'd, and it doesn't appear to be getting written by xset. I also strace'd the relevant sshd and it doesn't seem to be writing it either.

xset,xdpyinfo和测试程序,网址为如何检查X服务器正在运行?全部输出此无用的错误消息.实际上,vim也是如此.但是"ls"不是.

xset, xdpyinfo and the test program at How to check if X server is running? all output this useless error message. In fact, so does vim. But "ls" does not.

我也尝试过: script -e -c'xset q'/dev/null>/dev/null 2>& 1 ...但是即使输出错误消息.

I also tried: script -e -c 'xset q' /dev/null > /dev/null 2>&1 ...but even that outputs the error message.

我该怎么做才能使此过分的错误消息静音?

What do I need to do to silence this overaggressive error message?

谢谢!

PS:这是xset q的痕迹:

PS: Here's an strace of xset q:

20878 execve("/usr/bin/xset", ["xset", "q"], 0x7ffe3e91cfe0 /* 33 vars */) = 0
20878 brk(NULL)                         = 0x563d8a664000
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=141841, ...}) = 0
20878 mmap(NULL, 141841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f19ac118000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXmuu.so.1", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\23\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14528, ...}) = 0
20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac144000
20878 mmap(NULL, 2109592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19abd10000
20878 mprotect(0x7f19abd13000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19abf12000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19abf12000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXext.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\2205\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=73640, ...}) = 0
20878 mmap(NULL, 2169496, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19abaf8000
20878 mprotect(0x7f19abb09000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19abd08000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7f19abd08000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libX11.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\207\1\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=1277384, ...}) = 0
20878 mmap(NULL, 3374392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab7c0000
20878 mprotect(0x7f19ab8f3000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19abaf3000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x133000) = 0x7f19abaf3000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0
20878 mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab3c8000
20878 mprotect(0x7f19ab5af000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19ab7af000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f19ab7af000
20878 mmap(0x7f19ab7b5000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19ab7b5000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libxcb.so.1", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\261\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=162232, ...}) = 0
20878 mmap(NULL, 2257576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab1a0000
20878 mprotect(0x7f19ab1c6000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19ab3c6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f19ab3c6000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14560, ...}) = 0
20878 mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aaf98000
20878 mprotect(0x7f19aaf9b000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19ab19a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19ab19a000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXau.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14456, ...}) = 0
20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac142000
20878 mmap(NULL, 2109720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aad90000
20878 mprotect(0x7f19aad92000, 2097152, PROT_NONE) = 0
20878 mmap(0x7f19aaf92000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19aaf92000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXdmcp.so.6", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\21\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=22616, ...}) = 0
20878 mmap(NULL, 2117760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aab88000
20878 mprotect(0x7f19aab8d000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aad8c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7f19aad8c000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libbsd.so.0", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P4\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=80104, ...}) = 0
20878 mmap(NULL, 2179152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa970000
20878 mprotect(0x7f19aa983000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aab82000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x7f19aab82000
20878 mmap(0x7f19aab84000, 80, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aab84000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\"\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=31680, ...}) = 0
20878 mmap(NULL, 2128864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa768000
20878 mprotect(0x7f19aa76f000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aa96e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f19aa96e000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000b\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0755, st_size=144976, ...}) = 0
20878 mmap(NULL, 2221184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa548000
20878 mprotect(0x7f19aa562000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aa761000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0x7f19aa761000
20878 mmap(0x7f19aa763000, 13440, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aa763000
20878 close(3)                          = 0
20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac13d000
20878 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac115000
20878 arch_prctl(ARCH_SET_FS, 0x7f19ac115740) = 0
20878 mprotect(0x7f19ab7af000, 16384, PROT_READ) = 0
20878 mprotect(0x7f19aa761000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aa96e000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aab82000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aad8c000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19aaf92000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19ab19a000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19ab3c6000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19abaf3000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19abd08000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19abf12000, 4096, PROT_READ) = 0
20878 mprotect(0x563d8872f000, 4096, PROT_READ) = 0
20878 mprotect(0x7f19ac13f000, 4096, PROT_READ) = 0
20878 munmap(0x7f19ac118000, 141841)    = 0
20878 set_tid_address(0x7f19ac115a10)   = 20878
20878 set_robust_list(0x7f19ac115a20, 24) = 0
20878 rt_sigaction(SIGRTMIN, {sa_handler=0x7f19aa54dcb0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f19aa55a890}, NULL, 8) = 0
20878 rt_sigaction(SIGRT_1, {sa_handler=0x7f19aa54dd50, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f19aa55a890}, NULL, 8) = 0
20878 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
20878 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
20878 brk(NULL)                         = 0x563d8a664000
20878 brk(0x563d8a685000)               = 0x563d8a685000
20878 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
20878 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
20878 close(3)                          = 0
20878 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
20878 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
20878 close(3)                          = 0
20878 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=529, ...}) = 0
20878 read(3, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 529
20878 read(3, "", 4096)                 = 0
20878 close(3)                          = 0
20878 stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=304, ...}) = 0
20878 openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=92, ...}) = 0
20878 read(3, "# The \"order\" line is only used "..., 4096) = 92
20878 read(3, "", 4096)                 = 0
20878 close(3)                          = 0
20878 futex(0x7f19ab7b7ba4, FUTEX_WAKE_PRIVATE, 2147483647) = 0
20878 openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=304, ...}) = 0
20878 read(3, "# Dynamic resolv.conf(5) file fo"..., 4096) = 304
20878 read(3, "", 4096)                 = 0
20878 close(3)                          = 0
20878 uname({sysname="Linux", nodename="zareason-limbo", ...}) = 0
20878 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=141841, ...}) = 0
20878 mmap(NULL, 141841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f19ac0f0000
20878 close(3)                          = 0
20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P#\0\0\0\0\0\0"..., 832) = 832
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=47568, ...}) = 0
20878 mmap(NULL, 2168632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa330000
20878 mprotect(0x7f19aa33b000, 2093056, PROT_NONE) = 0
20878 mmap(0x7f19aa53a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f19aa53a000
20878 mmap(0x7f19aa53c000, 22328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aa53c000
20878 close(3)                          = 0
20878 mprotect(0x7f19aa53a000, 4096, PROT_READ) = 0
20878 munmap(0x7f19ac0f0000, 141841)    = 0
20878 openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
20878 fstat(3, {st_mode=S_IFREG|0644, st_size=403, ...}) = 0
20878 read(3, "127.0.0.1\tlocalhost\n127.0.1.1\tza"..., 4096) = 403
20878 read(3, "", 4096)                 = 0
20878 close(3)                          = 0
20878 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 3
20878 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
20878 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
20878 connect(3, {sa_family=AF_INET, sin_port=htons(6013), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
20878 getpeername(3, {sa_family=AF_INET, sin_port=htons(6013), sin_addr=inet_addr("127.0.0.1")}, [124->16]) = 0
20878 uname({sysname="Linux", nodename="zareason-limbo", ...}) = 0
20878 access("/home/dstromberg/.Xauthority", R_OK) = 0
20878 openat(AT_FDCWD, "/home/dstromberg/.Xauthority", O_RDONLY) = 4
20878 fstat(4, {st_mode=S_IFREG|0600, st_size=827, ...}) = 0
20878 read(4, "\1\0\0\16zareason-limbo\0\0010\0\22MIT-MAGIC"..., 4096) = 827
20878 read(4, "", 4096)                 = 0
20878 close(4)                          = 0
20878 getsockname(3, {sa_family=AF_INET, sin_port=htons(37214), sin_addr=inet_addr("127.0.0.1")}, [124->16]) = 0
20878 fcntl(3, F_GETFL)                 = 0x2 (flags O_RDWR)
20878 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
20878 fcntl(3, F_SETFD, FD_CLOEXEC)     = 0
20878 poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
20878 writev(3, [{iov_base="l\0\v\0\0\0\22\0\20\0\0\0", iov_len=12}, {iov_base="", iov_len=0}, {iov_base="MIT-MAGIC-COOKIE-1", iov_len=18}, {iov_base="\0\0", iov_len=2}, {iov_base="\256b\245\317f\262\25\254\27\365!H\212\3316J", iov_len=16}, {iov_base="", iov_len=0}], 6) = 48
20878 recvfrom(3, 0x563d8a6660e0, 8, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
20878 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN|POLLERR|POLLHUP}])
20878 recvfrom(3, 0x563d8a6660e0, 8, 0, NULL, NULL) = -1 ECONNRESET (Connection reset by peer)
20878 shutdown(3, SHUT_RDWR)            = -1 ENOTCONN (Transport endpoint is not connected)
20878 close(3)                          = 0
20878 write(2, "xset:  unable to open display \"l"..., 47) = 47
20878 exit_group(1)                     = ?
20878 +++ exited with 1 +++

这是-a xset类型:

And here's a type -a xset:

$ type -a xset
below cmd output started 2019 Sun Jun 30 07:49:33 AM PDT
xset is /usr/bin/xset

无需重定向即可运行,以显示消息的顺序:

Running without redirection, to show the order of the messages:

$ xset q
below cmd output started 2019 Sun Jun 30 08:03:24 AM PDT
connect /tmp/.X11-unix/X1: No such file or directory
xset:  unable to open display "localhost:13.0"

为响应melpomene的评论,我建立了一个完全没有启动文件的测试帐户.然后,我对它ssh -Y进行了sudo操作,并得到了与上述相同的错误消息.

In response to a comment from melpomene, I set up a test account with no startup files at all. I then ssh -Y'd to it, sudo'd, and got the same error message as described above.

我一直在gnome-terminal进行测试.我只是尝试了konsole,然后又收到了令人反感的错误消息.

I had been testing in gnome-terminal exclusively. I just tried konsole and again got the offending error message.

我刚刚尝试过跟踪openssh客户端;它只产生了一次字符串"connect",看起来并不相关(除了连接到ssh服务器).

I just tried strace'ing the openssh client; it produced a single occurrence of the string "connect", which did not look relevant (other than connecting to the ssh server).

我一直在Linux Mint 19.1系统上进行专门测试.我只是在新安装的Debian 9.9系统上进行了尝试,并得到了相同的结果.

I had been testing exclusively on a Linux Mint 19.1 system. I just tried it on a freshly-installed Debian 9.9 system, and got the same result.

要复制的步骤:

  1. ssh -Y remote.host.example.com
  2. sudo bash
  3. xset -q>/dev/null 2>& 1

通过这三个简单的步骤,您可能会看到令人讨厌的错误消息.

You may see the offending error message after these 3 simple steps.

推荐答案

这很容易理解和复制,但是有许多活动的部分.

This is pretty easy to understand and replicate, but there is a number of moving parts.

我们通过X转发将其SSH到远程计算机.此ssh进程必须可以在本地访问运行中的X服务器.在这里,我们将以一个玩笑开始 $ DISPLAY :

We ssh to a remote machine with X forwarding. This ssh process must have access to a working X server locally. Here we'll start it up with a joke $DISPLAY:

(local) $ DISPLAY=:87 ssh -Y remote
Warning: No xauth data; using fake authentication data for X11 forwarding

警告表示 ssh 无法在本地联系正在工作的X服务器.

That Warning is an indication that ssh cannot contact a working X server locally.

远程 $ DISPLAY 不是:87

(remote) $ echo $DISPLAY
(remote) localhost:11.0

这是 ssh -Y 的神奇之处,以及它的X11代理如何工作.

This is the magic that ssh's -Y does and how its X11 proxy works.

我们在远程运行命令,尝试连接到 $ DISPLAY :

We run a command on remote that tries to connect to $DISPLAY:

(remote) $ xset -q
connect /tmp/.X11-unix/X99: No such file or directory
xset:  unable to open display "localhost:11.0"

这是你的问题:

(remote) $ xset -q >/dev/null 2>&1
connect /tmp/.X11-unix/X99: No such file or directory

xset 正在打印 unable 错误消息,并已被重定向.但是, connect 错误消息是从 ssh 中发出的.请记住, xset remote 上运行,当 ssh local 上运行时.

The unable error message was being printed by xset, and has been redirected away. However the connect error message is coming out of ssh. Remember that xset runs on remote, while ssh is running on local.

在运行 ssh 之前,您需要在 local 上在 local 上验证 $ DISPLAY .

You need to validate $DISPLAY on local before running ssh.

您可以通过多种方式使 ssh 安静下来,但我不喜欢丢弃错误消息.一种方法是减少错误详细程度:

You can quieten ssh in a number of ways, but I'm not a fan of throwing away error messages. One way would be to reduce the error verbosity:

(local) $ DISPLAY=:87 ssh -Y -o LogLevel=FATAL remote 'xset -q &>/dev/null'

有关 ssh 设置的列表,请参见 man ssh_config .

See man ssh_config for a list of ssh settings.

这篇关于为什么X11输出"connect/tmp/.X11-unix/X1:没有这样的文件或目录"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆