neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.8k stars 1.73k forks source link

XRDP session close immediately #2258

Closed mahendra03 closed 2 years ago

mahendra03 commented 2 years ago

Hi Team, I have xrdp installed in GCP instance for Redhat 8 system. when i checked the xrdp-sesman.log i can see below

I don't know why my system is getting close when im trying to login into instance xrdp 0.9.19 How I can get rid of this.

[20220510-07:24:44] [INFO ] starting Xvnc session...
[20220510-07:24:44] [INFO ] IPv6 not supported, falling back to IPv4
[20220510-07:24:44] [INFO ] IPv6 not supported, falling back to IPv4
[20220510-07:24:44] [INFO ] IPv6 not supported, falling back to IPv4
[20220510-07:24:44] [INFO ] Starting session: session_pid 3211, display :10.0, width 1440, height 900, bpp 32, client ip :43543 - socket: 12, user name remotedesktop
[20220510-07:24:44] [INFO ] [session start] (display 10): calling auth_start_session from pid 3211
[20220510-07:24:44] [ERROR] sesman_data_in: scp_process_msg failed
[20220510-07:24:44] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20220510-07:24:44] [INFO ] Starting X server on display 10: Xvnc :10 -auth .Xauthority -geometry 1440x900 -depth 32 -rfbauth /home/remotedesktop/.vnc/sesman_passwd-remotedesktop@:10 -bs -nolisten tcp -localhost -dpi 96  
[20220510-07:24:45] [INFO ] Found X server running at /tmp/.X11-unix/X10
[20220510-07:24:45] [INFO ] Found X server running at /tmp/.X11-unix/X10
[20220510-07:24:45] [INFO ] Found X server running at /tmp/.X11-unix/X10
[20220510-07:24:45] [INFO ] Session started successfully for user remotedesktop on display 10
[20220510-07:24:45] [INFO ] Starting the xrdp channel server for display 10
[20220510-07:24:45] [INFO ] Starting the default window manager on display 10: /usr/libexec/xrdp/startwm-bash.sh
[20220510-07:24:45] [INFO ] Session in progress on display 10, waiting until the window manager (pid 3224) exits to end the session
[20220510-07:24:45] [WARN ] Window manager (pid 3224, display 10) exited quickly (0 secs). This could indicate a window manager config problem
[20220510-07:24:45] [INFO ] Calling auth_stop_session and auth_end from pid 3211
[20220510-07:24:45] [INFO ] Terminating X server (pid 3225) on display 10
[20220510-07:24:45] [INFO ] Terminating the xrdp channel server (pid 3249) on display 10
[20220510-07:24:45] [INFO ] X server on display 10 (pid 3225) returned exit code 0 and signal number 0
[20220510-07:24:45] [INFO ] xrdp channel server for display 10 (pid 3249) exit code 0 and signal number 0
[20220510-07:24:45] [INFO ] cleanup_sockets:
[20220510-07:24:45] [INFO ] Process 3211 has exited
[20220510-07:24:45] [INFO ] ++ terminated session:  username remotedesktop, display :10.0, session_pid 3211, ip :43543 - socket: 12
matt335672 commented 2 years ago

Thanks.

mahendra03 commented 2 years ago

Hi @matt335672 ,

When you say desktop installed ? can you confirm the name of software i have just installed xrdp only.

When i go to my home directory inside i can't see xsession-errors if I am doing something wrong or missing something?

matt335672 commented 2 years ago

To use xrdp you need a desktop installed, like GNOME or XFCE. You can' use xrdp on a pure server install, which is what you may have by the sound of it.

Installing a desktop will greatly increase the amount of software on your system if you haven't got one installed.

What do you get for the command dnf group list?

GoofyAF commented 2 years ago

If you already have a desktop installed, or directly installed a desktop environment, make sure that your remote sever is set to a multi-user target. I believe that xrdp needs to take control/launch it's own x-session, so if you already have your desktop environment running, this will fail.

Steps to fix:

  1. Run these commands on the target system

    sudo systemclt set-default multi-user.target
    sudo reboot
  2. Attempt to reconnect using your RD client

matt335672 commented 2 years ago

Thanks @GoofyAF - you're quite right. I don't think however we're at that stage yet.

tbennett6421 commented 2 years ago

Getting the same behavior. Can connect to RDP remote port and authenticate. Creds are good. But the sessions just closes immediately.

# lsb_release -a
Kali
Kali GNU/Linux Rolling
2022.2
kali-rolling
# systemctl get-default
graphical.target

set LogLevel debug and restarted xrdp I have the logs for that if needed.

Kali rolling has xfce4 by default.

tbennett6421 commented 2 years ago

I have one instance where it runs correctly and one instance where it doesn't. The instance with issues is a fresh install. They both have the same xrdp configuration. (i.e. default) They both show the following window manager information.

# wmctrl -m  
Name: Xfwm4
Class: xfwm4
PID: 4476
Window manager's "showing the desktop" mode: N/A

The only noticeably difference Working:

xrdp 0.9.17
Compiled with OpenSSL 1.1.1o  3 May 2022

Not Working:

xrdp 0.9.19
Compiled with OpenSSL 3.0.3  3 May 2022
matt335672 commented 2 years ago

If the session is closing immediately, it's likely the /etc/xrdp/startwm.sh script is not managing to start the session.

tbennett6421 commented 2 years ago

I do not have ~/.xsession or ~/.Xsession I do have a ~/.xsession-errors.

error.txt

matt335672 commented 2 years ago

Problem seems to be that the X server is exiting unexpectedly, or maybe isn't starting:-

(xfwm4:3639): Gtk-WARNING **: 13:12:44.697: cannot open display: :10.0
tbennett6421 commented 2 years ago

What are the contents of /var/log/xrdp-sesman.log? xrdp-sesman.log

Are you using the Xorg or the Xvnc backend? Xorg

If you're using Xorg, what is in ~/.xorgxrdp.10.log? xorgxrdp.10.log

matt335672 commented 2 years ago

I still can't see anything definitive in there.

Can you also provide the output of sudo journalctl -S -1m straight after trying to log in? That provides a system log for the last minute.

tbennett6421 commented 2 years ago

I see lots of errors in here. journalctl.txt

matt335672 commented 2 years ago

Your desktop appears to be segfaulting:-

Jun 29 19:21:10 kali xrdp-sesman[1471]: [WARN ] Window manager (pid 1472, display 10) exited with non-zero exit code 255 and signal 11. This could indicate a window manager config problem
Jun 29 19:21:10 kali kernel: xfce4-session[1472]: segfault at 2c ip 0000562f16c5d620 sp 00007fff8bd88b78 error 4 in xfce4-session[562f16c48000+1c000]
Jun 29 19:21:10 kali kernel: Code: b7 fe ff 0f 1f 80 00 00 00 00 4c 89 e7 e8 f8 ed ff ff 85 c0 75 b5 48 83 c4 08 4c 89 e7 5d 41 5c e9 e5 f2 ff ff 0f 1f 44 00 00 <8b> 47 2c c3 66 66 2e 0f 1f 84 00 00 00 00 00 90 8b 47 28 c3 66 66
Jun 29 19:21:10 kali xrdp-sesman[1471]: [WARN ] Window manager (pid 1472, display 10) exited quickly (0 secs). This could indicate a window manager config problem

Two possibilities spring to mind:-

  1. xfce isn't fully installed. Does it work on the system console?
  2. you're logged in to another graphical session (e.g. on the console) as the same user. This isn't supported on systems using systemd --user (nor can it be).
tbennett6421 commented 2 years ago

xfce isn't fully installed. Does it work on the system console?

I'm not entirely sure what this means or how to test this?

you're logged in to another graphical session (e.g. on the console) as the same user. This isn't supported on systems using systemd --user (nor can it be).

I am logged into the GUI via kali, which was what I was trying to RPD in as. I tried RDP via user root and it works completely. This is acceptable to me, as this is a kali machine and I always open terminals up as root. So I'm happy, but I'm willing to continue troubleshooting if you wish. For instance I can try fully installing xfce; as I'm not sure if the kali maintainers are fully installing it.

Let me know how you'd like to proceed.

matt335672 commented 2 years ago

System console is the physical front end to the machine, if it's a physical machine (i.e. the keyboard, monitor and mouse connected to the machine). There's also a system console for a virtual machine, but it's generally harder to get to.

XFCE is working fine if it works OK on the system console. That's generally the easiest way to check XFCE is correctly installed.

You should be able to log in via XRDP to any user that isn't currently logged in to the system console.

Does that make sense?

tbennett6421 commented 2 years ago

Okay. I'm not sure I was aware of that.

I can login to XFCE4 via the system console. but I was trying the same user. Once I changed to login as kali then xrdp as root it worked.

Are you asking about logging into the console as kali then trying to xrdp into localhost from the console session and rdp in as root? If that's what you are asking I can try that?

mahendra03 commented 2 years ago

I will also share the steps with you that i tried in my redhat golden image system to login to into remote desktop using xrdp

Sent from my iPhone

On 07-Jul-2022, at 9:00 PM, Tyler Bennett @.***> wrote:

Okay. I'm not sure I was aware of that.

I can login to XFCE4 via the system console. but I was trying the same user. Once I changed to login as kali then xrdp as root it worked.

Are you asking about logging into the console as kali then trying to xrdp into localhost from the console session and rdp in as root? If that's what you are asking I can try that?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

matt335672 commented 2 years ago

@tbennett6421 - suggest you sent up another unprivileged user for xrdp only. Then you can use kali or root on the console without having any difficulties.

matt335672 commented 2 years ago

No more ifno from poster(s) - closing.

sputnick-dev commented 1 year ago

What I would do in this case:

ssh remote -l userX 'pkill -U userX'
jamri11b commented 11 months ago

If you already have a desktop installed, or directly installed a desktop environment, make sure that your remote sever is set to a multi-user target. I believe that xrdp needs to take control/launch it's own x-session, so if you already have your desktop environment running, this will fail.

Steps to fix:

1. Run these commands on the target system
sudo systemclt set-default multi-user.target
sudo reboot
2. Attempt to reconnect using your RD client

All you need is to log out and remain logged out to connect to your computer you don't need to change from grphical.target to multi-user.target

carl-larsen commented 1 month ago

If you already have a desktop installed, or directly installed a desktop environment, make sure that your remote sever is set to a multi-user target. I believe that xrdp needs to take control/launch it's own x-session, so if you already have your desktop environment running, this will fail.

Steps to fix:

1. Run these commands on the target system
sudo systemclt set-default multi-user.target
sudo reboot
2. Attempt to reconnect using your RD client

Typo should be: sudo systemctl set-default multi-user.target sudo reboot

Firnaz86 commented 2 weeks ago

If you already have a desktop installed, or directly installed a desktop environment, make sure that your remote sever is set to a multi-user target. I believe that xrdp needs to take control/launch it's own x-session, so if you already have your desktop environment running, this will fail.

Steps to fix:

  1. Run these commands on the target system
sudo systemclt set-default multi-user.target
sudo reboot
  1. Attempt to reconnect using your RD client

This is worked for me for Fedora Workstation 41

chronic414z commented 1 week ago

I had a similar issue, that the XRDP session got closed immediately. The log looked similar to OPs. But the reason for me was that I have a script in /etc/profile.d/ which uses bash functions like shopt. The script /etc/xrdp/startwm.sh is a /bin/sh script which couldn't interpret those bash functions. After changing the first line in /etc/xrdp/startwm.sh from #!/bin/sh to #!/bin/bash it worked. I found out by running the script /etc/xrdp/startwm.sh manually from cli.