xrdp-sesman fails to start at bootup

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

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 127.0.0.1 port 3350.
[20180424-13:20:07] [INFO ] listening to port 3350 on 127.0.0.1
[20180424-13:20:07] [ERROR] bind_loopback(5, 3350) failed; IPv6 ::1 (errno=97), IPv4 127.0.0.1 (errno=98) and IPv6 ::FFFF:127.0.0.1 (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 127.0.0.1:3350)

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

The script below will setup my environment:
#!/bin/bash

### 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).
network:
  version: 2
  renderer: networkd

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

  vlans:
    vbridge2-vlan10:
      id: 10
      link: vbridge2
      addresses: [10.11.1.2/24]
    vbridge2-vlan20:
      id: 20
      link: vbridge2
      addresses: [10.11.2.2/24]

  bonds:
    bond1:
      interfaces: [eno3, eno4]

  bridges:
    lab:
      interfaces: [bond1]
      addresses: [10.10.2.2/16]
      gateway4: 10.10.0.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]
    vbridge1:
      interfaces: [dummy1]
      addresses: [10.11.0.2/24]
    vbridge2:
      interfaces: [dummy2]
EOF
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)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
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

[Service]
Type=simple
ExecStartPre=/bin/sleep 20

Save the file.

3. sudo vi /etc/default/xrdp

SESMAN_OPTIONS="-n"

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.