[Pkg-puppet-devel] Bug#1069162: Suggested fix

Anton Lundin glance at ac2.se
Thu Nov 14 19:00:24 GMT 2024


I've hit this one to, and after some testing figured out whats happening
and what a solution.

My conclusion is that during boot, the system is usually loaded enough
that the forked process about start whats declared in ExecStart= haven't
gotten around to setuid down to the puppet user yet, so it's still
running as root.

When the ExecStartPost= command starts it gets to the kill -0 $MAINPID
before $MAINPID have switched user and thus, kill gets EPERM.


I just added a sleep 1 before the while in ExecStartPost= fixes things:

diff --git i/debian/puppetserver.service w/debian/puppetserver.service
index c0e5a2a..d52d8d0 100644
--- i/debian/puppetserver.service
+++ w/debian/puppetserver.service
@@ -29,7 +29,7 @@ ExecStart=/usr/bin/java $JAVA_ARGS \
     --bootstrap-config /etc/puppet/puppetserver/services.d \
     --restart-file ${RUNTIME_DIRECTORY}/restart \
     $TK_ARGS
-ExecStartPost=sh -c "while ! head -c1 ${RUNTIME_DIRECTORY}/restart | grep -q '^1'; do kill -0 $MAINPID && sleep 1 || exit 1; done"
+ExecStartPost=sh -c "sleep 1 ; while ! head -c1 ${RUNTIME_DIRECTORY}/restart | grep -q '^1'; do kill -0 $MAINPID && sleep 1 || exit 1; done"
 
 ExecReload=sh -c "echo -n 0 > ${RUNTIME_DIRECTORY}/restart"
 ExecReload=kill -HUP $MAINPID



//Anton



More information about the Pkg-puppet-devel mailing list