[Grml] grml-debootstrap misc questions

Michael Prokop mika at grml.org
Wed Oct 1 01:40:03 CEST 2008


* T o n g <mlist4suntong at yahoo.com> [20081001 01:17]:
> On Wed, 01 Oct 2008 00:43:27 +0200, Michael Prokop wrote:

> >> I thought those services are started right when we chroot into the sub
> >> system. . . 

> > Huh?! Services won't be started in the chroot at all. That's why we
> > install our own /usr/sbin/policy-rc.d and remove it at the end.

> Ah, ok, I understand it now. the /usr/sbin/policy-rc.d is used to prevent 
> aptitude from starting services when installing packages right? I saw a 
> message in debian-mlist titled "Prevent aptitude from starting services", 
> and got the impression that services are started right when we chroot 
> into the sub system.

Yes. policy-rc.d can exit with different return codes depending on
what you would like to get. This is great for example for preventing
any services to start up in a chroot where you don't want it to - as
we need it in grml-debootstrap. :)

When executing "chroot /path" you just change your NEWROOT, it's not
an init system - so no need to hassle with services then. :)

BTW: We at grml provide this mechanism to the user ready-to-go:

% cat /etc/policy-rc.d.conf
# Filename:      /etc/policy-rc.d.conf
# Purpose:       configuration file for /usr/sbin/grml-policy-rc.d
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika at grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
# Latest change: Sam Jul 08 01:29:41 CEST 2006 [mika]
################################################################################

# Do you want to run invoke-rc.d?
  EXITSTATUS='0'

#   0 - action allowed
#   1 - unknown action (therefore, undefined policy)
#  100 - unknown initscript id
#  101 - action forbidden by policy
#  102 - subsystem error
#  103 - syntax error
#  104 - [reserved]
#  105 - behaviour uncertain, policy undefined.
#  106 - action not allowed. Use the returned fallback actions
#        (which are implied to be "allowed") instead.

# More information:
# http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt

## END OF FILE #################################################################

Now when I have a big Debian update where several services should
*NOT* be restarted I just set EXITSTATUS to 101 and package
grml-policyrcd and policyrcd-script-zg2 do the rest for me. When the
upgrade finishes I just restore it to the default again
(EXITSTATUS='0') and the system behaves as "usual".
Small but nifty feature. :)

> thanks for clarification.

you're welcome.

regards,
-mika-
-- 
 http://grml.org/            # Linux for texttool-users and sysadmins
 http://wiki.grml.org/       # share your knowledge
 http://grml.supersized.org/ # the grml development weblog
 #grml @ irc.freenode.org    # meet us on irc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://ml.grml.org/pipermail/grml/attachments/20081001/90ea6ef0/attachment-0003.pgp>


More information about the Grml mailing list