gnome-remote-desktop 无法启动 RDP 服务器:绑定到地址 [::]:3389 时出错:地址已在使用中

gnome-remote-desktop 无法启动 RDP 服务器:绑定到地址 [::]:3389 时出错:地址已在使用中

我正在尝试寻找答案,但目前还没有找到。我安装了 Ubuntu 22.0.4,但 Gnome Desktop 无法工作,因此我继续升级到 23.0.4,希望它能解决以下问题,但并没有。它在 Windows 11 和 Mac 上不起作用。Gnome Desktop 显示以下错误:

yigal@yigal-desktop:~$ systemctl --user status gnome-remote-desktop.service
● gnome-remote-desktop.service - GNOME Remote Desktop
     Loaded: loaded (/usr/lib/systemd/user/gnome-remote-desktop.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-05-07 23:49:36 CDT; 23min ago
   Main PID: 9559 (gnome-remote-de)
      Tasks: 8 (limit: 9187)
     Memory: 14.2M
        CPU: 424ms
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/gnome-remote-desktop.service
             └─9559 /usr/libexec/gnome-remote-desktop-daemon

May 07 23:49:36 yigal-desktop systemd[1033]: Starting gnome-remote-desktop.service - GNOME Remote Desktop...
May 07 23:49:36 yigal-desktop systemd[1033]: Started gnome-remote-desktop.service - GNOME Remote Desktop.
May 07 23:49:37 yigal-desktop gnome-remote-desktop-daemon[9559]: Cannot load libnvidia-encode.so.1
May 07 23:49:37 yigal-desktop gnome-remote-de[9559]: Failed to start RDP server: Error binding to address [::]:3389: Address already in use
yigal@yigal-desktop:~$ 

当 RDP 客户端启动时,它会挂起并保持黑屏。重新启动 gnome-remote-desktop 并重新启动 Ubuntu 不会出现这种情况。

我不精通 Linux,但我怀疑它与 libnvidia-encode 有关,因为:

May 07 23:49:37 yigal-desktop gnome-remote-desktop-daemon[9559]: Cannot load libnvidia-encode.so.1

有人能帮我解决这个问题吗?

yigal@yigal-desktop:~$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 23.04
Release:        23.04
Codename:       lunar

yigal@yigal-desktop:~$ !652
netstat -lntp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:5900          0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.54:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      -                   
tcp6       0      0 ::1:631                 :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
tcp6       0      0 :::3389                 :::*                    LISTEN      -                   
tcp6       0      0 ::1:3350                :::*                    LISTEN      -                   
yigal@yigal-desktop:~$ lscpu 
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         36 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  2
  On-line CPU(s) list:   0,1
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Celeron(R) CPU G540T @ 2.10GHz
    CPU family:          6
    Model:               42
    Thread(s) per core:  1
    Core(s) per socket:  2
    Socket(s):           1
    Stepping:            7
    CPU(s) scaling MHz:  79%

先谢谢了

答案1

无法加载 libnvidia-encode.so.1

这无关紧要。gnome-remote-desktop 支持 NVENC 和 CUDA。如果它们不可用(例如由于未使用 NVIDIA 卡),那也不是问题,因为软件编码有后备方案。


您的问题是其他进程已绑定到 RDP 端口 (3389)。TCP 端口只能绑定一次。
因此,需要做的是关闭占用 3389 端口的程序或进程。

你可以使用 查看哪个进程占用了端口ss -ntlp。然后终止在 3389 端口上运行的进程(ss -ntlp终止后可以通过 检查是否成功),然后通过 重新启动 gnome-remote-desktop systemctl --user restart gnome-remote-desktop

但需要注意的是,已经占用 3389 端口的进程可能会自动运行,例如通过另一个 systemd 单元。
根据进程的不同,您可能需要完全禁用它。否则,每次重新启动系统时,您都会再次遇到同样的问题。

答案2

以下是我得到的结果:

State               Recv-Q              Send-Q                             Local Address:Port                             Peer Address:Port              Process              
LISTEN              0                   4096                                   127.0.0.1:5900                                  0.0.0.0:*                                      
LISTEN              0                   4096                                  127.0.0.54:53                                    0.0.0.0:*                                      
LISTEN              0                   128                                    127.0.0.1:631                                   0.0.0.0:*                                      
LISTEN              0                   4096                               127.0.0.53%lo:53                                    0.0.0.0:*                                      
LISTEN              0                   32                                 192.168.122.1:53                                    0.0.0.0:*                                      
LISTEN              0                   128                                        [::1]:631                                      [::]:*                                      
LISTEN              0                   4096                                           *:22                                          *:*                                      
LISTEN              0                   2                                              *:3389                                        *:*                                      
LISTEN              0                   2                                          [::1]:3350                                     [::]:*                                      
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ sudo lsof -i:3389
[sudo] password for yigal: 
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
xrdp    836 xrdp   11u  IPv6  23855      0t0  TCP *:ms-wbt-server (LISTEN)
yigal@yigal-desktop:~$ systemctl --user status gnome-remote-desktop.service
● gnome-remote-desktop.service - GNOME Remote Desktop
     Loaded: loaded (/usr/lib/systemd/user/gnome-remote-desktop.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-05-07 23:49:36 CDT; 8h ago
   Main PID: 9559 (gnome-remote-de)
      Tasks: 8 (limit: 9187)
     Memory: 14.2M
        CPU: 424ms
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/gnome-remote-desktop.service
             └─9559 /usr/libexec/gnome-remote-desktop-daemon

May 07 23:49:36 yigal-desktop systemd[1033]: Starting gnome-remote-desktop.service - GNOME Remote Desktop...
May 07 23:49:36 yigal-desktop systemd[1033]: Started gnome-remote-desktop.service - GNOME Remote Desktop.
May 07 23:49:37 yigal-desktop gnome-remote-desktop-daemon[9559]: Cannot load libnvidia-encode.so.1
May 07 23:49:37 yigal-desktop gnome-remote-de[9559]: Failed to start RDP server: Error binding to address [::]:3389: Address already in use
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ sudo killall xrdp
yigal@yigal-desktop:~$ sudo lsof -i:3389
yigal@yigal-desktop:~$ systemctl --user restart gnome-remote-desktop.service
yigal@yigal-desktop:~$ systemctl --user status gnome-remote-desktop.service
● gnome-remote-desktop.service - GNOME Remote Desktop
     Loaded: loaded (/usr/lib/systemd/user/gnome-remote-desktop.service; enabled; preset: enabled)
     Active: active (running) since Mon 2023-05-08 08:09:17 CDT; 4s ago
   Main PID: 18987 (gnome-remote-de)
      Tasks: 9 (limit: 9187)
     Memory: 14.4M
        CPU: 436ms
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/gnome-remote-desktop.service
             └─18987 /usr/libexec/gnome-remote-desktop-daemon

May 08 08:09:17 yigal-desktop systemd[1033]: Starting gnome-remote-desktop.service - GNOME Remote Desktop...
May 08 08:09:17 yigal-desktop systemd[1033]: Started gnome-remote-desktop.service - GNOME Remote Desktop.
May 08 08:09:18 yigal-desktop gnome-remote-desktop-daemon[18987]: Cannot load libnvidia-encode.so.1
May 08 08:09:18 yigal-desktop gnome-remote-de[18987]: RDP server started```

That is what I got after killing xrdp:
```May 08 08:09:18 yigal-desktop gnome-remote-de[18987]: RDP server started
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ 
yigal@yigal-desktop:~$ systemctl --user status gnome-remote-desktop.service
● gnome-remote-desktop.service - GNOME Remote Desktop
     Loaded: loaded (/usr/lib/systemd/user/gnome-remote-desktop.service; enabled; preset: enabled)
     Active: active (running) since Mon 2023-05-08 08:09:17 CDT; 8min ago
   Main PID: 18987 (gnome-remote-de)
      Tasks: 8 (limit: 9187)
     Memory: 22.0M
        CPU: 591ms
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/gnome-remote-desktop.service
             └─18987 /usr/libexec/gnome-remote-desktop-daemon

May 08 08:10:03 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:10:03:267] [18987:19008] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_CONTINUE_NEED>May 08 08:10:03 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:10:03:275] [18987:19008] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_COMPLETE_NEED>May 08 08:10:03 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:10:03:301] [18987:19008] [ERROR][com.freerdp.core.gcc] - Unknown GCC client data block: 0xC00C
May 08 08:10:03 yigal-desktop gnome-remote-de[18987]: Failed to start remote desktop session: GDBus.Error:org.freedesktop.DBus.Error.Failed: Session creation inhibited
May 08 08:10:03 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:10:03:401] [18987:18987] [ERROR][com.freerdp.core] - rdp_set_error_info:freerdp_set_last_error_ex ERRIN>May 08 08:17:15 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:17:15:929] [18987:19196] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_CONTINUE_NEED>May 08 08:17:15 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:17:15:935] [18987:19196] [WARN][com.winpr.negotiate] - AcceptSecurityContext status SEC_I_COMPLETE_NEED>May 08 08:17:15 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:17:15:945] [18987:19196] [ERROR][com.freerdp.core.gcc] - Unknown GCC client data block: 0xC00C
May 08 08:17:15 yigal-desktop gnome-remote-de[18987]: Failed to start remote desktop session: GDBus.Error:org.freedesktop.DBus.Error.Failed: Session creation inhibited
May 08 08:17:15 yigal-desktop gnome-remote-desktop-daemon[18987]: [08:17:15:033] [18987:18987] [ERROR][com.freerdp.core] - rdp_set_error_info:freerdp_set_last_error_ex ERRIN>

答案3

对我来说,ss -ntlp没有显示使用端口 3389 的进程。但卸载 XRDP 并重新启动后,Ubuntu RDP 服务就可以正常工作。

相关内容