neutrinolabs / xrdp

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

xrdp-based client crashes when logged in with a new created user #2590

Closed D3vil0p3r closed 1 year ago

D3vil0p3r commented 1 year ago

Hello, I'm experiencing an issue on xrdp-based client. The logs and the file contents are the same of what I described in the following issue ticket https://github.com/neutrinolabs/xrdp/issues/2572

I opened a new ticket because the issue is different. Here, I have a container where I created a first user in the Dockerfile. When I run the container with RDP port, and I use remmina by xrdp for connecting to the container, the access by RDP by this first user works correctly.

If I create a second user inside the container (so not defined at the beginning in the Dockerfile liek the first user), even if I assign the same groups of the first user, when I try to access by RDP by the second user, the rdp client crashes.

The logs I get are the same of the issue I reported above. I dont think it is related directly to GNOME session because I am able to access by the 1st user by RDP. I cannot do this by the 2nd user.

Why I have a different behavior if I try to access by a user that has been created when the system has been already configured?

matt335672 commented 1 year ago

There will be differences in the users causing the session to fail, for sure.

You've checked group memberships, which is a good start. Look at the following too:- 1) Home directory created with correct permissions and not on a read-only filesystem? 2) Home directory contents? One of your user directories may be populated from /etc/skel and the other may not be. 2) On SELinux systems, check the file contexts are correct on and in the home directory with ls -lZ. There's possibly an AppArmor equivalent of this, if you're using that. 3) For both users, generate a list of environment variables with env | sort and diff them to see what the differences are.

Another thing you can do is start a minimal session by installing xterm in your container, and adding an xterm command near the start of startwm.sh. When you log in, you should get the xterm up, and you can look at the user environment. Press CTRL-D to exist the xterm and continue with starting GNOME.

D3vil0p3r commented 1 year ago

Thank you for the answer @matt335672 My container is deployed as WSL and the first working user, called athena, in RDP has been defined and created in the Dockerfile. The second user, named apollo that is failing to access by xrdp is created after I install the WSL image, indeed when the container is run the first time, it asks me to create a user for starting.

  1. The two users seem to have the same permissions: athena

    drwx------ athena users 4.0 KB Mon Mar 13 23:11:37 2023  ./
    drwxr-xr-x root   root  4.0 KB Mon Mar 13 23:06:13 2023  ../
    .rw-r--r-- athena users  11 KB Fri Mar 10 19:53:23 2023  .bash_aliases
    .rw-r--r-- athena users  21 B  Thu Feb  2 07:38:44 2023  .bash_logout
    .rw-r--r-- athena users  57 B  Thu Feb  2 07:38:44 2023  .bash_profile
    .rw-r--r-- athena users 7.7 KB Tue Mar  7 21:50:01 2023  .bashrc
    .rw-r--r-- athena users 172 B  Thu Feb  2 07:38:44 2023  .bashrc.pacnew
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:15:31 2023  .cache/
    drwxrwxr-x athena users 4.0 KB Sun Mar 12 12:20:23 2023  .config/
    .rw-r--r-- athena users  50 KB Fri Mar 10 19:53:23 2023  .face
    .rw-r--r-- athena users   0 B  Fri Mar 10 19:53:23 2023  .flag-work-once
    .rw-r--r-- athena users  83 B  Sun Mar  5 22:24:34 2023  .htb.conf
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:15:31 2023  .icons/
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:15:31 2023  .local/
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:16:18 2023  .mozilla/
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:15:31 2023  .tmux/
    .rw-r--r-- athena users 3.7 KB Fri Mar 10 19:53:23 2023  .tmux.conf
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:15:31 2023  .vim_runtime/
    .rw-r--r-- athena users 885 B  Fri Mar 10 19:53:23 2023  .viminfo
    .rw-r--r-- athena users 349 B  Fri Mar 10 19:53:23 2023  .vimrc
    drwxr-xr-x athena users 4.0 KB Sun Mar 12 13:16:19 2023  .vscode-oss/
    .rwxrwxr-x athena users 890 B  Sun Mar 12 12:20:23 2023  .xinitrc*
    .rw-r--r-- athena users  43 KB Mon Mar 13 23:11:37 2023  .zcompdump
    .rw-r--r-- athena users 662 B  Sun Mar 12 13:18:34 2023  .zshrc

    apollo

    drwx------ apollo users 4.0 KB Mon Mar 13 23:06:31 2023  ./
    drwxr-xr-x root   root  4.0 KB Mon Mar 13 23:06:13 2023  ../
    .rw-r--r-- apollo users  11 KB Fri Mar 10 19:53:23 2023  .bash_aliases
    .rw-r--r-- apollo users  21 B  Thu Feb  2 07:38:44 2023  .bash_logout
    .rw-r--r-- apollo users  57 B  Thu Feb  2 07:38:44 2023  .bash_profile
    .rw-r--r-- apollo users 7.7 KB Tue Mar  7 21:50:01 2023  .bashrc
    .rw-r--r-- apollo users 172 B  Thu Feb  2 07:38:44 2023  .bashrc.pacnew
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:15:31 2023  .cache/
    drwxrwxr-x apollo users 4.0 KB Sun Mar 12 12:20:23 2023  .config/
    .rw-r--r-- apollo users  50 KB Fri Mar 10 19:53:23 2023  .face
    .rw-r--r-- apollo users   0 B  Fri Mar 10 19:53:23 2023  .flag-work-once
    .rw-r--r-- apollo users  83 B  Sun Mar  5 22:24:34 2023  .htb.conf
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:15:31 2023  .icons/
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:15:31 2023  .local/
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:16:18 2023  .mozilla/
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:15:31 2023  .tmux/
    .rw-r--r-- apollo users 3.7 KB Fri Mar 10 19:53:23 2023  .tmux.conf
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:15:31 2023  .vim_runtime/
    .rw-r--r-- apollo users 885 B  Fri Mar 10 19:53:23 2023  .viminfo
    .rw-r--r-- apollo users 349 B  Fri Mar 10 19:53:23 2023  .vimrc
    drwxr-xr-x apollo users 4.0 KB Sun Mar 12 13:16:19 2023  .vscode-oss/
    .rwxrwxr-x apollo users 890 B  Sun Mar 12 12:20:23 2023  .xinitrc*
    .rw-r--r-- apollo users  43 KB Mon Mar 13 23:06:31 2023  .zcompdump
    .rw-r--r-- apollo users 662 B  Sun Mar 12 13:18:34 2023  .zshrc
  2. Yes, both of the users take files from /etc/skel (for example .flag-work-once.

  3. I don't use SELinux

  4. They dont seem to have impacting differences: athena

    AUTOWORDLISTS=/usr/share/payloads/Auto_Wordlists
    BFETCH_ART=cowsay '<3 Athena OS'
    BFETCH_COLOR=/home/athena/.local/textart/color/icon/panes.textart
    BFETCH_INFO=pfetch
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus
    DEBUGINFOD_URLS=https://debuginfod.archlinux.org
    DIRBIG=/usr/share/payloads/SecLists/Discovery/Web-Content/directory-list-2.3-big.txt
    DIRMEDIUM=/usr/share/payloads/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt
    DIRSMALL=/usr/share/payloads/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt
    DISPLAY=:0
    EDITOR=/usr/bin/nvim
    FUZZDB=/usr/share/payloads/FuzzDB
    GOPATH=/home/athena/go
    HISTCONTROL=ignoreboth:erasedups:ignorespace
    HOME=/home/athena
    HOSTTYPE=x86_64
    LANG=en_US.UTF-8
    LOGNAME=athena
    MIMIKATZ=/usr/share/windows/mimikatz/
    NAME=DESKTOP-LV4580H
    OLDPWD=/home/apollo
    PAGER=most
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin/:/mnt/c/Program Files/Oculus/Support/oculus-runtime:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/VSCodium/bin:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/GnuWin32/bin/:/mnt/c/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/Antonio/AppData/Local/Programs/Python/Python311/Scripts/:/mnt/c/Users/Antonio/AppData/Local/Programs/Python/Python311/:/mnt/c/Users/Antonio/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Antonio/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/Antonio/AppData/Local/Programs/MiKTeX/miktex/bin/x64/:/mnt/c/Program Files/qemu:/mnt/c/Users/Antonio/.dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin
    PAYLOADSALLTHETHINGS=/usr/share/payloads/PayloadsAllTheThings
    PAYLOADS=/usr/share/payloads
    POWERSPLOIT=/usr/share/windows/powersploit/
    PROMPT_COMMAND=source ~/.zshrc
    PULSE_SERVER=unix:/mnt/wslg/PulseServer
    PWD=/home/athena
    ROCKYOU=/usr/share/payloads/SecLists/Passwords/Leaked-Databases/rockyou.txt
    SECLISTS=/usr/share/payloads/SecLists
    SECURITYWORDLIST=/usr/share/payloads/Security-Wordlist
    SHELL=/bin/zsh
    SHLVL=2
    TERM=xterm-256color
    USER=athena
    _=/usr/sbin/env
    VISUAL=nano
    WAYLAND_DISPLAY=wayland-0
    WEBAPI_COMMON=/usr/share/payloads/SecLists/Discovery/Web-Content/api/api-endpoints.txt
    WEBAPI_MAZEN=/usr/share/payloads/SecLists/Discovery/Web-Content/common-api-endpoints-mazen160.txt
    WEBCOMMON=/usr/share/payloads/SecLists/Discovery/Web-Content/common.txt
    WEBPARAM=/usr/share/payloads/SecLists/Discovery/Web-Content/burp-parameter-names.txt
    WSL2_GUI_APPS_ENABLED=1
    WSL_DISTRO_NAME=Athena
    WSLENV=
    WSL_INTEROP=/run/WSL/135_interop
    XDG_RUNTIME_DIR=/run/user/1001/

    apollo

    AUTOWORDLISTS=/usr/share/payloads/Auto_Wordlists
    BFETCH_ART=cowsay '<3 Athena OS'
    BFETCH_COLOR=/home/apollo/.local/textart/color/icon/panes.textart
    BFETCH_INFO=pfetch
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus
    DEBUGINFOD_URLS=https://debuginfod.archlinux.org
    DIRBIG=/usr/share/payloads/SecLists/Discovery/Web-Content/directory-list-2.3-big.txt
    DIRMEDIUM=/usr/share/payloads/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt
    DIRSMALL=/usr/share/payloads/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt
    DISPLAY=:0
    EDITOR=/usr/bin/nvim
    FUZZDB=/usr/share/payloads/FuzzDB
    GOPATH=/home/apollo/go
    HISTCONTROL=ignoreboth:erasedups:ignorespace
    HOME=/home/apollo
    HOSTTYPE=x86_64
    LANG=en_US.UTF-8
    LOGNAME=apollo
    MIMIKATZ=/usr/share/windows/mimikatz/
    NAME=DESKTOP-LV4580H
    OLDPWD=/home/athena
    PAGER=most
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin/:/mnt/c/Program Files/Oculus/Support/oculus-runtime:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/VSCodium/bin:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/GnuWin32/bin/:/mnt/c/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/Antonio/AppData/Local/Programs/Python/Python311/Scripts/:/mnt/c/Users/Antonio/AppData/Local/Programs/Python/Python311/:/mnt/c/Users/Antonio/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Antonio/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/Antonio/AppData/Local/Programs/MiKTeX/miktex/bin/x64/:/mnt/c/Program Files/qemu:/mnt/c/Users/Antonio/.dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/athena/go/bin:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin:/bin:/home/apollo/go/bin
    PAYLOADSALLTHETHINGS=/usr/share/payloads/PayloadsAllTheThings
    PAYLOADS=/usr/share/payloads
    POWERSPLOIT=/usr/share/windows/powersploit/
    PROMPT_COMMAND=source ~/.zshrc
    PULSE_SERVER=unix:/mnt/wslg/PulseServer
    PWD=/home/apollo
    ROCKYOU=/usr/share/payloads/SecLists/Passwords/Leaked-Databases/rockyou.txt
    SECLISTS=/usr/share/payloads/SecLists
    SECURITYWORDLIST=/usr/share/payloads/Security-Wordlist
    SHELL=/bin/zsh
    SHLVL=3
    TERM=xterm-256color
    USER=apollo
    _=/usr/sbin/env
    VISUAL=nano
    WAYLAND_DISPLAY=wayland-0
    WEBAPI_COMMON=/usr/share/payloads/SecLists/Discovery/Web-Content/api/api-endpoints.txt
    WEBAPI_MAZEN=/usr/share/payloads/SecLists/Discovery/Web-Content/common-api-endpoints-mazen160.txt
    WEBCOMMON=/usr/share/payloads/SecLists/Discovery/Web-Content/common.txt
    WEBPARAM=/usr/share/payloads/SecLists/Discovery/Web-Content/burp-parameter-names.txt
    WSL2_GUI_APPS_ENABLED=1
    WSL_DISTRO_NAME=Athena
    WSLENV=
    WSL_INTEROP=/run/WSL/135_interop
    XDG_RUNTIME_DIR=/run/user/1001/

About xterm, I think I dont need it, because on WSL I already get a shell when I run WSL.

matt335672 commented 1 year ago

The point of xterm is you can see where the problem is.

If you get up your startwm.sh to call xterm early, it gives you a chance to look at the environment which is created before the session (i.e. GNOME) is started. If you can't start the xterm, that is informative too.

D3vil0p3r commented 1 year ago

The point of xterm is you can see where the problem is.

If you get up your startwm.sh to call xterm early, it gives you a chance to look at the environment which is created before the session (i.e. GNOME) is started. If you can't start the xterm, that is informative too.

Ok, so your proposal is:

  1. Creating a new container that has xterm already installed
  2. Put xterm in $HOME/.xinitrc (I don't have starwm.sh and I have the exec gnome-session in .xinitrc)
  3. Run the container. When running, I open xterm
  4. Then, I run a RDP connection to the container on the host machine
  5. I should get some xterm output before going to GNOME

Is it right? What in particular I should check on xterm? I will get some output automatically?

matt335672 commented 1 year ago

Put xterm in your .xinitrc before exec gnome-session.

Connect to the container over RDP.

You should get an RDP session with just an xterm. In there you can check the user is working properly, then press CTRL-D to run GNOME, or even try running gnome-session manually to see what errors you get.

Have I explained that well enough?

D3vil0p3r commented 1 year ago

I'm able to reproduce better this issue. In practice it does not depend on the first or second user. It seems to depend on the Set Default User.

Indeed, in the WSL topic, you can install your WSL image by a DistroLauncher that is available by Microsoft: https://github.com/Microsoft/WSL-DistroLauncher

From here, you can get the Visual Studio project and the source code of files that are used for installing your WSL image.

One of these files manages the creation of the user after the installation. According to the source files, when the user is created, it is set as Default User. I noted that when it occurs, xrdp client does not work. Indeed I tested the creation of the user with SetDefaultUser() function and without it. In the first case, xrdp client does not work, in the second case, it works.

The source code of SetDefaultUser() is the following (DistroLauncher.cpp):

HRESULT SetDefaultUser(std::wstring_view userName)
{
    // Query the UID of the given user name and configure the distribution
    // to use this UID as the default.
    ULONG uid = DistributionInfo::QueryUid(userName);
    if (uid == UID_INVALID)
    {
        return E_INVALIDARG;
    }

    HRESULT hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT);
    if (FAILED(hr))
    {
        return hr;
    }

    return hr;
}

The DistributionInfo::QueryUid() function called above returns the UID of the created user and it is defined in DistributionInfo.cpp as:

ULONG DistributionInfo::QueryUid(std::wstring_view userName)
{
    // Create a pipe to read the output of the launched process.
    HANDLE readPipe;
    HANDLE writePipe;
    SECURITY_ATTRIBUTES sa{sizeof(sa), nullptr, true};
    ULONG uid = UID_INVALID;
    if (CreatePipe(&readPipe, &writePipe, &sa, 0)) {
        // Query the UID of the supplied username.
        std::wstring command = L"/usr/bin/id -u ";
        command += userName;
        int returnValue = 0;
        HANDLE child;
        HRESULT hr = g_wslApi.WslLaunch(command.c_str(), true, GetStdHandle(STD_INPUT_HANDLE), writePipe, GetStdHandle(STD_ERROR_HANDLE), &child);
        if (SUCCEEDED(hr)) {
            // Wait for the child to exit and ensure process exited successfully.
            WaitForSingleObject(child, INFINITE);
            DWORD exitCode;
            if ((GetExitCodeProcess(child, &exitCode) == false) || (exitCode != 0)) {
                hr = E_INVALIDARG;
            }

            CloseHandle(child);
            if (SUCCEEDED(hr)) {
                char buffer[64];
                DWORD bytesRead;

                // Read the output of the command from the pipe and convert to a UID.
                if (ReadFile(readPipe, buffer, (sizeof(buffer) - 1), &bytesRead, nullptr)) {
                    buffer[bytesRead] = ANSI_NULL;
                    try {
                        uid = std::stoul(buffer, nullptr, 10);

                    } catch( ... ) { }
                }
            }
        }

        CloseHandle(readPipe);
        CloseHandle(writePipe);
    }

    return uid;
}

While, the g_wslApi.WslConfigureDistribution() function that takes as input uid and the WSL_DISTRIBUTION_FLAGS_DEFAULT is defined in WslApiLoader.cpp as:

HRESULT WslApiLoader::WslConfigureDistribution(ULONG defaultUID, WSL_DISTRIBUTION_FLAGS wslDistributionFlags)
{
    HRESULT hr = _configureDistribution(_distributionName.c_str(), defaultUID, wslDistributionFlags);
    if (FAILED(hr)) {
        Helpers::PrintMessage(MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED, hr);
    }

    return hr;
}

Last useful info: the WSL_DISTRIBUTION_FLAGS can have the following values as described here:

typedef enum {
  WSL_DISTRIBUTION_FLAGS_NONE = 0x0,
  WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP = 0x1,
  WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH = 0x2,
  WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING = 0x4
} WSL_DISTRIBUTION_FLAGS;

In our first function above, the given WSL_DISTRIBUTION_FLAGS is WSL_DISTRIBUTION_FLAGS_DEFAULTand it is defined as:

#define WSL_DISTRIBUTION_FLAGS_DEFAULT (WSL_DISTRIBUTION_FLAGS_ENABLE_INTEROP | WSL_DISTRIBUTION_FLAGS_APPEND_NT_PATH | WSL_DISTRIBUTION_FLAGS_ENABLE_DRIVE_MOUNTING)

According to the tests, the issue is caused by the g_wslApi.WslConfigureDistribution() function because if I comment it, xrdp client works. By using that function, I tried to change the given WSL_DISTRIBUTION_FLAGS as WSL_DISTRIBUTION_FLAGS_NONE on g_wslApi.WslConfigureDistribution() but still xrdp does not connect.

D3vil0p3r commented 1 year ago

By using xterm, I noted that, if I go with the athena user (the preconfigured one on the rootfs), it works correctly.

If I use apollo (the one I created during the installation process), when I run gnome-session, I get the message:

zsh: terminated gnome-session

I made a new image where I don't have a pre-configured user. I have only a user created during the installation, that we can name apollo. I run xterm before gnome-session and I get:

zsh: terminated gnome-session

According to gnome-logs, I get the following logs after running that command (note that in my example 1000 is the uid of apollo user):

16:10:47 kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
16:10:47 systemd: Started Portal service.
16:10:47 dbus-daemon: [session uid=1000 pid=573] Successfully activated service 'org.freedesktop.portal.Desktop'
16:10:47 xdg-desktop-por: Failed connect to PipeWire: Couldn't connect to PipeWire
16:10:47 systemd: Started Portal service (GTK/GNOME implementation).
16:10:47 dbus-daemon: [session uid=1000 pid=573] Successfully activated service 'org.freedesktop.impl.portal.desktop.gtk'
16:10:47 at-spi2-registr: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
16:10:47 dbus-daemon: dbus-daemon[986]: Successfully activated service 'org.a11y.atspi.Registry'
16:10:46 systemd: Starting Portal service (GTK/GNOME implementation)...
16:10:46 dbus-daemon: [session uid=1000 pid=573] Activating via systemd: service name='org.freedesktop.impl.portal.desktop.gtk' unit='xdg-desktop-portal-gtk.service' requested by ':1.74' (uid=1000 pid=1672 comm="/usr/lib/xdg-desktop-portal")
16:10:46 rtkit-daemon: Supervising 0 threads of 0 processes of 0 users.
16:10:46 systemd: Started RealtimeKit Scheduling Policy Service.
16:10:46 rtkit-daemon: Successfully limited resources.
16:10:46 dbus-daemon: [system] Successfully activated service 'org.freedesktop.RealtimeKit1'
16:10:46 systemd: Starting RealtimeKit Scheduling Policy Service...
16:10:46 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.RealtimeKit1' unit='rtkit-daemon.service' requested by ':1.36' (uid=1000 pid=1672 comm="/usr/lib/xdg-desktop-portal")
16:10:46 systemd: Started Portal service (GNOME implementation).
16:10:46 dbus-daemon: [session uid=1000 pid=573] Successfully activated service 'org.freedesktop.impl.portal.desktop.gnome'
16:10:46 xdg-desktop-por: Theme parser error: gtk.css:251:11-12: Expected a filter
16:10:46 systemd: Starting Portal service (GNOME implementation)...
16:10:46 dbus-daemon: [session uid=1000 pid=573] Activating via systemd: service name='org.freedesktop.impl.portal.desktop.gnome' unit='xdg-desktop-portal-gnome.service' requested by ':1.74' (uid=1000 pid=1672 comm="/usr/lib/xdg-desktop-portal")
16:10:46 xdg-document-po: Ignoring invalid max threads value 4294967295 > max (100000).
16:10:46 systemd: Started flatpak document portal service.
16:10:46 dbus-daemon: [session uid=1000 pid=573] Successfully activated service 'org.freedesktop.portal.Documents'
16:10:46 systemd: Started sandboxed app permission store.
16:10:46 dbus-daemon: [session uid=1000 pid=573] Successfully activated service 'org.freedesktop.impl.portal.PermissionStore'
16:10:46 systemd: Starting sandboxed app permission store...
16:10:46 dbus-daemon: [session uid=1000 pid=573] Activating via systemd: service name='org.freedesktop.impl.portal.PermissionStore' unit='xdg-permission-store.service' requested by ':1.75' (uid=1000 pid=1676 comm="/usr/lib/xdg-document-portal")
16:10:46 systemd: Starting flatpak document portal service...
16:10:46 dbus-daemon: [session uid=1000 pid=573] Activating via systemd: service name='org.freedesktop.portal.Documents' unit='xdg-document-portal.service' requested by ':1.74' (uid=1000 pid=1672 comm="/usr/lib/xdg-desktop-portal")
16:10:46 systemd: Starting Portal service...
16:10:46 dbus-daemon: [session uid=1000 pid=573] Activating via systemd: service name='org.freedesktop.portal.Desktop' unit='xdg-desktop-portal.service' requested by ':1.73' (uid=1000 pid=1667 comm="gnome-logs")
16:10:43 sudo: pam_unix(sudo:session): session closed for user root
16:10:43 dbus-daemon: [session uid=1000 pid=573] Reloaded configuration
16:10:41 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
16:10:41 dbus-daemon: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.home1.service': Unit dbus-org.freedesktop.home1.service not found.
16:09:32 gnome-session-f: Cannot open display:
16:09:32 gnome-session-b: WARNING: software acceleration check failed: Child process exited with code 1
16:09:32 gnome-session-c: gnome-session-check-accelerated: no X11 display found

I don't understand why it says no X11 display found if on xterm I get :10.0 as value of $DISPLAY variable.

Then I tried to create a new user by:

sudo /usr/sbin/useradd --shell /bin/zsh -g users -G sudo,lp,network,power,sys,wheel --badname -m -N venere
sudo passwd venere

It will be assigned 1001 as UID. /run/user folder still does not contain 1001 folder. If I edit .xinitrc of venere user and I insert xterm before gnome-session, and I run gnome-session there, it works. Indeed, the gnome-logs for venere user after gnome-session command in xterm are:

16:32:11 xdg-desktop-por: AT-SPI: Could not obtain desktop path or name

16:32:11 kernel: Invalid MIT-MAGIC-COOKIE-1 key
16:32:11 kernel: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
16:32:11 kernel: AT-SPI: Cannot open default display
16:32:11 dbus-daemon: dbus-daemon[986]: Successfully activated service 'org.a11y.atspi.Registry'
16:32:11 kernel: Could not open X display
16:32:11 kernel: Invalid MIT-MAGIC-COOKIE-1 key
16:32:11 dbus-daemon: dbus-daemon[986]: Activating service name='org.a11y.atspi.Registry' requested by ':1.26' (uid=1000 pid=5388 comm="gnome-logs")
16:32:11 kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
16:32:09 gnome-shell: DING: DBus interface for File-roller (org.gnome.ArchiveManager1) is now available.
16:32:09 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.gnome.ArchiveManager1'
16:32:09 gnome-shell: DING: GNOME nautilus 43.2
16:32:08 dbus-daemon: [session uid=1001 pid=4524] Activation via systemd failed for unit 'gvfs-udisks2-volume-monitor.service': Unit gvfs-udisks2-volume-monitor.service is masked.
16:32:08 gnome-shell: DING: Detected async api for thumbnails
16:32:08 systemd: Started Virtual filesystem metadata service.
16:32:08 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.gtk.vfs.Metadata'
16:32:08 systemd: Starting Virtual filesystem metadata service...
16:32:08 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.gtk.vfs.Metadata' unit='gvfs-metadata.service' requested by ':1.55' (uid=1001 pid=5353 comm="gjs /usr/share/gnome-shell/extensions/ding@rasters")
16:32:08 gnome-shell: Launching DING process
16:32:08 systemd: Failed to start GNOME power management service.
16:32:08 kernel: Failed to connect to coredump service: No such file or directory
16:32:08 kernel: FS:  00007fef83cfee00 GS:  0000000000000000
16:32:08 kernel: R13: 0000000000000001 R14: 00007fef74016500 R15: 00007ffc4b3f6720
16:32:08 kernel: R10: 0000000000000001 R11: 0300992df4d076f5 R12: 000055c52e3e7080
16:32:08 kernel: RBP: 000055c52e3e85e8 R08: 000055c52ed79ab0 R09: 00007fef87ad8dd0
16:32:08 kernel: RDX: 0000000000000013 RSI: 00000000000001b4 RDI: 0000000000000000
16:32:08 kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000003
16:32:08 kernel: RSP: 002b:00007ffc4b3f6660 EFLAGS: 00010246
16:32:08 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:08 kernel: RIP: 0033:0x7fef879c997f
16:32:08 kernel: CPU: 4 PID: 5815 Comm: gsd-power Not tainted 5.15.90.1-microsoft-standard-WSL2 #1
16:32:08 kernel: potentially unexpected fatal signal 11.
16:32:08 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:08 kernel: gsd-power[5815]: segfault at 8 ip 00007fef879c997f sp 00007ffc4b3f6660 error 4 in libupower-glib.so.3.1.0[7fef879be000+e000]
16:32:08 gsd-power: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed
16:32:08 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:08 gsd-power: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
16:32:08 systemd: Started Tracker file system data miner.
16:32:08 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.Tracker3.Miner.Files'
16:32:07 systemd: Started GNOME power management service.
16:32:07 gsd-power: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed
16:32:07 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:07 nautilus: g_hash_table_foreach: assertion 'hash_table != NULL' failed
16:32:07 tracker-miner-f: Unable to connect to UPower
16:32:07 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:07 systemd: Starting GNOME power management service...
16:32:07 tracker-miner-f: Error creating proxy: Error calling StartServiceByName for org.gtk.vfs.UDisks2VolumeMonitor: Unit gvfs-udisks2-volume-monitor.service is masked. (g-io-error-quark, 36)
16:32:07 systemd: Stopped GNOME power management service.
16:32:07 dbus-daemon: [session uid=1001 pid=4524] Activation via systemd failed for unit 'gvfs-udisks2-volume-monitor.service': Unit gvfs-udisks2-volume-monitor.service is masked.
16:32:07 systemd: Starting Tracker file system data miner...
16:32:07 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.FileManager1'
16:32:07 systemd: Started Portal service.
16:32:07 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.freedesktop.Tracker3.Miner.Files' unit='tracker-miner-fs-3.service' requested by ':1.20' (uid=1001 pid=4636 comm="/usr/bin/nautilus --gapplication-service")
16:32:07 systemd: org.gnome.SettingsDaemon.Power.service: Failed with result 'core-dump'.
16:32:07 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.portal.Desktop'
16:32:07 systemd: org.gnome.SettingsDaemon.Power.service: Main process exited, code=dumped, status=11/SEGV
16:32:07 kernel: Failed to connect to coredump service: No such file or directory
16:32:07 kernel: FS:  00007f31a49f8e00 GS:  0000000000000000
16:32:07 kernel: R13: 0000000000000001 R14: 00007f3194016100 R15: 00007ffd031e3e80
16:32:07 kernel: R10: 0000000000000001 R11: a513148f7245f889 R12: 000056363f4d2080
16:32:07 kernel: RBP: 000056363f4d35e8 R08: 000056363fb4eec0 R09: 00007f31a87d2dd0
16:32:07 kernel: RDX: 0000000000000013 RSI: 00000000000001b4 RDI: 0000000000000000
16:32:07 kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000003
16:32:07 kernel: RSP: 002b:00007ffd031e3dc0 EFLAGS: 00010246
16:32:07 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:07 kernel: RIP: 0033:0x7f31a86c397f
16:32:07 kernel: CPU: 11 PID: 5663 Comm: gsd-power Not tainted 5.15.90.1-microsoft-standard-WSL2 #1
16:32:07 kernel: potentially unexpected fatal signal 11.
16:32:07 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:07 kernel: gsd-power[5663]: segfault at 8 ip 00007f31a86c397f sp 00007ffd031e3dc0 error 4 in libupower-glib.so.3.1.0[7f31a86b8000+e000]
16:32:07 gsd-power: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed
16:32:07 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:07 gsd-power: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
16:32:07 xdg-desktop-por: Failed connect to PipeWire: Couldn't connect to PipeWire
16:32:07 systemd: Started GNOME power management service.
16:32:07 gsd-power: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed
16:32:07 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:07 systemd: Starting GNOME power management service...
16:32:07 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.impl.portal.desktop.gtk'
16:32:07 systemd: org.gnome.SettingsDaemon.Power.service: Main process exited, code=dumped, status=11/SEGV
16:32:07 kernel: Failed to connect to coredump service: No such file or directory
16:32:07 kernel: FS:  00007f915ceb0e00 GS:  0000000000000000
16:32:07 kernel: R13: 0000000000000001 R14: 00007f9150016100 R15: 00007ffc6b0b04d0
16:32:07 kernel: R10: 0000000000000001 R11: 429b2b87c2b0dc28 R12: 000055d2ef8f6080
16:32:07 kernel: RBP: 000055d2ef8f75e8 R08: 000055d2efb71900 R09: 00007f9160c8add0
16:32:07 kernel: RDX: 0000000000000013 RSI: 00000000000001b4 RDI: 0000000000000000
16:32:07 kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000003
16:32:07 kernel: RSP: 002b:00007ffc6b0b0410 EFLAGS: 00010246
16:32:07 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:07 kernel: RIP: 0033:0x7f9160b7b97f
16:32:07 kernel: CPU: 11 PID: 5544 Comm: gsd-power Not tainted 5.15.90.1-microsoft-standard-WSL2 #1
16:32:07 kernel: potentially unexpected fatal signal 11.
16:32:07 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:07 kernel: gsd-power[5544]: segfault at 8 ip 00007f9160b7b97f sp 00007ffc6b0b0410 error 4 in libupower-glib.so.3.1.0[7f9160b70000+e000]
16:32:07 gsd-power: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed
16:32:07 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:07 gsd-power: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
16:32:06 systemd: Started GNOME power management service.
16:32:06 gsd-power: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 systemd: Starting Portal service (GTK/GNOME implementation)...
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.freedesktop.impl.portal.desktop.gtk' unit='xdg-desktop-portal-gtk.service' requested by ':1.44' (uid=1001 pid=4786 comm="/usr/lib/xdg-desktop-portal")
16:32:06 systemd: Starting GNOME power management service...
16:32:06 rtkit-daemon: Supervising 1 threads of 1 processes of 1 users.
16:32:06 systemd: org.gnome.SettingsDaemon.Power.service: Failed with result 'core-dump'.
16:32:06 rtkit-daemon: Supervising 1 threads of 1 processes of 1 users.
16:32:06 systemd: org.gnome.SettingsDaemon.Power.service: Main process exited, code=dumped, status=11/SEGV
16:32:06 rtkit-daemon: Supervising 1 threads of 1 processes of 1 users.
16:32:06 gnome-shell: Window manager warning: Overwriting existing binding of keysym ff52 with keysym ff52 (keycode 62).
16:32:06 kernel: Failed to connect to coredump service: No such file or directory
16:32:06 kernel: FS:  00007f2107e22e00 GS:  0000000000000000
16:32:06 kernel: R13: 0000000000000001 R14: 00007f20f8016cc0 R15: 00007ffc0bc7e290
16:32:06 kernel: R10: 0000000000000001 R11: 8c25ab6af43ee069 R12: 00005652a4719080
16:32:06 kernel: RBP: 00005652a471a5e8 R08: 00005652a5475ee0 R09: 00007f210bbfcdd0
16:32:06 kernel: RDX: 0000000000000013 RSI: 00000000000001b4 RDI: 0000000000000000
16:32:06 kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000003
16:32:06 kernel: RSP: 002b:00007ffc0bc7e1d0 EFLAGS: 00010246
16:32:06 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:06 kernel: RIP: 0033:0x7f210baed97f
16:32:06 kernel: CPU: 2 PID: 5427 Comm: gsd-power Not tainted 5.15.90.1-microsoft-standard-WSL2 #1
16:32:06 kernel: potentially unexpected fatal signal 11.
16:32:06 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:06 kernel: gsd-power[5427]: segfault at 8 ip 00007f210baed97f sp 00007ffc0bc7e1d0 error 4 in libupower-glib.so.3.1.0[7f210bae2000+e000]
16:32:06 gsd-power: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 gsd-power: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
16:32:06 systemd: Started Portal service (GNOME implementation).
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.impl.portal.desktop.gnome'
16:32:06 systemd: Started GNOME power management service.
16:32:06 gsd-power: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 gnome-shell: Failed to create colord device for 'xrandr-rdp0': could not check org.freedesktop.color-manager.create-device for auth: GDBus.Error:org.freedesktop.PolicyKit1.Error.NotAuthorized: Only trusted callers (e.g. uid 0 or an action owner) can use CheckAuthorization() for subjects belonging to other identities
16:32:06 NetworkManager: <info>  [1679067126.6095] agent-manager: agent[16fca5a514fe8335,:1.100/org.gnome.Shell.NetworkAgent/1001]: agent registered
16:32:06 systemd: Starting GNOME power management service...
16:32:06 gsd-media-keys: Unable to inhibit keypresses: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied
16:32:06 systemd: Stopped GNOME power management service.
16:32:06 xdg-desktop-por: Theme parser error: gtk.css:251:11-12: Expected a filter
16:32:06 systemd: Reached target Current graphical user session.
16:32:06 gsd-media-keys: Failed to grab accelerator for keybinding settings:next
16:32:06 kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
16:32:06 kernel: FS:  00007f74f07f3e00 GS:  0000000000000000
16:32:06 kernel: R13: 0000000000000001 R14: 00007f74e0016b40 R15: 00007fff9e796b40
16:32:06 kernel: R10: 0000000000000001 R11: 3271aca328eed1ed R12: 0000563cc18c4080
16:32:06 kernel: RBP: 0000563cc18c55e8 R08: 0000563cc20ad0b0 R09: 00007f74f45cddd0
16:32:06 kernel: RDX: 0000000000000013 RSI: 00000000000001b4 RDI: 0000000000000000
16:32:06 kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000003
16:32:06 kernel: RSP: 002b:00007fff9e796a80 EFLAGS: 00010246
16:32:06 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:06 kernel: RIP: 0033:0x7f74f44be97f
16:32:06 kernel: CPU: 8 PID: 5198 Comm: gsd-power Not tainted 5.15.90.1-microsoft-standard-WSL2 #1
16:32:06 kernel: potentially unexpected fatal signal 11.
16:32:06 kernel: Code: 10 48 89 d8 5b c3 0f 1f 44 00 00 ff 15 2a b3 00 00 48 8b 3c 24 89 c6 ba 13 00 00 00 ff 15 49 b2 00 00 48 8b 3c 24 85 c0 75 b8 <48> 8b 4f 08 48 8d 15 66 38 00 00 be 10 00 00 00 48 8d 3d a4 26 00
16:32:06 kernel: gsd-power[5198]: segfault at 8 ip 00007f74f44be97f sp 00007fff9e796a80 error 4 in libupower-glib.so.3.1.0[7f74f44b3000+e000]
16:32:06 gsd-media-keys: Failed to grab accelerator for keybinding settings:stop
16:32:06 gsd-power: up_client_get_devices_full: assertion 'UP_IS_CLIENT (client)' failed
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 gsd-power: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
16:32:06 systemd: Started Locale Service.
16:32:06 dbus-daemon: [system] Successfully activated service 'org.freedesktop.locale1'
16:32:06 gnome-shell: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
16:32:06 xdg-desktop-por: libEGL warning: DRI2: failed to authenticate
16:32:06 gsd-usb-protect: Failed to fetch USBGuard parameters: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.usbguard1 was not provided by any .service files
16:32:06 gnome-session-b: WARNING: Could not retrieve current screensaver active state: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Shell.ScreenShield was not provided by any .service files
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.gnome.ScreenSaver'
16:32:06 systemd: Starting Locale Service...
16:32:06 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.locale1' unit='dbus-org.freedesktop.locale1.service' requested by ':1.111' (uid=1001 pid=4710 comm="/usr/lib/gsd-keyboard")
16:32:06 systemd: Reached target GNOME keyboard shortcuts target.
16:32:06 gsd-media-keys: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 gsd-media-keys: Couldn't connect to proxy: Error calling StartServiceByName for org.freedesktop.UPower: Unit upower.service is masked.
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 systemd: Starting Portal service (GNOME implementation)...
16:32:06 gsd-power: up_client_get_lid_is_present: assertion 'UP_IS_CLIENT (client)' failed
16:32:06 dbus-daemon: [system] Activation via systemd failed for unit 'upower.service': Unit upower.service is masked.
16:32:06 systemd: Started GNOME keyboard configuration service.
16:32:06 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.UPower' unit='upower.service' requested by ':1.109' (uid=1001 pid=4717 comm="/usr/lib/gsd-power")
16:32:06 xdg-document-po: Ignoring invalid max threads value 4294967295 > max (100000).
16:32:06 systemd: Started flatpak document portal service.
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.portal.Documents'
16:32:06 systemd: Reached target GNOME color management target.
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.freedesktop.portal.Documents' unit='xdg-document-portal.service' requested by ':1.44' (uid=1001 pid=4786 comm="/usr/lib/xdg-desktop-portal")
16:32:06 systemd: Starting Portal service...
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.freedesktop.portal.Desktop' unit='xdg-desktop-portal.service' requested by ':1.20' (uid=1001 pid=4636 comm="/usr/bin/nautilus --gapplication-service")
16:32:06 systemd: Reached target GNOME sound sample caching target.
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Activating service name='org.gnome.ScreenSaver' requested by ':1.35' (uid=1001 pid=4737 comm="/usr/lib/gsd-usb-protection")
16:32:06 systemd: Reached target GNOME RFKill support target.
16:32:06 gnome-shell: JS ERROR: TypeError: this._managerProxy is undefined
_onGeoclueVanished@resource:///org/gnome/shell/ui/status/location.js:163:9

16:32:06 systemd: Reached target GNOME USB protection target.
16:32:06 gnome-shell: Failed to launch ibus-daemon: Failed to execute child process “ibus-daemon” (No such file or directory)
16:32:06 systemd: Reached target GNOME smartcard target.
16:32:06 gnome-shell: Error loading calendars: Error calling StartServiceByName for org.gnome.Shell.CalendarServer: Process org.gnome.Shell.CalendarServer exited with status 127
16:32:06 systemd: Starting GNOME FreeDesktop screensaver service...
16:32:06 nautilus: Theme parser error: gtk.css:251:11-12: Expected a filter
16:32:06 systemd: Starting GNOME maintenance of expirable data service...
16:32:06 gnome-session-b: Entering running state
16:32:06 systemd: Starting GNOME color management service...
16:32:06 gnome-shell: Error calling StartServiceByName for org.freedesktop.UPower: Unit upower.service is masked.
16:32:06 at-spi2-registr: SpiRegistry daemon is running with well-known name - org.a11y.atspi.Registry
16:32:06 dbus-daemon: dbus-daemon[4547]: Successfully activated service 'org.a11y.atspi.Registry'
16:32:06 kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
16:32:06 dbus-daemon: [session uid=1001 pid=4524] Activating service name='org.gnome.Shell.Notifications' requested by ':1.17' (uid=1001 pid=4570 comm="/usr/bin/gnome-shell")
16:32:06 nautilus: libEGL warning: DRI2: failed to authenticate
16:32:05 gnome-shell: loading user theme: /usr/share/themes/Tokyonight-Dark-B/gnome-shell/gnome-shell.css
16:32:05 dbus-daemon: [session uid=1001 pid=4524] Activating service name='org.freedesktop.FileManager1' requested by ':1.17' (uid=1001 pid=4570 comm="/usr/bin/gnome-shell")
16:32:05 systemd: Started Hostname Service.
16:32:05 dbus-daemon: [system] Successfully activated service 'org.freedesktop.hostname1'
16:32:05 gnome-shell: failed to get settings for org.gnome.shell.extensions.pop-cosmic: Error: GSettings schema org.gnome.shell.extensions.pop-cosmic not found
16:32:05 systemd: Starting Hostname Service...
16:32:05 dbus-daemon: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.100' (uid=1001 pid=4570 comm="/usr/bin/gnome-shell")
16:32:05 gnome-shell: Error creating proxy: Error calling StartServiceByName for org.gtk.vfs.UDisks2VolumeMonitor: Unit gvfs-udisks2-volume-monitor.service is masked. (g-io-error-quark, 36)
16:32:05 dbus-daemon: [session uid=1001 pid=4524] Activation via systemd failed for unit 'gvfs-udisks2-volume-monitor.service': Unit gvfs-udisks2-volume-monitor.service is masked.
16:32:05 gnome-shell: Telepathy is not available, chat integration will be disabled.
16:32:05 polkitd: Registered Authentication Agent for unix-session:c6 (system bus name :1.100 [/usr/bin/gnome-shell], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
16:32:05 dbus-daemon: [system] Activation via systemd failed for unit 'geoclue.service': Unit geoclue.service is masked.
16:32:05 systemd: Started sandboxed app permission store.
16:32:05 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.freedesktop.impl.portal.PermissionStore'
16:32:05 gnome-shell-cal: /usr/lib/gnome-shell-calendar-server: error while loading shared libraries: libecal-2.0.so.2: cannot open shared object file: No such file or directory
16:32:05 systemd: Starting sandboxed app permission store...
16:32:05 dbus-daemon: [session uid=1001 pid=4524] Activating service name='org.gnome.Shell.CalendarServer' requested by ':1.17' (uid=1001 pid=4570 comm="/usr/bin/gnome-shell")
16:32:05 gnome-shell: ATK Bridge is disabled but a11y has already been enabled.
16:32:05 kernel: misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
16:32:05 gnome-shell: Running GNOME Shell (using mutter 43.3) as a X11 window and compositing manager
16:32:05 systemd: Condition check resulted in GNOME Shell on Wayland being skipped.
16:32:05 gnome-keyring-d: discover_other_daemon: 1
16:32:05 systemd: Started Application launched by gnome-session-binary.
16:32:05 gnome-session-b: WARNING: Could not parse desktop file check-xrdp-rfx.desktop or it references a not found TryExec binary
16:32:04 systemd: Starting GNOME Session Manager (session: gnome)...
16:32:04 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.a11y.Bus'
16:32:04 systemd: Starting Accessibility services bus...
16:32:04 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.a11y.Bus' unit='at-spi-dbus-bus.service' requested by ':1.6' (uid=1001 pid=4526 comm="/usr/lib/gnome-session-check-accelerated")
16:32:04 systemd: Started Virtual filesystem service.
16:32:04 dbus-daemon: [session uid=1001 pid=4524] Successfully activated service 'org.gtk.vfs.Daemon'
16:32:04 systemd: Starting Virtual filesystem service...
16:32:04 dbus-daemon: [session uid=1001 pid=4524] Activating via systemd: service name='org.gtk.vfs.Daemon' unit='gvfs-daemon.service' requested by ':1.3' (uid=1001 pid=4526 comm="/usr/lib/gnome-session-check-accelerated")
16:32:04 systemd: Started D-Bus User Message Bus.

So, as said in the previous comment, most probably the WslApiLoader::WslConfigureDistribution() function performs some strange tasks on the UID of the user created during the installation that causes xrdp to crash.

apollo and venereseem to have the following differences:

  1. When apollo is created during the installation, the /run/user folder already contains 1000 folder related to apollo. In case there was a preconfigured user account (like athena, the owner of that folder is notapollo, but it isathena.veneredoes not have the1001` folder after its creation.
  2. What I'm noting is the permissions on /run/user/ folder at group level:

     sudo ls -la /run/user
    
     total 0
    drwxr-xr-x  5 root   root  100 Mar 17 16:21 .
    drwxr-xr-x 21 root   root  520 Mar 17 16:01 ..
    drwx------ 14 apollo sudo  360 Mar 17 16:10 0
    drwx------ 14 apollo sudo  360 Mar 17 16:10 1000
    drwx------ 10 venere users 240 Mar 17 16:21 1001

    They have different group ownership.

I further created an image where I didn't use the WslApiLoader::WslConfigureDistribution() and I noted that, after the installation, the /run/user/1000 folder is not created, and the xrdp client works. So, specifically, it could be that WslApiLoader::WslConfigureDistribution() creates the /run/user/1000 folder for the account created during the installation but with wrong files and wrong permissions, maybe... I don't know if the content of /run/user/1000 it is related to the error above on gnome-logs

16:09:32 gnome-session-c: gnome-session-check-accelerated: no X11 display found
D3vil0p3r commented 1 year ago

I solved the issue by deleting the /run/user/1000 folder content after the creation of the user during the installation.

After this deletion, I can connect by xrdp client by the user.

D3vil0p3r commented 1 year ago

Hello @matt335672 Just for improving the chance to fix similar issues. In a GNOME environment, xrdp client could crash at login time also if /run/user/100x directory contains wayland-0 and wayland-0.lock files. They are created in environments (like WSL) after the shutdown and the restart of WSL process because Wayland is the default Window System in GNOME, I'm not sure if it can occur also on docker containers. By removing them by rm -rf /run/user/100x/wayland-0*, gnome-shell is able again to find a DISPLAY and XRDP client starts to work again.

matt335672 commented 1 year ago

Here's another possibility for you:-

export XDG_SESSION_TYPE=x11
export GDK_BACKEND=x11

Found on the excellent Arch wiki:-

https://wiki.archlinux.org/title/GNOME