Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 524388 - sys-apps/openrc-0.12.4: path from '--chroot ' is not added to 'pidfile=' var in /run/openrc/daemons/*/* files
Summary: sys-apps/openrc-0.12.4: path from '--chroot ' is not added to 'pidfile=' var ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: openrc-0.14
  Show dependency tree
 
Reported: 2014-10-03 15:33 UTC by Nikoli
Modified: 2014-10-26 20:06 UTC (History)
0 users

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


Attachments
Solution based on storing of s-s-d arguments (way-2.patch,4.17 KB, patch)
2014-10-19 19:24 UTC, Alexander Vershilov (RETIRED)
Details | Diff
Solution based on writing modified pidfile (way-1.pid,3.11 KB, patch)
2014-10-19 19:26 UTC, Alexander Vershilov (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikoli 2014-10-03 15:33:39 UTC
'start-stop-daemon --start --background --make-pidfile --pidfile /run/name.pid --chroot /chroots/' creates pidfile in '/chroots/run/name.pid', but '/run/openrc/daemons/name/001' is created with 'pidfile=/run/name.pid' line instead of 'pidfile=/chroots/run/name.pid'. rc-status and start-stop-daemon do not see such pidfile, so they detect service as not running.
Please either add 'chroot=' variable to '/run/openrc/daemons/name/001' or add to 'pidfile=' var. I think it is more correct to add 'chroot=' as separate variable instead of including in other. May be it would be better to add _all_ start-stop-daemon cli options as variables to /run/openrc/daemons/*/*, just in case.
Comment 1 Christian Ruppert (idl0r) gentoo-dev 2014-10-08 11:43:31 UTC
I don't see a reason to use the chroot path here as it's OpenRC that gets the --pidfile option, not the daemon itself.
Comment 2 Nikoli 2014-10-08 12:25:04 UTC
Now openrc has _very_ bad support for chroot, it even is using different paths during start and during status actions: during start it is $(path from --chroot)$(path from --pidfile) and during status it is just $(path from --pidfile), so after start any service is detected as not running when --make-pidfile is used.

For better understanding try to provide example of openrc script which uses 'start-stop-daemon --make-pidfile --chroot /somepath --pidfile /run/openrc-bug.pid' - you will reproduce the bug. Or do you need more info?
Comment 3 Alexander Vershilov (RETIRED) gentoo-dev 2014-10-19 19:22:42 UTC
Hi, I can confirm the problem. Here is a short description, when service is runing in a chroot it creates a pidfile in ${chroot}/run/$serive.pid. And in /run/daemon/$service/000 there is information that pidfile is stored in /run/$service.pid, as a result openrc fails to check status.

Two mentioned solutions may work and I'm attaching both of them.
Comment 4 Alexander Vershilov (RETIRED) gentoo-dev 2014-10-19 19:24:47 UTC
Created attachment 386972 [details, diff]
Solution based on storing of s-s-d arguments

This is a proof of concept (however works as a workaround for this bug). 
The idea is to save chroot option usgin rc_service_value_set, so both s-s-d and rc-status will be aware of chrooted service.

git url: https://github.com/qnikst/openrc/tree/bug-524388-2
Comment 5 Alexander Vershilov (RETIRED) gentoo-dev 2014-10-19 19:26:32 UTC
Created attachment 386974 [details, diff]
Solution based on writing modified pidfile

Solution based on the storing of pid with known chroot, it looks like more hairy for me
Comment 6 William Hubbs gentoo-dev 2014-10-24 16:08:46 UTC
A fix for this has been implemented in these commits:

f9acd65
8c7ea4e

This will be in OpenRC-0.14 and OpenRC-0.13.2.
Comment 7 William Hubbs gentoo-dev 2014-10-24 16:23:50 UTC
The fix is to add a chroot variable which will need to be set to the
chroot path in a service script. This variable is used in the default
start and stop functions. This is also saved the same way pidfile and
the other variables are saved.