xrdp: VNC Problem connecting

Hi, I have xrdp 0.9.1 on ubuntu 16.04 and I want to connect to kvm vm via vnc using xrdp. When I’m connecting I get

VNC error - problem connecting
some error

Here is the log:

[20170531-09:28:33] [DEBUG] xrdp_wm_log_msg: VNC started connecting
[20170531-09:28:33] [DEBUG] xrdp_wm_log_msg: VNC connecting to localhost 5901
[20170531-09:28:36] [DEBUG] VNC error 1 after security negotiation
[20170531-09:28:36] [DEBUG] VNC error before sending share flag
[20170531-09:28:36] [DEBUG] VNC error before receiving server init
[20170531-09:28:36] [DEBUG] VNC error before receiving pixel format
[20170531-09:28:36] [DEBUG] VNC error before receiving name length
[20170531-09:28:36] [DEBUG] VNC error before receiving name
[20170531-09:28:36] [DEBUG] xrdp_wm_log_msg: VNC error - problem connecting
[20170531-09:28:36] [DEBUG] Closed socket 16 (AF_INET6 :: port 33870)
[20170531-09:28:36] [DEBUG] xrdp_wm_log_msg: some problem
[20170531-09:28:36] [ERROR] xrdp_wm_log_msg: Error connecting to: localhost
[20170531-09:28:36] [DEBUG] xrdp_mm_module_cleanup
[20170531-09:28:36] [DEBUG] VNC mod_exit
[20170531-09:28:36] [DEBUG] return value from xrdp_mm_connect 1

The vnc server should be working, because I was able to connect to it via vnc client.

Please may you help me?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 36 (10 by maintainers)

Most upvoted comments

[SOLVED]

I got the same error in CentOS 7.5 with Xfce desktop. I had struggled for several days with no result.

1

Recently, I found a solution coincidentally. I created a CentOS 7.5 virtual machine with “minimal” installation. Then I installed xrdp and started xrdp service, without realizing that I didn’t have any desktop environment. When I attempted to connect the vm from my Windows, I got definitely the same error stated above.

Soon, I found my stupid mistake, followed by a strange thing: whether installing a desktop environment or not, xrdp always throws the same error. I realized the cause of this issue is not a bug of xrdp, tigervnc-server or Xfce, but the fact that xrdp doesn’t know what desktop environment to start, let alone how to start. It’s the real problem, and we can fix it easily.

Here were my steps:

# generate a file called .xsession in your home directory, and set default desktop
echo "xfce4-session" > ~/.xsession

# enable execute
chmod a+x ~/.xsession

# restart xrdp service
systemctl restart xrdp

# Hint: It works too if you replace `.xsession` with `.Xclients`

Now, xrdp works perfectly with Xfce and openbox.


Finally, where did I get these names? like ~/.xsession and ~/.Xclients?

Well, I found all these in the following scripts:

  • startwm.sh
  • Xsession
  • Xclients

Hint: you have to search the location of these files for different platforms

For example, the last part of /etc/X11/xinit/Xsession in CentOS 7.5 says:

# otherwise, take default action
if [ -x "$HOME/.xsession" ]; then
    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $HOME/.xsession"
elif [ -x "$HOME/.Xclients" ]; then
    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $HOME/.Xclients"
elif [ -x /etc/X11/xinit/Xclients ]; then
    exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT /etc/X11/xinit/Xclients"
else
    # should never get here; failsafe fallback
    exec -l $SHELL -c "xsm"
fi

Apparently, X11 will search $HOME/.xsession and $HOME/.Xclients for desktop environments.

Seems like this is related to issue #847

I had the same error and was able to get xrdp running on kali by simply moving to lxde.

apt install lxde xrdp tigervnc-standalone-server                                                                                                               
sudo update-alternatives --config x-session-manager
  #chose lxsession
service xrdp-sesman start
service xrdp start

Not ideal but better than nothing. Hope this helps someone like it helped me. 😃

Simplified from https://forums.kali.org/showthread.php?34751-How-to-set-up-xrdp-on-the-AWS-Kali-image

Not sure if this would apply for a lot of people, but I was having the following errors is log

[20200625-23:04:05] [INFO ] A connection received from 127.0.0.1 port 52386
[20200625-23:04:05] [INFO ] ++ created session (access granted): username root, ip 195.233.142.182:65160 - socket: 12
[20200625-23:04:05] [INFO ] starting Xvnc session...
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5911)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6011)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6211)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5922)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6022)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6222)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5923)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6023)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6223)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:5933)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6033)
[20200625-23:04:05] [DEBUG] Closed socket 10 (AF_INET 0.0.0.0:6233)
[20200625-23:04:05] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20200625-23:04:05] [INFO ] calling auth_start_session from pid 23121
[20200625-23:04:05] [DEBUG] Closed socket 8 (AF_INET 127.0.0.1:3350)
[20200625-23:04:05] [DEBUG] Closed socket 9 (AF_INET 127.0.0.1:3350)
[20200625-23:04:05] [INFO ] Xvnc :33 -auth .Xauthority -geometry 1920x1080 -depth 8 -rfbauth /root/.vnc/sesman_passw@Tooling-Server:33 -bs -nolisten tcp -localhost -dpi 96
[20200625-23:04:15] [ERROR] X server for display 33 startup timeout
[20200625-23:04:15] [CORE ] waiting for window manager (pid 23123) to exit
[20200625-23:04:15] [ERROR] X server for display 33 startup timeout
[20200625-23:04:15] [ERROR] another Xserver might already be active on display 33 - see log
[20200625-23:04:15] [DEBUG] aborting connection...
[20200625-23:04:15] [CORE ] window manager (pid 23123) did exit, cleaning up session
[20200625-23:04:15] [INFO ] calling auth_stop_session and auth_end from pid 23121
[20200625-23:04:15] [DEBUG] cleanup_sockets:
[20200625-23:04:15] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdp_chansrv_socket_33
[20200625-23:04:15] [DEBUG] cleanup_sockets: deleting /tmp/.xrdp/xrdpapi_33
[20200625-23:04:15] [INFO ] ++ terminated session:  username root, display :33.0, session_pid 23121, ip 195.233.142.182:65160 - socket: 12

Apparently the value -depth 8 was causing the error. Found out that my Windows RDP setting was getting set to “Low Bandwidth” setting and color depth was being set at 8. Changed to default 32 and issue was solved.

I reproduced the issue. Please wait patiently until the bug is fixed. Not to use VNC is a workaround.

Ubuntu 16.04.2 LTS xrdp 0.9.2

[20170714-15:47:21] [INFO ] xrdp_wm_log_msg: login successful for display 12
[20170714-15:47:21] [DEBUG] xrdp_wm_log_msg: VNC started connecting
[20170714-15:47:21] [DEBUG] xrdp_wm_log_msg: VNC connecting to 127.0.0.1 5912
[20170714-15:47:24] [DEBUG] VNC error 1 after security negotiation
[20170714-15:47:24] [DEBUG] VNC error before sending share flag
[20170714-15:47:24] [DEBUG] VNC error before receiving server init
[20170714-15:47:24] [DEBUG] VNC error before receiving pixel format
[20170714-15:47:24] [DEBUG] VNC error before receiving name length
[20170714-15:47:24] [DEBUG] VNC error before receiving name
[20170714-15:47:24] [DEBUG] xrdp_wm_log_msg: VNC error - problem connecting
[20170714-15:47:24] [DEBUG] Closed socket 25 (AF_INET 0.0.0.0:42388)
[20170714-15:47:24] [DEBUG] xrdp_wm_log_msg: some problem
[20170714-15:47:24] [DEBUG] xrdp_mm_module_cleanup
[20170714-15:47:24] [DEBUG] VNC mod_exit
[20170714-15:47:24] [DEBUG] Closed socket 24 (AF_INET 127.0.0.1:40894)
[20170714-15:47:31] [DEBUG] Closed socket 12 (AF_INET 192.168.125.18:3389)
[20170714-15:47:31] [DEBUG] xrdp_mm_module_cleanup
[20170714-15:47:32] [ERROR] Listening socket is in wrong state, terminating list
ener

https://pastebin.com/u54NN1Wp Fedora 26 xrdp 0.9.3 firewall/selinux disabled

[20170714-15:39:06] [INFO ] xrdp_wm_log_msg: login successful for display 10
[20170714-15:39:06] [DEBUG] xrdp_wm_log_msg: VNC started connecting
[20170714-15:39:06] [DEBUG] xrdp_wm_log_msg: VNC connecting to 127.0.0.1 5910
[20170714-15:39:09] [DEBUG] VNC error 1 after security negotiation
[20170714-15:39:09] [DEBUG] VNC error before sending share flag
[20170714-15:39:09] [DEBUG] VNC error before receiving server init
[20170714-15:39:09] [DEBUG] VNC error before receiving pixel format
[20170714-15:39:09] [DEBUG] VNC error before receiving name length
[20170714-15:39:09] [DEBUG] VNC error before receiving name
[20170714-15:39:09] [DEBUG] xrdp_wm_log_msg: VNC error - problem connecting
[20170714-15:39:09] [DEBUG] Closed socket 25 (AF_INET 0.0.0.0:50184)
[20170714-15:39:09] [DEBUG] xrdp_wm_log_msg: some problem
[20170714-15:39:09] [DEBUG] xrdp_mm_module_cleanup
[20170714-15:39:09] [DEBUG] VNC mod_exit
[20170714-15:39:09] [DEBUG] Closed socket 24 (AF_INET 127.0.0.1:56708)

https://pastebin.com/fSSJgc9f On Ubuntu at least Xorg session is working On Fedora 26 i unsuccessfully tried xrdp 0.9.1, 0.9.2, 0.9.3 - Xorg or Xvnc sessions not working, at least for me. UPD: After some more experimenting I’ve found what causing this errors. Steps to reproduce(I’m using Fedora with “clean” MATE+Lightdm setup): Install fresh fedora server w/o GUI. $ sudo dnf groupinstall ‘base-x’ ‘fonts’ $ sudo dnf install mate-desktop mate-control-center mate-terminal mate-settings-daemon caja caja-open-terminal mate-polkit mate-session-manager lightdm-gtk lightdm mate-menus mate-themes mate-panel marco oddjob-mkhomedir xrdp xrdp-selinux $ sudo authconfig --enablemkhomedir --update With this setup I stumbled upon:

  • old bug with xrdp mkhomedir and selinux(fast check: nonexisting homedir and setenforce 0)
  • /etc/X11/xinit/Xclients is not spawning mate-session properly

It is not sufficient to install xrdp-selinux package, you should patch, recompile and reinstall xrdp policy: $ cd /usr/share/doc/xrdp-selinux/ $ sudo cp xrdp.te{,.old} $ sudo cat << EOF > xrdp.patch

+++ xrdp.te	2017-07-18 12:52:23.413395457 +0300
@@ -4,6 +4,8 @@
         type unconfined_service_t;
         type unconfined_t;
         type xserver_exec_t;
+        type oddjob_t;
+        type oddjob_mkhomedir_exec_t;
         class process transition;
         class file entrypoint;
 }
@@ -11,7 +13,12 @@
 #============= unconfined_service_t ==============
 
 allow unconfined_service_t unconfined_t:process transition;
+allow unconfined_service_t oddjob_mkhomedir_exec_t:file entrypoint;
 
 #============= unconfined_t ==============
 
 allow unconfined_t xserver_exec_t:file entrypoint;
+
+#============= oddjob_t ==============
+
+allow oddjob_t unconfined_service_t:process transition;
\ No newline at end of file
EOF

$ sudo patch xrdp.te xrdp.patch $ sudo checkmodule -M -m -o xrdp.mod xrdp.te $ sudo semodule_package -o xrdp.pp -m xrdp.mod $ sudo semodule -i xrdp.pp Eliminating this two conditions gives me working xrdp with Xvnc session, but much faster Xorg session still gives me [DEBUG] Closed socket 25 (AF_UNIX) errors. To make Xorg session working properly I have to make additional Xorg.wrap rights adjustments. After that I have fully working xrdp setup on Fedora 26: $ sudo rpm -qa | egrep “rdp|^selin” selinux-policy-3.13.1-260.1.fc26.noarch selinux-policy-targeted-3.13.1-260.1.fc26.noarch xrdp-0.9.2-12.fc26.x86_64 xrdp-selinux-0.9.2-12.fc26.x86_64 selinux-policy-minimum-3.13.1-260.1.fc26.noarch xorgxrdp-0.2.2-1.fc26.x86_64

I did update the Xvnc stanza of /etc/xrdp/sesman.ini, but the problem persists.

[Xvnc] param=Xvnc param=-bs param=-nolisten param=tcp param=-localhost param=-dpi param=96 param=-AcceptCutText=0 param=-SendCutText=0 param=-SendPrimary=0 param=-SetPrimary=0