[winswitch] Xpra as a systemd service

Ben Sferrazza Benjamin.Sferrazza at skyworksinc.com
Fri Apr 19 21:19:45 BST 2019


starting a new email thread, since the old one's subject was invalid
and the use of OWA was messing up the quoting. Sorry for the trouble.

Background:
* I have one desktop PC at work with Ubuntu on it and a Windows laptop
* /home is an NFS mount and uses NIS
* I'd like to have the desktop start an Xpra desktop as a systemd
service so that I can both access it from the same desktop and from the
laptop when working from home
* Ideally it would auto-connect to the existing desktop in the event of
power failure or planned maintenance where my desktop PC is powered
down when I'm not in the office
* I've tried following the ArchLinux wiki on setting Xpra up as a
service without success

Here's my /etc/systemd/system/xpra at .service file:

[Unit]
Description=Xpra Remote Desktop
After=syslog.target network.target nfs-home.mount gdm.service

[Service]
Type=simple
User=%i
EnvironmentFile=/etc/conf.d/xpra
Environment="XDG_RUNTIME_DIR=~/.local"
ExecStart=/usr/bin/xpra --no-daemon --bind-tcp=0.0.0.0:10000 --socket-
dir=~/.xpra start-desktop --start=startxfce4 ${%i}

[Install]
WantedBy=multi-user.target


I enabled the service using 'sudo systemctl enable 
xpra at myusername.service'


The results are as follows:
* The Xpra process is running, as shown by 'ps aux | grep xpra'
* I cannot simply run 'xpra attach' on the same desktop PC. It reports
that no live Xpra sessions are running
* I CAN attach to it when explicitly specifying the tcp port by 'xpra
attach tcp:localhost:10000'
* I cannot attach to it from the Windows laptop

Here's the relevant logging from syslog. It complains of
XDG_RUNTIME_DIR not being set despite trying to do so within the system
unit. Apparently that's not working properly. The ownership of /run is
root:root with 755 permissions. Not sure if that needs to be changed
for xpra to create the socket there, though using '--socket-
dir=~/.xpra' does allow it to create it under my home directory.


Apr 19 12:57:00 l-myusername xpra[2562]: 2019-04-19 12:57:00,179
Warning: failed to create socket directory '/run/user/10345/xpra'
Apr 19 12:57:00 l-myusername xpra[2562]: 2019-04-19
12:57:00,179  [Errno 2] No such file or directory:
'/run/user/10345/xpra'
Apr 19 12:57:00 l-myusername xpra[2562]: 2019-04-19 12:57:00,301
Warning: some of the sockets are in an unknown state:
Apr 19 12:57:00 l-myusername xpra[2562]: 2019-04-19
12:57:00,301  /home/myusername/.xpra/l-myusername.avnera.com-2
Apr 19 12:57:00 l-myusername xpra[2562]: 2019-04-19
12:57:00,301  please wait as we allow the socket probing to timeout
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19 12:57:06,346
created unix domain socket: /home/myusername/.xpra/l-
myusername.avnera.com-2
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19 12:57:06,346
Warning: cannot create socket '/run/user/10345/xpra/l-
myusername.avnera.com-2':
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19
12:57:06,346  [Errno 2] No such file or directory
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19
12:57:06,347  ($XDG_RUNTIME_DIR has not been created?)
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19 12:57:06,347 cannot
create group socket '/run/xpra/l-myusername.avnera.com-2'
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19
12:57:06,347  [Errno 13] Permission denied
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19 12:57:06,355  user
'myusername' is a member of groups: adm, cdrom, sudo, dip, plugdev,
lpadmin, sambashare, xpra, eng
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19
12:57:06,355   permissions on directory /run/xpra: 0775
Apr 19 12:57:06 l-myusername xpra[2562]: 2019-04-19
12:57:06,355   ownership root:xpra
Apr 19 12:57:07 l-myusername xpra[2562]: 2019-04-19 12:57:07,038
pointer device emulation using XTest
Apr 19 12:57:07 l-myusername xpra[2562]: 2019-04-19 12:57:07,112
serving html content from: /usr/share/xpra/www
Apr 19 12:57:10 l-myusername xpra[2562]: 2019-04-19
12:57:10,518  OpenGL is supported on display ':2'
Apr 19 12:57:10 l-myusername xpra[2562]: 2019-04-19 12:57:10,519  using
'llvmpipe (LLVM 7.0, 256 bits)' renderer
Apr 19 12:57:10 l-myusername xpra[2562]: 2019-04-19 12:57:10,860 D-Bus
notification forwarding is available
Apr 19 12:57:11 l-myusername xpra[2562]: 2019-04-19 12:57:11,989
Warning: webcam forwarding is disabled
Apr 19 12:57:11 l-myusername xpra[2562]: 2019-04-19 12:57:11,989  the
virtual video directory '/sys/devices/virtual/video4linux' was not
found
Apr 19 12:57:11 l-myusername xpra[2562]: 2019-04-19 12:57:11,989  make
sure that the 'v4l2loopback' kernel module is installed and loaded
Apr 19 12:57:11 l-myusername xpra[2562]: 2019-04-19 12:57:11,989 found
0 virtual video devices for webcam forwarding
Apr 19 12:57:12 l-myusername xpra[2562]: 2019-04-19 12:57:12,042
pulseaudio server started with pid 3213
Apr 19 12:57:12 l-myusername xpra[2562]: 2019-04-19
12:57:12,043  private server socket path:
Apr 19 12:57:12 l-myusername xpra[2562]: 2019-04-19
12:57:12,043  '/home/myusername/.local/xpra/pulse-2/pulse/native'
Apr 19 12:57:12 l-myusername xpra[2562]: W: [pulseaudio] pid.c: Stale
PID file, overwriting.
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19 12:57:13,274
GStreamer version 1.14.4 for Python 2.7.15 64-bit
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19 12:57:13,705 xpra
GTK2 X11 desktop version 2.5.1-r22431 64-bit
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19
12:57:13,707  uid=10345 (myusername), gid=1001 (eng)
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19
12:57:13,707  running with pid 2562 on Linux Ubuntu 18.10 cosmic
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19
12:57:13,707  connected to X11 display :2 with 24 bit colors
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19 12:57:13,708   :2.0
(2167x1084 mm - DPI: 96x95)
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19
12:57:13,708     monitor 2
Apr 19 12:57:13 l-myusername xpra[2562]: 2019-04-19 12:57:13,919 xpra
is ready.
Apr 19 12:57:52 l-myusername xpra[2562]: 2019-04-19 12:57:52,520
printer forwarding enabled using postscript and pdf
Apr 19 12:57:52 l-myusername xpra[2562]: /usr/bin/startxfce4: X server
already running on display :2
Apr 19 12:57:53 l-myusername xpra[2562]: 2019-04-19 12:57:53,695 15.6GB
of system memory
Apr 19 12:57:53 l-myusername xpra[2562]: gpg-agent[4015]: WARNING: "
--write-env-file" is an obsolete option - it has no effect
Apr 19 12:57:54 l-myusername xpra[2562]: gpg-agent: a gpg-agent is
already running - not starting a new one
Apr 19 12:57:54 l-myusername xpra[2562]: sh: 1: /usr/bin/nvidia-
settings: not found
Apr 19 12:57:54 l-myusername xpra[2562]: exception: Failed to open
/etc/mpd.conf: Permission denied
Apr 19 12:57:55 l-myusername xpra[2562]: Indicator stickynotes already
running.


More information about the shifter-users mailing list