Skip to content

Instantly share code, notes, and snippets.

@smoser
Created February 7, 2022 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smoser/3c3981909e019c0cafb6ad7d95893cbc to your computer and use it in GitHub Desktop.
Save smoser/3c3981909e019c0cafb6ad7d95893cbc to your computer and use it in GitHub Desktop.
xrdp server setup used for first robotics / wpilib

xrdp and lxc

This is a half-done attempt at making a rdp server in lxc. It was largely based on ubuntu-xrdp. I'm not sure all of the things are necessary, but the result is a functional xrdp server.

I did this to see if it is feasible to host remote development system for students.

At least one annoyance is that on linux you cannot install "for all users", so each user would end up with ~2.6G of ~/wpilib. That also manifests itself in updating dev tools.

build container

from ubuntu-xrdp

$ lxc launch ubuntu-daily:focal rdp-build
$ lxc exec rdp-build /bin/bash
% apt-get update
% apt-get install --no-install-recommends build-essential
% apt-get build-dep pulseaudio
% apt-get source pulseaudio
% cd pulseaudio-13.99.1
% dpkg-buildpackage -rfakeroot -uc -b
% cd ..
% sudo apt-get install --no-install-recommends libpam0g-dev nasm
% git clone --branch devel --recursive https://github.com/neutrinolabs/xrdp.git
% ./bootstrap && ./configure && make && make install
% cd ..
% apt-get install --no-install-recommends install libpulse-dev 
% git clone --recursive https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
% cd pulseaudio-module-xrdp
% ./bootstrap && ./configure PULSE_DIR=/root/pulseaudio-13.99.1
% make
% mkdir -p /tmp/so
% cp src/.libs/*.so /tmp/so
% tar -C /tmp -cvf /root/so.tar.gz so/

apt-get source pulseaudio

:q https://gist.githubusercontent.com/smoser/5823699/raw/7c074a7fbb08946d1ccc50a98fb3c82d0fc93023/apt-go-fast

build the runtime system

$ lxc launch ubuntu-minimal:focal frc
$ lxc exec frc /bin/bash
% wget -O apt-go-fast https://gist.githubusercontent.com/smoser/5823699/raw/apt-go-fast
% sh ./apt-go-fast
% export DEBIAN_FRONTEND=noninteractive
% apt-get update
% apt-get install -qy \
    ca-certificates crudini less locales openssh-server \
    pulseaudio sudo uuid-runtime vim wget xauth xautolock \
    xfce4 \
      xfce4-clipman-plugin \
      xfce4-cpugraph-plugin \
      xfce4-netload-plugin \
      xfce4-screenshooter \
      xfce4-taskmanager \
      xfce4-terminal \
      xfce4-xkb-plugin \
      xorgxrdp \
      xprintidle \
      xrdp \
      git

% apt remove -y light-locker xscreensaver 
% apt autoremove -y

$ lxc file pull rdp-build/root/so.tar.gz /tmp
$ lxc file push /tmp/so.tar.gz frc/tmp
$ lxc exec frc/ /bin/bash
% mkdir -p /var/lib/xrdp-pulseaudio-installer
% tar -C /var/lib/xrdp-pulseaudio-installer -xf /tmp/so.tar.gz
% cd /root
% git clone https://github.com/danielguerra69/ubuntu-xrdp.git
% cd ubuntu-xrdp

% cp bin/* /bin
% cp -rv etc/* /etc/
% cp autostart/* /etc/xdg/autostart/
% cp /etc/X11/xrdp/xorg.conf /etc/X11/
% sed -i "s/console/anybody/g" /etc/X11/Xwrapper.config
% sed -i "s/xrdp\/xorg/xorg/g" /etc/xrdp/sesman.ini
% locale-gen en_US.UTF-8
% echo "pulseaudio -D --enable-memfd=True" > /etc/skel/.Xsession && \
% echo "xfce4-session" >> /etc/skel/.Xsession && \
% rm -rf /etc/xrdp/rsakeys.ini /etc/xrdp/*.pem

# generate xrdp key
% [ -f "/etc/xrdp/rsakeys.ini" ] || xrdp-keygen xrdp auto
% 

% echo "export QT_XKB_CONFIG_ROOT=/usr/share/X11/locale" >> /etc/profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment