无法启动 vncserver:绑定:无法分配请求的地址 (99)

无法启动 vncserver:绑定:无法分配请求的地址 (99)

我与我的 Raspberry Pi 一起vnc使用。ssh一段时间以来它运行良好,但在遵循之后这些说明openvpn在运行 Raspbian 操作系统的 Raspberry Pi 上进行设置。我发现我无法再访问Raspberry Pi上的VNC服务器。

转发 x11ssh正在工作,但显然,vnc server无法访问其端口,因此甚至无法启动。

$ sudo systemctl status vncserver-x11-serviced -l

● vncserver-x11-serviced.service - VNC Server in Service Mode daemon
   Loaded: loaded (/usr/lib/systemd/system/vncserver-x11-serviced.service; enabled)
   Active: active (running) since Sun 2018-01-21 14:25:11 GMT; 1s ago
Main PID: 8896 (vncserver-x11-s)
   CGroup: /system.slice/vncserver-x11-serviced.service
       ├─8896 /usr/bin/vncserver-x11-serviced -fg
       ├─8898 /usr/bin/vncserver-x11-core -service
       └─8913 /usr/bin/vncagent service 14

Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not listening on [::1]::5900: bind: Cannot assign requested address (99)
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not listening on [::1]::5900: bind: Cannot assign requested address (99)
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not listening on [::1]::5900: bind: Cannot assign requested address (99)
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not listening on [::1]::5900: bind: Cannot assign requested address (99)
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: ConsoleDisplay: Found running X server (pid=1001)

该端口上似乎没有任何运行。这是以下的输出lsof

$ sudo lsof -i tcp

COMMAND    PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
cupsd      752       root   10u  IPv4  13511      0t0  TCP localhost:ipp (LISTEN)
cups-brow  756       root    5u  IPv4 313573      0t0  TCP localhost:48450->localhost:ipp (CLOSE_WAIT)
dnsmasq    914    dnsmasq    5u  IPv4  11726      0t0  TCP *:domain (LISTEN)
dnsmasq    914    dnsmasq    7u  IPv6  11728      0t0  TCP *:domain (LISTEN)
sshd       976       root    3u  IPv4  11842      0t0  TCP *:2718 (LISTEN)
tor        998 debian-tor    4u  IPv4  12125      0t0  TCP 192.168.254.159:49042->ks3352401.kimsufi.com:8090 (ESTABLISHED)
tor        998 debian-tor    7u  IPv4  14489      0t0  TCP localhost:9050 (LISTEN)
tor        998 debian-tor   11u  IPv4  15915      0t0  TCP 172.94.70.220:47186->166.70.170.234:https (ESTABLISHED)
sshd      5550       root    3u  IPv4 315897      0t0  TCP 192.168.254.159:2718->192.168.254.47:64500 (ESTABLISHED)
sshd      6322      morey    3u  IPv4 315897      0t0  TCP 192.168.254.159:2718->192.168.254.47:64500 (ESTABLISHED)
sshd      6322      morey   10u  IPv4 319584      0t0  TCP localhost:6010 (LISTEN)

以下是一些可能有用的其他信息:

$ uname -a
Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux

$ vncserver --help
VNC(R) Server 6.1.1 (r28093) ARMv6 (May 19 2017 12:59:35)

这似乎可能与 ip6 的更改iptables或禁用有关/etc/sysctl.conf,但我不知道如何解决它。任何想法,将不胜感激。

答案1

Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not listening on [::1]::5900: bind: Cannot assign requested address (99)

::1是 IPv6 的等价物127.0.0.1。因此,如果您禁用了 IPv6,那么是的,收听::1变得不可能。

您有两个选择:

  • 首先,就我而言,建议是重新启用 IPv6。在现代世界中,没有真正的理由要禁用 IPv6(事实上,几年后您可能无法在没有 IPv6 的情况下访问互联网),而且它可能会导致更多问题,而不仅仅是这个问题
  • 配置vncserver-x11以使其不再尝试侦听::1或任何其他 IPv6 地址(::最有可能的其他候选地址)。

vncserver-x11-serviced似乎是 RealVNC 特有的,我找不到任何解释如何为其配置侦听地址的文档,因此您可能必须自己弄清楚最后一点。

答案2

Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not accepting connections: failed to listen on at least one address.
Jan 21 14:25:11 raspberrypi vncserver-x11[8898]: TcpListenerManager: not listening on [::1]::5900: bind: Cannot assign requested address (99)

监听地址无效。端口与地址之间应使用单个分隔符:,而不是::在 IPv6 地址中用作缩写的双分隔符。

无论您在何处配置[::1]::5900,请更改为[::1]:5900

答案3

我禁用了 ipv6,并且在 RealVnc 中看到了同样的问题,通过使用修复 -IpListenAddresses=0.0.0.0

确保-localhost从参数中删除

这是参数详细信息

IpListenAddresses - 以逗号分隔的 IP 地址列表,用于侦听 TCP/UDP 连接,或者为空以侦听所有可用 IP 地址。请注意,如果 localhost 参数设置为 True,则忽略此参数。 (默认=)

相关内容