Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 216742 - app-laptop/i8kutils - i8k init.d script doesn't stop i8kmon with openrc and baselayout-2
Summary: app-laptop/i8kutils - i8k init.d script doesn't stop i8kmon with openrc and b...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Olivier Crete (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 217941
  Show dependency tree
 
Reported: 2008-04-07 17:19 UTC by Henry Gebhardt
Modified: 2008-10-29 20:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixes stopping i8kmon (init.i8k.patch,652 bytes, patch)
2008-10-29 00:58 UTC, Roger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Henry Gebhardt 2008-04-07 17:19:51 UTC
I have i8k configured to only start the i8kmon daemon to control the fans.

rc-status reports i8k as "crashed", yet the daemon is running in the background and doing its job.

"/etc/init.d/i8k stop" doesn't give an error message (just says ok), and the daemon continues to run and control the fans.

Reproducible: Always

Steps to Reproduce:
kork ~ # /etc/init.d/i8k start
i8k            | * Starting i8kmon ...                     [ ok ]

kork ~ # /etc/init.d/i8k stop
i8k            | * Stopping i8kmon ...                     [ ok ]
Actual Results:  
kork ~ # ps ax | grep i8kmon | grep -v grep
12817 ?        Ss     0:00 tclsh /usr/bin/i8kmon -- -d

The daemon hasn't stopped.
Restarting the service results in another instance of the daemon running, leading to race conditions if the configuration changed (fans going up and down like mad).

Expected Results:  
The i8kmon daemon should no longer be running after having been stopped.

I am using

sys-apps/openrc-0.2.1-r1
sys-apps/baselayout-2.0.0
app-laptop/i8kutils-1.25   (only version in portage, stable)

Changing the init script as below solves the problem (only tested with baselayout-2, openrc). The i8kbutton part uses a pidfile already.

--- /root/i8k	2008-04-07 18:14:40.000000000 +0200
+++ /etc/init.d/i8k	2008-04-07 18:27:21.000000000 +0200
@@ -26,9 +26,8 @@
 	fi
 	if [ ! -n "$NOMON" ]; then
 		ebegin "Starting i8kmon"
-		start-stop-daemon --start -b --quiet  \
-			--exec /usr/bin/i8kmon --background \
-			--name "tclsh /usr/bin/i8kmon" \
+		start-stop-daemon --start --quiet --pidfile /var/run/i8kmon.pid \
+			--make-pidfile --exec /usr/bin/i8kmon --background \
 			-- -d ${NOAUTO:+-na} ${TIMEOUT:+-t $TIMEOUT}
 		eend $?
 	fi
@@ -42,7 +41,7 @@
 	fi
 	if [ ! -n "$NOMON" ]; then
 		ebegin "Stopping i8kmon"
-		start-stop-daemon --stop --quiet --name "tclsh /usr/bin/i8kmon"
+		start-stop-daemon --stop --quiet --pidfile /var/run/i8kmon.pid
 		eend $?
 	fi
 }


It appears that something didn't work right using baselayout-1 and a pidfile, see bug #110572.
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2008-04-07 21:07:57 UTC
The supperfluous tcl runtime dependency of the init script hasn't been stated btw...
Comment 2 Roger 2008-10-29 00:58:57 UTC
Created attachment 170179 [details, diff]
Fixes stopping i8kmon
Comment 3 Roger 2008-10-29 01:01:27 UTC
This patch also seems to fix the "crashed" after started bug.

(I think the crashed is encountered after trying to start i8k again after stopping via init.d scripts?)
Comment 4 Roger 2008-10-29 01:09:51 UTC
One additional note, /usr/bin/i8kmon should have tcl/tk isolated so i8kutils can be built without the extra tk/tcl support.  I believe the author only used tk/tcl for the gui stuff.

Since these init scripts can work without the gui, should isolate the tk/tcl stuff from /usr/bin/i8kmon.  <shrugs>   I'm hesitant to pick-up this task as I'm quite busy right now.
Comment 5 Henry Gebhardt 2008-10-29 11:03:54 UTC
I just confirmed that roger's patch works for me. Thanks.

(In reply to comment #4)
> One additional note, /usr/bin/i8kmon should have tcl/tk isolated so i8kutils
> can be built without the extra tk/tcl support.  I believe the author only used
> tk/tcl for the gui stuff.

I believe i8kmon does use tcl. ps ax shows
     4045 ?        Ss     0:00 tclsh /usr/bin/i8kmon -- -d

I think this is what Carsten Lohrke was saying in comment #1.

That still leaves tk, though.

Sincerely,
Henry
Comment 6 Roger 2008-10-29 20:05:11 UTC
Great.  This bug is *fixed* with init.i8k.patch.

(Please get this committed so I don't have to worry about my laptop for awhile. ;-)


Right. i8kmon depends on tclsh.  After reviewing /usr/bin/i8kmon script, it's really an entire tcl script embedded into a sh script wrapper.  Looking at the depends for dev-lang/tcl, tcl seems like a minimally sized package.  Think the tk use flag is also minimal with system resources.  Granted, script should be in bash/python/C, but it's what the author used and it's 743 lines of scripting.  Guess it can wait another day or two for recoding.  
Comment 7 Olivier Crete (RETIRED) gentoo-dev 2008-10-29 20:28:40 UTC
alright, the patch is in 1.25-r1, I trust you all that this works for you.
Comment 8 Roger 2008-10-29 20:48:53 UTC
Forgot to mention.  Yup, works for me!


Marking as fixed.  (Didn't know if you were still around Olivier!)


Thanks.