New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem found with Debian systems running systemd #190

Closed
scarygliders opened this Issue Nov 25, 2014 · 14 comments

Comments

Projects
None yet
5 participants
@scarygliders

scarygliders commented Nov 25, 2014

I've found an issue on my Debian Jessie/Sid system where I was testing my X11RDP-o-Matic script and found that after installation of the created packages for the v0.9 branch of the xrdp and X11rdp, the xrdp daemons would not start.

After a bit of investigation it appears that the xrdp configure script is testing if systemd is installed on a system and generates xrdp.system and xrdp-sesman.system in /lib/systemd/system/

On my Jessie/Sid system, attempting to start xrdp after installation causes systemd to report an error.
I couldn't check whether the package works on Ubuntu.

If I remove those two files, and issue a systemctl daemon-reload, then systemctl start xrdp, both xrdp and xrdp-sesman start fine.

The Debian Jessie/Sid-supplied xrdp package (still using an ancient v0.6 version of xrdp!) does not have these .system files, which gave me the idea of where to look for the problem.

I suggest that some kind of option to not create these .system files be included in the xrdp configure script, or that some way is found to make the .system files generated by the xrdp build process be made to work with Debian.

@vincentkersten

This comment has been minimized.

vincentkersten commented Dec 3, 2014

I can confirm this for the 0.9.0 build. rm /lib/systemd/system/xrdp* && rm /etc/systemd/system/multi-user.target.wants/xrdp* && insserv xrdp && systemctl --system daemon-reload && service xrdp start

@vincentkersten

This comment has been minimized.

vincentkersten commented Feb 17, 2015

Coming back to this: There are a few issues with the CentoS systemd scrips on debian.

I adapted them for Debian jessie + systemd + xrdp0.9.0 scarygliders compile

/etc/systemd/system/xrdp.service

[Unit]
Description=xrdp daemon
Requires=xrdp-sesman.service
After=syslog.target network.target xrdp-sesman.service

[Service]
Type=forking
PIDFile=/var/run/xrdp/xrdp.pid
ExecStartPre=/bin/mkdir -p /var/run/xrdp
ExecStart=/usr/sbin/xrdp 
ExecStop=/usr/sbin/xrdp  --kill

[Install]
WantedBy=multi-user.target

/etc/systemd/system/xrdp-sesman.service

[Unit]
Description=xrdp session manager
After=syslog.target network.target
BindsTo=xrdp.service

[Service]
Type=forking
PIDFile=/var/run/xrdp/xrdp-sesman.pid
ExecStartPre=/bin/mkdir -p /var/run/xrdp
ExecStart=/usr/sbin/xrdp-sesman 
ExecStop=/usr/sbin/xrdp-sesman  --kill

[Install]
WantedBy=multi-user.target

Notice that the PID file is in another location on debian, there is no /etc/sysconfig/xrdp (and we love debian for it :)
The BindsTo= line makes xrdp-sessman.service stop when you stop xrdp.
I put them in /etc/systemd/system/ so they simply override the current install.

enjoy!

@vincentkersten

This comment has been minimized.

vincentkersten commented Feb 17, 2015

to be overcomplete:

diff /lib/systemd/system/xrdp.service /etc/systemd/system/xrdp.service

8,11c8,10
< PIDFile=/var/run/xrdp.pid
< EnvironmentFile=/etc/sysconfig/xrdp
< ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
< ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill
---
> PIDFile=/var/run/xrdp/xrdp.pid
> ExecStart=/usr/sbin/xrdp 
> ExecStop=/usr/sbin/xrdp  --kill

diff /lib/systemd/system/xrdp-sesman.service /etc/systemd/system/xrdp-sesman.service

4c4
< StopWhenUnneeded=true
---
> BindsTo=xrdp.service
8,11c8,10
< PIDFile=/var/run/xrdp-sesman.pid
< EnvironmentFile=/etc/sysconfig/xrdp
< ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
< ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill
---
> PIDFile=/var/run/xrdp/xrdp-sesman.pid
> ExecStart=/usr/sbin/xrdp-sesman 
> ExecStop=/usr/sbin/xrdp-sesman  --kill
@vincentkersten

This comment has been minimized.

vincentkersten commented Feb 17, 2015

last but not least:

rm /etc/init.d/xrdp
systemctl enable xrdp xrdp-sesman
@vincentkersten

This comment has been minimized.

vincentkersten commented Feb 17, 2015

Another annoying thingy: After rebooting the /var/run/xrdp folder is gone. This causes the systemd job to fail. I'll add 'ExecStartPre=/bin/mkdir -p /var/run/xrdp' to keep myself happy across reboots in the above examples - I tested this and it works well. phew

@vincentkersten

This comment has been minimized.

vincentkersten commented Jun 26, 2015

Another box, and i needed to google myself - thank you internet.
I see however i forgot to include some variables when starting:

/etc/systemd/system/xrdp-sesman.service

[Unit]
Description=xrdp session manager
After=syslog.target network.target
BindsTo=xrdp.service

[Service]
Type=forking
PIDFile=/var/run/xrdp/xrdp-sesman.pid
ExecStartPre=/bin/mkdir -p /var/run/xrdp
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
ExecStop=/usr/sbin/xrdp-sesman  --kill

[Install]
WantedBy=multi-user.target

/etc/systemd/system/xrdp.service

[Unit]
Description=xrdp daemon
Requires=xrdp-sesman.service
After=syslog.target network.target xrdp-sesman.service

[Service]
Type=forking
PIDFile=/var/run/xrdp/xrdp.pid
ExecStartPre=/bin/mkdir -p /var/run/xrdp
ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
ExecStop=/usr/sbin/xrdp  --kill

[Install]
WantedBy=multi-user.target
@itamarjp

This comment has been minimized.

Member

itamarjp commented Jul 15, 2015

I think ExecStartPre=/bin/mkdir -p /var/run/xrdp - this part should be created by installer or .deb file, not here

@vincentkersten

This comment has been minimized.

vincentkersten commented Jul 15, 2015

Hi itmarjp,
/var/run is not kept across reboots.

@bmullan

This comment has been minimized.

bmullan commented Mar 7, 2016

Is this still being looked at? Built xrdp.deb for use on ubuntu 15.10 but when installed it (& x11rdp) still creates the init scripts in /lib/systemd/system/ and xrdp still won't start via systemd so I have to delete them so upstart will let me (or a system boot) start xrdp successfully.

@vincentkersten

This comment has been minimized.

vincentkersten commented Mar 7, 2016

HI bmullan, don't know, the info here should give you a running/bootable xrdp with systemd , but i never got around to merge this back ...

@itamarjp

This comment has been minimized.

Member

itamarjp commented Mar 7, 2016

Would you like to send a patch that fix that issue? if yes we try to merge it, thank you.

@bmullan

This comment has been minimized.

bmullan commented Mar 7, 2016

@itamarjp - if you were asking me for a patch?? I'm not a developer just trying to use xrdp with guacamole

@metalefty

This comment has been minimized.

Member

metalefty commented May 15, 2017

I believe this issue has been fixed.

@metalefty metalefty closed this May 15, 2017

@vincentkersten

This comment has been minimized.

vincentkersten commented May 15, 2017

See:
#742 (closed as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment