xrdp-sesman fails to start at bootup

Bug #1766695 reported by Nikolas Britton on 2018-04-24
This bug affects 6 people
Affects Status Importance Assigned to Milestone
xrdp (Ubuntu)

Bug Description

Ubuntu 18.04: xrdp fails to start because xrdp-sesman fails to start at bootup. It appears to fail because it tries to start before the network is fully up. This may be related to disabling IPv6. If I add "ExecStartPre=/bin/sleep 20" to /lib/systemd/system/xrdp-sesman.service the service will then start successfully at bootup, so it appears this is simply a systemd timing issue. I tried charging network.target to network-online.target but that didn't resolve the problem.

This is the error message I get:

cat /var/log/xrdp-sesman.log
[20180424-13:20:06] [DEBUG] libscp initialized
[20180424-13:20:07] [INFO ] starting xrdp-sesman with pid 2149
[20180424-13:20:07] [INFO ] IPv6 not supported, falling back to IPv4
[20180424-13:20:07] [INFO ] IPv6 not supported, falling back to IPv4
[20180424-13:20:07] [DEBUG] Testing if xrdp-sesman can listen on port 3350.
[20180424-13:20:07] [INFO ] listening to port 3350 on
[20180424-13:20:07] [ERROR] bind_loopback(5, 3350) failed; IPv6 ::1 (errno=97), IPv4 (errno=98) and IPv6 ::FFFF: (errno=97).
[20180424-13:20:07] [ERROR] Failed to start xrdp-sesman daemon, possibly address already in use.
[20180424-13:20:07] [INFO ] shutting down sesman 1
[20180424-13:20:07] [DEBUG] Closed socket 7 (AF_INET

Add "ExecStartPre=/bin/sleep 20" to the [Service] section of /lib/systemd/system/xrdp-sesman.service

The script below will setup my environment:

### Install packages;
apt update;
apt upgrade -y;
apt install -y qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker virt-manager xrdp xfce4 firefox xfce4-terminal nmap iotop;

### Disable IPv6 due to bugs... ####
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=""/GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"/' /etc/default/grub;

### Setup Network Dummy Interfaces ###
printf "[NetDev]\nName=dummy1\nKind=dummy\n" > /etc/systemd/network/dummy1.netdev;
printf "[NetDev]\nName=dummy2\nKind=dummy\n" > /etc/systemd/network/dummy2.netdev;
systemctl restart systemd-networkd.service;

### Netplan configuration ###
cat << 'EOF' > /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
  version: 2
  renderer: networkd

    eno3: {}
    eno4: {}
    dummy1: {}
    dummy2: {}

      id: 10
      link: vbridge2
      addresses: []
      id: 20
      link: vbridge2
      addresses: []

      interfaces: [eno3, eno4]

      interfaces: [bond1]
      addresses: []
        addresses: [,]
      interfaces: [dummy1]
      addresses: []
      interfaces: [dummy2]
netplan apply;

### Enable nested virtualization ###
echo "options kvm-intel nested=y" >> /etc/modprobe.d/kvm.conf;

### Enable XRDP server ###
ufw allow 3389/tcp;
echo "xfce4-session" > /root/.xession;
echo "xfce4-session" > /home/nbritton/.xession;
echo "xfce4-session" >> /etc/xrdp/startwm.sh;
sed -i '/\/etc\/X11\/Xsession/ s/^/#/' /etc/xrdp/startwm.sh;
systemctl restart xrdp;
### End ###

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: xrdp 0.9.5-2 [modified: lib/systemd/system/xrdp-sesman.service]
ProcVersionSignature: Ubuntu 4.15.0-19.20-generic 4.15.17
Uname: Linux 4.15.0-19-generic x86_64
ApportVersion: 2.20.9-0ubuntu6
Architecture: amd64
Date: Tue Apr 24 13:56:50 2018
InstallationDate: Installed on 2018-04-24 (0 days ago)
InstallationMedia: Ubuntu-Server 18.04 LTS "Bionic Beaver" - Release amd64 (20180424.1)
 PATH=(custom, no user)
SourcePackage: xrdp
UpgradeStatus: No upgrade log present (probably fresh install)
mtime.conffile..etc.xrdp.startwm.sh: 2018-04-24T12:58:12.608318

Revision history for this message
Nikolas Britton (nbritton) wrote :
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xrdp (Ubuntu):
status: New → Confirmed
Revision history for this message
João Pedro Seara (jpseara) wrote :

Noticed a similar issue today. With the difference that in my case, sesman would never come up. Found out that I was hitting [1]. Had to use workaround from [2].

Complete workaround was:

Fix was:

1. sudo bash -c 'export SYSTEMD_EDITOR="/usr/bin/vi" && systemctl edit xrdp-sesman.service'

2. sudo systemctl edit xrdp-sesman

ExecStartPre=/bin/sleep 20

Save the file.

3. sudo vi /etc/default/xrdp


4. sudo systemctl stop xrdp-sesman xrdp

5. sudo systemctl start xrdp-sesman xrdp

[1] https://github.com/neutrinolabs/xrdp/issues/1652
[2] https://github.com/neutrinolabs/xrdp/issues/1652#issuecomment-675387354

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.