FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 01-01-2008, 01:24 PM
Petter Reinholdtsen
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

Did you ever curse that Debian took so long to shut down, waiting for
all the shutdown scripts to complete before the machine was ready to
move? Here is a simple recipe to help making sure your package do not
slow down the shutdown.

Most of the init.d scripts are simple scripts that during shutdown
kill the process they started during boot. But the default halt (0)
and reboot (6) shutdown sequences will kill all processes on their own
(in the sendsigs script), so there is normally no need for individual
packages and init.d scripts to run at shutdown if all they need to do
is to kill a daemon. There might be exceptions, for example if the
daemons need to stop in a given order, but that do not seem to be the
case for most packages.

Ubuntu discovered this a while back, and introduced a method to avoid
calling stop scripts in runlevel 0 and 6. It is the "multiuser"
extension to update-rc.d, and in Ubuntu packages are changed to calls
dh_installinit with '-- multiuser' as an argument to enable it. This
add the "multiuser" argument (instead of to the "default" argument) to
update-rc.d, which go on and set up the boot sequence without
references to the script in runlevel 0 and 6. This can be done
without such extention, and how is the topic of the rest of my email.

To change the runlevel settings of an init.d script using the Debian
API, one most first remove it in the postinst, and insert it again.
To do this, add code like this in the postinst before the #DEBHELPER#
block:

if dpkg --compare-versions "$2" lt "0.1"; then
update-rc.d -f hotkey-setup remove
fi

The version number used when comparing should be the version of the
package where the change is introduced.

Next, change the dh_installinit call in debian/rules file to look like
this (note, not the optimal solution):

dh_installinit -- start 20 2 3 4 5 . stop 20 1 .

This is equivalent to the 'dh_installinit -- multiuser' call on
Ubuntu, and will make debhelper add code to call update-rc.d with the
given arguments.

It is a long-standing Bug in the Debian single user and shutdown
sequence that the services are not stopped in the opposite order of
the one used when starting them. The default setting is to start at
sequence number 20, and stop also using sequence number 20. A better
default would have been to use a stop sequence number that is 100
minus the start sequence number, but it is too late to change the
behavior of update-rc.d. Each package maintainer can on the other
hand fix his package like this:

dh_installinit -- start 20 2 3 4 5 . stop 80 1 .

Of course, one need to verify that the stop script will still work
when stopped at sequence number 80 in the single user runlevel, before
introducing such change.

And while you work on your init.d scripts, please make sure to update
the LSB-style header Should-Stop to reflect that the script do not
need to stop in runlevels 0 and 6. See
<URL: http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot > for
more info on this feature.

Happy hacking,
--
Petter Reinholdtsen
One of the sysvinit maintainers


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 02:01 PM
Andreas Metzler
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

Petter Reinholdtsen <pere@hungry.com> wrote:
[...]
> To change the runlevel settings of an init.d script using the Debian
> API, one most first remove it in the postinst, and insert it again.
> To do this, add code like this in the postinst before the #DEBHELPER#
> block:

> if dpkg --compare-versions "$2" lt "0.1"; then
> update-rc.d -f hotkey-setup remove
> fi
[...]

Is this acceptable according to policy? This will simply discard all
local customzations like disabling he service in a special runlevel.
cu andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 03:28 PM
Petter Reinholdtsen
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

[Andreas Metzler]
> Is this acceptable according to policy? This will simply discard all
> local customzations like disabling he service in a special runlevel.

As far as I know, this is the official and supported way. There is no
'move' option in the update-rc.d API, so I am not aware of any other
way to do it.

Happy hacking,
--
Petter Reinholdtsen


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 06:45 PM
Russ Allbery
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

Petter Reinholdtsen <pere@hungry.com> writes:
> [Andreas Metzler]

>> Is this acceptable according to policy? This will simply discard all
>> local customzations like disabling he service in a special runlevel.

> As far as I know, this is the official and supported way. There is no
> 'move' option in the update-rc.d API, so I am not aware of any other
> way to do it.

Shouldn't we add a move option to update-rc.d first rather than telling
people to do this? It seems like a generally useful thing to have, and I
don't like the idea of throwing away people's init script order
customizations.

--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 10:13 PM
Petter Reinholdtsen
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

[Joey Hess]
> Why is this extension not available in our update-rc.d? As a bonus
> it could stop at sequence number 80 too so we could transition to a
> better order for runlevel 1.

I have not invested much time to implement that extension, as it would
have to be first specified in the update-rc.d API, then implemented by
sysv-rc and file-rc. As I said, it is possible to get the same
behavior by replacing 'default' with something else, so I am not sure
if it is better to insert 'multiuser' instead of 'start 20 2 3 4 5
. stop 20 1 .'. It is definitely easier and shorter, but as I said it
is also not quite optimal using 20 as the stop sequence, so I am not
sure it is a feature to copy into Debian.

I've instead spent my time working on the dependency based boot
sequencing system, because I believe it solve this and other problems
in a more elegant way. It allow us to specify per script where in the
boot and shutdown sequence it should run, and which runlevel it should
run in. It is now working fairly well, as documented on
<URL: http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot >.

> I don't see documentation about Should-Stop there.

Right. Sorry. See the parent page,
<URL: http://wiki.debian.org/LSBInitScripts >. And I ment to say
Default-Stop, not Should-stop.

What about changing the default values for dh_installinit for a future
debhelper compatibility layer, to use 'start 20 2 3 4 5 . stop 80 1 .'
instead of 'default' when calling update-rc.d?

Happy hacking,
--
Petter Reinholdtsen


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 10:15 PM
Petter Reinholdtsen
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

[Russ Allbery]
> Shouldn't we add a move option to update-rc.d first rather than
> telling people to do this? It seems like a generally useful thing
> to have, and I don't like the idea of throwing away people's init
> script order customizations.

Well, I am not quite sure how it should work, but would welcome a way
to modify the default settings while keeping the changes done by the
sysadmin, if we can get sane semantics for it.

I am not going to work on it myself any time soon, as I
focus on the dependency based boot sequencing,
<URL: http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot >.

Happy hacking,
--
Petter Reinholdtsen


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 10:17 PM
Petter Reinholdtsen
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

[Joey Hess]
> The alternative would be changing the default for new installs, but leaving
> existing installs as-is.

Yes. That might be an acceptable alternative.

> [1] Really it probably makes sense to explicitly stop xdm during shutdown
> anyway, since that more cleanly shuts down X.

How does it more cleanly shut down X? That seem to be the logic
behind providing all the stop scripts in runlevel 0 and 6, just to
kill a process. There is nothing magic about sending a signal.

Happy hacking,
--
Petter Reinholdtsen


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 11:29 PM
Colin Watson
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

On Wed, Jan 02, 2008 at 12:13:13AM +0100, Petter Reinholdtsen wrote:
> What about changing the default values for dh_installinit for a future
> debhelper compatibility layer, to use 'start 20 2 3 4 5 . stop 80 1 .'
> instead of 'default' when calling update-rc.d?

Some packages actually do need to shut down cleanly; in the case of a
database, for example, such a change could cause data loss. Thus I
wouldn't recommend changing the default, but perhaps providing a more
convenient single option to do that common task would be good.

--
Colin Watson [cjwatson@debian.org]


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 11:46 PM
Petter Reinholdtsen
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

[Colin Watson]
> Some packages actually do need to shut down cleanly; in the case of
> a database, for example, such a change could cause data loss. Thus I
> wouldn't recommend changing the default, but perhaps providing a
> more convenient single option to do that common task would be good.

I believe it might make sense to change the default, if it only take
effect for a new debhelper compat value. Every maintainer is supposed
to check the effects of upgrading the compat value, and we could thus
expect them to check if their init.d script need to run in runlevel 0
and 6. If they need to stop in runlevel 0 and 6, they can always use
'start 20 2 3 4 5 . stop 80 0 1 6.'.

A new keyword might be a good option too. multiuser is already taken
and I guess it is expected to mean 'start 20 2 3 4 5 . stop 20 1 .',
so we would want to come up with another one. Perhaps 'normal', as in
'update-rc.d scriptname normal', to mean 'start 20 2 3 4 5 . stop 80 1
.'?

Happy hacking,
--
Petter Reinholdtsen


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 01-01-2008, 11:51 PM
Russ Allbery
 
Default Faster shutdown and the ubuntu "multiuser" update-rc.d extention

Petter Reinholdtsen <pere@hungry.com> writes:

> I believe it might make sense to change the default, if it only take
> effect for a new debhelper compat value. Every maintainer is supposed
> to check the effects of upgrading the compat value, and we could thus
> expect them to check if their init.d script need to run in runlevel 0
> and 6. If they need to stop in runlevel 0 and 6, they can always use
> 'start 20 2 3 4 5 . stop 80 0 1 6.'.

I'm okay with changing it along with a debhelper compat value. Changing
it without that sort of transition would seriously break
openafs-fileserver, among others (but I'm sure Joey wouldn't do that
anyway).

--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 08:59 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org