~rbn/buildslack

2c0252f84e0d0bfad5e5d8327567285ca5ce2747 — Ruben Schuller 2 months ago 4ea24ea
kill processes holding open files in overlayfs

gnome-keyring-daemon is started by pam on login, opening files in the
mounted overlayfs. kill all processes which still have open files there
after the build is complete.
1 files changed, 10 insertions(+), 0 deletions(-)

M environment.tcl -rw-r--r-- => -rwxr-xr-x
M environment.tcl => environment.tcl +10 -0
@@ 139,6 139,16 @@ namespace eval ::buildslack::environment {
		log::log debug "::buildslack::environment::umount $environment"

		dict with environment {
			log::log info "killing processes holding files in mounted environment $buildroot:"
			set pids [ exec -ignorestderr lsof -t $buildroot ]
			foreach p [ split $pids ] {
				set f [ open /proc/$p/cmdline ]
				set cmdline [ read $f ]
				close $f
				log::log info "$p $cmdline"
				exec kill -9 $p
			}

			log::log info "environment $buildroot: umount"
			exec sudo umount $buildroot/proc
			exec sudo umount $buildroot/sys