Subject: Bug#254: x2goserver (RPM issue)

From: Olav Smørholm <[email-masked]>
Date: Fri, 28 Jun 2013 20:25:43 +0100

Package: x2goserver
Version: 4.0.1.1

There is a race condition in the x2gocleansessions init script, causing 
it to kill itself on a fast machine.
Thus the rpm cannot be cleanly uninstalled without disabling %preun scripts.

# /etc/init.d/x2gocleansessions stop
Terminated
# zypper rm x2goserver
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
   x2goserver

1 package to remove.
After the operation, 203.0 KiB will be freed.
Continue? [y/n/?] (y): y
Removing x2goserver-4.0.1.1-2.5.csc [error]
Removal of (26663)x2goserver-4.0.1.1-2.5.csc.x86_64(@System) failed:
Error: Subprocess failed. Error: RPM failed: /var/tmp/rpm-tmp.7904: line 
7: /etc/init.d/x2gocleansession: No such file or directory
error: %preun(x2goserver-4.0.1.1-2.5.csc.x86_64) scriptlet failed, exit 
status 127

Abort, retry, ignore? [a/r/i] (a):
Problem occured during or after installation or removal of packages:
Installation aborted by user

Please see the above error message for a hint.
# rpm -e  --nopreun x2goserver
#

The init script "fixed" in this way:
stop()
{
                 # kill x2gocleansessions, ignore on failure
                 if  ps aux | grep x2gocleans | grep -q perl
                 then
                         ps aux | grep x2gocleansessions | grep -v init 
|grep -v grep  |  awk '{print $2}' | xargs  kill -9
                 fi
}

But this is not really a fix, as the script will fail if the perl script 
exits before it can be killed.
Would be better if the init script or perl script was renamed and used 
pkill -x instead, but pkill has a problem will long program names.

Anoter issue for SLES, is that perl module File::Path is outdated, and 
is still using the legacy mkpath instead of make_path.
So there needs to be a check for this.
Not sure if this changes with SP3, but it is at least the case for SP2.
This causes x2godbadmin --create to fail:
# x2godbadmin --create
"make_path" is not exported by the File::Path module
Can't continue after import errors at /usr/sbin/x2godbadmin line 25
BEGIN failed--compilation aborted at /usr/sbin/x2godbadmin line 25.

But I really do question the wisdom of having an init script call an 
external perl script to do its job.
Ideally it should all be handled by the init script.

Best Regards,
-- 
Olav Smørholm
Centre for Scientific Computing, University of Warwick