[Pkg-ltsp-devel] Bug#701916: Kill local user processes on logout
Vagrant Cascadian
vagrant at debian.org
Fri Mar 1 02:07:14 UTC 2013
Control: tags 701916 pending
Control: tags 700881 pending
Committed the following to the ltsp-debian-packaging bzr branch:
diff -Nru ltsp-5.4.2/debian/changelog ltsp-5.4.2/debian/changelog
--- ltsp-5.4.2/debian/changelog 2013-01-08 22:01:18.000000000 -0800
+++ ltsp-5.4.2/debian/changelog 2013-02-28 17:46:18.000000000 -0800
@@ -1,3 +1,15 @@
+ltsp (5.4.2-6) UNRELEASED; urgency=low
+
+ * Add patch to run jetpipe from ltsp-client-core init script rather than
+ init-ltsp.d hook (Closes: #700881). Running from init-ltsp.d is far too
+ early in the boot process and causes daemonization to fail, which stops
+ boot from continuing. Thanks to James McQuillan for the report.
+ * Avoid data loss with fatclients or localapps by killing local user
+ processes at end of session (LP: #1093144, Closes: #701916).
+ Thanks to Alkis Georgopoulos for the patch!
+
+ -- Vagrant Cascadian <vagrant at debian.org> Mon, 18 Feb 2013 13:50:35 -0800
+
ltsp (5.4.2-5) unstable; urgency=low
* ltsp-client-core: Depend on initramfs-tools 0.99, to ensure /run is
diff -Nru ltsp-5.4.2/debian/patches/jetpipe-from-ltsp-client-core-init-script ltsp-5.4.2/debian/patches/jetpipe-from-ltsp-client-core-init-script
--- ltsp-5.4.2/debian/patches/jetpipe-from-ltsp-client-core-init-script 1969-12-31 16:00:00.000000000 -0800
+++ ltsp-5.4.2/debian/patches/jetpipe-from-ltsp-client-core-init-script 2013-02-18 14:14:37.000000000 -0800
@@ -0,0 +1,82 @@
+Author: Vagrant Cascadian <vagrant at debian.org>
+Bug-Debian: http://bugs.debian.org/700881
+Upstream-Bug: https://bugs.launchpad.net/ltsp/+bug/996533
+
+Start jetpipe from ltsp-client-core init script, as it fails to daemonize when
+executed from init-ltsp.d, which is run before /sbin/init is started.
+
+Index: ltsp-5.4.2/client/initscripts/ltsp-core
+===================================================================
+--- ltsp-5.4.2.orig/client/initscripts/ltsp-core 2013-02-18 14:07:20.509826079 -0800
++++ ltsp-5.4.2/client/initscripts/ltsp-core 2013-02-18 14:07:25.593851287 -0800
+@@ -35,6 +35,33 @@
+ . /lib/lsb/init-functions
+ . /usr/share/ltsp/ltsp-init-common
+
++start_printers() {
++for I in 0 1 2; do
++ eval PRINTER_DEVICE=\$\{PRINTER_${I}_DEVICE\}
++ if [ -n "${PRINTER_DEVICE}" ]; then
++ eval PORT=\$\{PRINTER_${I}_PORT:="910${I}"\}
++ eval BAUD=\$\{PRINTER_${I}_SPEED:-"9600"\}
++ eval SIZE=\$\{PRINTER_${I}_DATABITS:-"8"\}
++ eval PARITY=\$\{PRINTER_${I}_PARITY:-"none"\}
++ eval FLOW=\$\{PRINTER_${I}_FLOWCTRL:-"soft"\}
++
++ JETPIPE_ARGS=
++ [ -n "$BAUD" ] && JETPIPE_ARGS="${JETPIPE_ARGS} -b ${BAUD}"
++ [ -n "$SIZE" ] && JETPIPE_ARGS="${JETPIPE_ARGS} -y ${SIZE}"
++ [ -n "$PARITY" ] && JETPIPE_ARGS="${JETPIPE_ARGS} -p ${PARITY}"
++ if [ -n "$FLOW" ]; then
++ if [ "$FLOW" = "soft" ]; then
++ JETPIPE_ARGS="${JETPIPE_ARGS} -x"
++ else
++ JETPIPE_ARGS="${JETPIPE_ARGS} -r"
++ fi
++ fi
++
++ /usr/sbin/jetpipe ${JETPIPE_ARGS} ${PRINTER_DEVICE} ${PORT}
++ fi
++done
++}
++
+ case "$1" in
+ start)
+ log_action_begin_msg "Starting LTSP client..."
+@@ -48,6 +75,7 @@
+ /bin/plymouth quit --retain-splash
+ fi
+
++ start_printers || true
+ start_screen_sessions || true
+ start_sound || true
+
+Index: ltsp-5.4.2/client/share/ltsp/init-ltsp.d/50-jetpipe
+===================================================================
+--- ltsp-5.4.2.orig/client/share/ltsp/init-ltsp.d/50-jetpipe 2013-02-18 14:07:20.509826079 -0800
++++ /dev/null 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-for I in 0 1 2; do
+- eval PRINTER_DEVICE=\$\{PRINTER_${I}_DEVICE\}
+- if [ -n "${PRINTER_DEVICE}" ]; then
+- eval PORT=\$\{PRINTER_${I}_PORT:="910${I}"\}
+- eval BAUD=\$\{PRINTER_${I}_SPEED:-"9600"\}
+- eval SIZE=\$\{PRINTER_${I}_DATABITS:-"8"\}
+- eval PARITY=\$\{PRINTER_${I}_PARITY:-"none"\}
+- eval FLOW=\$\{PRINTER_${I}_FLOWCTRL:-"soft"\}
+-
+- JETPIPE_ARGS=
+- [ -n "$BAUD" ] && JETPIPE_ARGS="${JETPIPE_ARGS} -b ${BAUD}"
+- [ -n "$SIZE" ] && JETPIPE_ARGS="${JETPIPE_ARGS} -y ${SIZE}"
+- [ -n "$PARITY" ] && JETPIPE_ARGS="${JETPIPE_ARGS} -p ${PARITY}"
+- if [ -n "$FLOW" ]; then
+- if [ "$FLOW" = "soft" ]; then
+- JETPIPE_ARGS="${JETPIPE_ARGS} -x"
+- else
+- JETPIPE_ARGS="${JETPIPE_ARGS} -r"
+- fi
+- fi
+-
+- /usr/sbin/jetpipe ${JETPIPE_ARGS} ${PRINTER_DEVICE} ${PORT}
+- fi
+-done
diff -Nru ltsp-5.4.2/debian/patches/kill-local-processes ltsp-5.4.2/debian/patches/kill-local-processes
--- ltsp-5.4.2/debian/patches/kill-local-processes 1969-12-31 16:00:00.000000000 -0800
+++ ltsp-5.4.2/debian/patches/kill-local-processes 2013-02-28 17:19:10.000000000 -0800
@@ -0,0 +1,53 @@
+ 2462 Alkis Georgopoulos 2013-02-27
+ revision-id:alkisg at gmail.com-20130227091132-h2ql7stdqy42yhx8
+ Kill local user processes on logout (LP: #1093144).
+
+=== modified file 'client/localapps/ldm-rc.d/X99-zlocalapps-cleanup'
+--- old/client/localapps/ldm-rc.d/X99-zlocalapps-cleanup 2013-02-27 09:09:17 +0000
++++ new/client/localapps/ldm-rc.d/X99-zlocalapps-cleanup 2013-02-27 09:11:32 +0000
+@@ -1,9 +1,4 @@
+ if boolean_is_true "$LOCAL_APPS"; then
+- # Copy back passwd and group
+- for i in passwd group; do
+- [ -e "${LOCALAPPS_CACHE}/${i}" ] && cp "${LOCALAPPS_CACHE}/${i}" /etc/${i}
+- done
+-
+ # Clean up cups config
+ [ -r "/etc/cups/client.conf" ] && rm -f /etc/cups/client.conf
+
+@@ -16,6 +11,22 @@
+
+ # Unmount sshfs and remove the mount dir
+ if [ -n "$SSHFS_HOME" ]; then
++ if [ -n "$LDM_USERNAME" ]; then
++ # The user processes need to be terminated before $LDM_HOME gets
++ # unmounted, otherwise they end up writing their data in the local
++ # tmpfs filesystem.
++ # Give them up to 3 seconds to terminate, then kill them.
++ pkill -u "$LDM_USERNAME"
++ i=0
++ while pgrep -u "$LDM_USERNAME" >/dev/null; do
++ if [ "$i" -ge 3 ]; then
++ pkill -KILL -u "$LDM_USERNAME"
++ break
++ fi
++ sleep 1
++ i=$(($i+1))
++ done
++ fi
+ fusermount -uqz ${LDM_HOME}
+ rmdir ${LDM_HOME}
+ fi
+@@ -32,6 +43,11 @@
+ fi
+
+ rm $LOCALAPPSD_PIDFILE
++
++ # Copy back passwd and group
++ for i in passwd group; do
++ [ -e "${LOCALAPPS_CACHE}/${i}" ] && cp "${LOCALAPPS_CACHE}/${i}" /etc/${i}
++ done
+ fi
+
+ # Clean up remote apps tmpdir
+
diff -Nru ltsp-5.4.2/debian/patches/series ltsp-5.4.2/debian/patches/series
--- ltsp-5.4.2/debian/patches/series 2012-11-20 21:27:32.000000000 -0800
+++ ltsp-5.4.2/debian/patches/series 2013-02-28 17:46:38.000000000 -0800
@@ -10,3 +10,5 @@
move-ltspconfig-cache
fatclients-return-0
cryptsetup-swap-with-nbd
+jetpipe-from-ltsp-client-core-init-script
+kill-local-processes
I don't have time to test and upload this weekend, but should be able to get to
it by 2013-03-05 or so...
live well,
vagrant
More information about the Pkg-ltsp-devel
mailing list