Check Debian Version on Debian website:
https://www.debian.org/releases/
Check version on system:

$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Or

$ sudo cat /etc/os-release

USERS SHOULD BACKUP ALL DATA before attempting a release upgrade – SEE https://wiki.debian.org/DebianStability

Only after the back – do the following:

Ensure your system is up-to-date in it’s current release.

$ sudo apt update
$ sudo apt upgrade

If you haven’t already, ensure all backups are up-to-date.

Make a backup of the /etc/apt/sources.list file:

$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

In a text editor, replace the codename of your release with that of the next release in APT’s package sources
For instance, the line:

deb https://deb.debian.org/debian/ buster main

should be replaced with

deb https://deb.debian.org/debian/ bullseye main
$ sudo nano /etc/apt/sources.list 

# Clean and update package lists

$ sudo apt clean
$ sudo apt update

Perform the major release upgrade, removing packages if required

$ sudo apt full-upgrade

Remove packages that are not required anymore. Be sure to review this list: you may want to keep some of them

$ sudo apt autoremove

Reboot to make changes effective (optional, but recommended)

$ sudo shutdown -r now

Error on update with Debian 11 and MySql 8. On apt update…

# apt-get update
Get:1 http://repo.mysql.com/apt/debian bullseye InRelease [12.9 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Hit:4 http://security.debian.org/debian-security bullseye-security InRelease
Err:1 http://repo.mysql.com/apt/debian bullseye InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
Hit:5 https://repo.zabbix.com/zabbix/6.0/ubuntu focal InRelease
Fetched 52.2 kB in 1s (85.6 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.mysql.com/apt/debian bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
W: Failed to fetch http://repo.mysql.com/apt/debian/dists/bullseye/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
W: Some index files failed to download. They have been ignored, or old ones used instead.

Now Run…

# sudo apt-get clean
# sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 3A79BD29
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.7TRQcyvu7f/gpg.1.sh --keyserver pgp.mit.edu --recv-keys 3A79BD29
gpg: key 467B942D3A79BD29: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Then update

# sudo apt-get update
Get:1 http://repo.mysql.com/apt/debian bullseye InRelease [12.9 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Hit:4 http://security.debian.org/debian-security bullseye-security InRelease
Hit:5 https://repo.zabbix.com/zabbix/6.0/ubuntu focal InRelease
Get:6 http://repo.mysql.com/apt/debian bullseye/mysql-8.0 Sources [942 B]
Get:7 http://repo.mysql.com/apt/debian bullseye/mysql-apt-config amd64 Packages [567 B]
Get:8 http://repo.mysql.com/apt/debian bullseye/mysql-8.0 amd64 Packages [8,435 B]
Get:9 http://repo.mysql.com/apt/debian bullseye/mysql-tools amd64 Packages [6,904 B]
Fetched 29.7 kB in 1s (25.3 kB/s)
Reading package lists... Done

  
				 			
			

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:
  xorgxrdp
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)
             man:xrdp.ini(5)
    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 [0.0.0.0] port [3389] mode 1
Mar 26 08:28:08 testing xrdp[3671]: (3671)(139708485990208)[INFO ] listening to port 3389 on 0.0.0.0
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 [0.0.0.0] port [3389] mode 1
Mar 26 08:28:10 testing xrdp[3672]: (3672)(139708485990208)[INFO ] listening to port 3389 on 0.0.0.0
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
Done.
sudo ufw allow 3389
sudo systemctl restart xrdp

MAKE SURE YOU ARE LOGGED OUT OF THE SERVER TO TEST RDP. NOW RDP TO THE SERVER.

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.