Switching Between Desktop Environments

To switch between desktop environments on a Debian based distro run the following command:

sudo update-alternatives --config x-session-manager

Then you should be presented with the desktop environments you have installed on your system so you can choose one of them:

There are 7 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).

Selection Path Priority Status
* 0 /usr/bin/mate-session 50 auto mode
1 /usr/bin/cinnamon-session 50 manual mode
2 /usr/bin/gnome-session 50 manual mode
3 /usr/bin/mate-session 50 manual mode
4 /usr/bin/startplasma-x11 40 manual mode
5 /usr/bin/startxfce4 50 manual mode
6 /usr/bin/xfce4-session 40 manual mode
7 /usr/libexec/gnome-flashback-metacity 40 manual mode

Press to keep the current choice[*], or type selection number:2
update-alternatives: using /usr/bin/gnome-session to provide /usr/bin/x-session-manager (x-session-manager) in manual mode

Then you can fill in the number corresponding to the desktop environment that you want and press enter.

Then you can logout and log back in, and the desktop launched should be the one that you selected.

This article show how to install xrdp on Debian 11. This assumes you have no desktop installed. If you have a desktop, then you can omit the install for it below.

sudo apt update
sudo apt -y install xrdp
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
Suggested packages:
  guacamole xrdp-pulseaudio-installer
The following NEW packages will be installed:
  xorgxrdp xrdp
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 506 kB of archives.
After this operation, 3,238 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 xrdp amd64 0.9.12-1.1 [446                                                                                                                                                             kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 xorgxrdp amd64 1:0.2.12-1                                                                                                                                                             [59.9 kB]
Fetched 506 kB in 1s (791 kB/s)
Selecting previously unselected package xrdp.
(Reading database ... 141298 files and directories currently installed.)
Preparing to unpack .../xrdp_0.9.12-1.1_amd64.deb ...
Unpacking xrdp (0.9.12-1.1) ...
Selecting previously unselected package xorgxrdp.
Preparing to unpack .../xorgxrdp_1%3a0.2.12-1_amd64.deb ...
Unpacking xorgxrdp (1:0.2.12-1) ...
Setting up xrdp (0.9.12-1.1) ...

Generating 2048 bit rsa key...

ssl_gen_key_xrdp1 ok

saving to /etc/xrdp/rsakeys.ini

Created symlink /etc/systemd/system/multi-user.target.wants/xrdp-sesman.service →                                                                                                                                                             /lib/systemd/system/xrdp-sesman.service.
Created symlink /etc/systemd/system/multi-user.target.wants/xrdp.service → /lib/s                                                                                                                                                            ystemd/system/xrdp.service.
Setting up xorgxrdp (1:0.2.12-1) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
sudo systemctl status xrdp
● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-03-26 08:28:09 CDT; 3min 35s ago
       Docs: man:xrdp(8)
    Process: 3663 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
    Process: 3671 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 3672 (xrdp)
      Tasks: 1 (limit: 4663)
     Memory: 768.0K
        CPU: 17ms
     CGroup: /system.slice/xrdp.service
             └─3672 /usr/sbin/xrdp

Mar 26 08:28:08 testing xrdp[3671]: (3671)(139708485990208)[INFO ] address [] port [3389] mode 1
Mar 26 08:28:08 testing xrdp[3671]: (3671)(139708485990208)[INFO ] listening to port 3389 on
Mar 26 08:28:08 testing xrdp[3671]: (3671)(139708485990208)[INFO ] xrdp_listen_pp done
Mar 26 08:28:08 testing xrdp[3671]: (3671)(139708485990208)[DEBUG] Closed socket 7 (AF_INET6 :: port 3389)
Mar 26 08:28:08 testing systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not permitted
Mar 26 08:28:09 testing systemd[1]: Started xrdp daemon.
Mar 26 08:28:10 testing xrdp[3672]: (3672)(139708485990208)[INFO ] starting xrdp with pid 3672
Mar 26 08:28:10 testing xrdp[3672]: (3672)(139708485990208)[INFO ] address [] port [3389] mode 1
Mar 26 08:28:10 testing xrdp[3672]: (3672)(139708485990208)[INFO ] listening to port 3389 on
Mar 26 08:28:10 testing xrdp[3672]: (3672)(139708485990208)[INFO ] xrdp_listen_pp done
sudo adduser xrdp ssl-cert
Adding user `xrdp' to group `ssl-cert' ...
Adding user xrdp to group ssl-cert
sudo ufw allow 3389
sudo systemctl restart xrdp


Try to RDP to the server. For Debian 11, The XRDP package results in an error.

The problem seems to happens only with Gnome Desktop. Based the the bug/issue reported to the team behind xrdp software (see https://github.com/neutrinolabs/xorgxrdp/issues/156), the problem is only present when using the xorgxrdp package version 0.2.12. this is a known issue with version xorgxrdp-0.2.12.
The proposed solution is to upgrade to a previous versions xrdp 0.9.15-1 and xorgxrdp 1:0.2.15-1.

These versions are still compatible with libc6 on Debian Bullseye. This is important to note, because I initially tried newer versions of xorgxrdp and xrdp and one of them required a newer version of libc6.

Until a backport is available (mailing list to ask for a backport to bullseye-backports can be found here: https://lists.debian.org/debian-backports/) you can download xrdp 0.9.15-1 and xorgxrdp 1:0.2.15-1 via https://snapshot.debian.org/
Those package versions were still compatible with libc6 from bullseye.

# wget https://snapshot.debian.org/archive/debian/20210302T032219Z/pool/main/x/xorgxrdp/xorgxrdp_0.2.15-1_amd64.deb
# wget https://snapshot.debian.org/archive/debian/20210302T032219Z/pool/main/x/xrdp/xrdp_0.9.15-1_amd64.deb
# sudo apt install ./xorgxrdp_0.2.15-1_amd64.deb
# sudo apt install ./xrdp_0.9.15-1_amd64.deb

Now, RDP should work.