Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Development (http://www.linux-archive.org/debian-development/)
-   -   Initial configuration and installation through d-i (http://www.linux-archive.org/debian-development/69391-initial-configuration-installation-through-d-i.html)

Raphael Hertzog 04-14-2008 10:28 AM

Initial configuration and installation through d-i
 
Hello,

some packages require initial configuration of an external service.
The most common case is the creation of a dedicated database (relational
or LDAP). This is usually done in the postinst.

When the database is hosted on the same server, it means that the database
server needs to be running and functional. But that's not the case if you
install the packages directly within debian-installer (the /target chroot
is temporarily configured in a way that no services are started by
invoke-rc.d, and that's a sane thing to do IMO).

This is a pain for CDD that want to auto-install some of those packages.

How should we handle this problem?

For the the specific case that affected me, I resolved the problem
by creating a simple mechanism to handle initial configuration of such
packages: the initial configuration is moved to a dedicated script that
can be called in 3 ways. The first way is with a "possible" parameter,
the script needs to verify of the pre-requesite are satisfied (is the DB
server up and usable?). The second way is with a "needed" parameter, the
script checks if the initial configuration is needed or if it was already
done by some other ways. And the third way is with a "configure" parameter
and here the real job is done.

The postinst runs "configure" only if "possible" and "needed" are true.
If "possible" is false, then it registers the script for later execution
(by creating a symlink to itself in some predetermined directory).

A new init script has been added so that at the end of the boot sequence,
when all services have been started, another try is made for all the
registered scripts. On success, the symlink is removed, otherwise it's
kept for as long as the configuration doesn't succeed. This means that
initial configuration (usually) happens at the end of the first reboot.

What would be the proper place for such a "deferred configuration"
service? Does it require a dedicated package or would it fit in some
existing one? The principle is generic enough to be applied to other
cases than database creation but as it's the most important use,
maybe dbconfig-common would be a good choice?

Opinions welcome.

Cheers,
--
Raphaël Hertzog

Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/


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

sean finney 04-14-2008 05:12 PM

Initial configuration and installation through d-i
 
hiya,

On Monday 14 April 2008 12:28:33 pm Raphael Hertzog wrote:
> When the database is hosted on the same server, it means that the database
> server needs to be running and functional. But that's not the case if you
> install the packages directly within debian-installer (the /target chroot
> is temporarily configured in a way that no services are started by
> invoke-rc.d, and that's a sane thing to do IMO).

there are also probably a few corner cases on live systems, where
the "service" is being upgraded/installed simultaneously and is not available
during postinst.

> This is a pain for CDD that want to auto-install some of those packages.
>
> How should we handle this problem?

shooting from the hip here, but i suspect there may be a fairly graceful and
general way of doing this, via triggers plus something like what you mention
here:

> A new init script has been added so that at the end of the boot sequence,
> when all services have been started, another try is made for all the
> registered scripts. On success, the symlink is removed, otherwise it's
> kept for as long as the configuration doesn't succeed. This means that
> initial configuration (usually) happens at the end of the first reboot.

in the case of dbconfig-common, my thought is that it could somehow use
triggers to schedule deferred execution of the database configuration stuff
until the very end, after the databases are guaranteed to be back up. that
should cover the problem on "live" systems.

in d-i, some kind of hook could be placed on the trigger execution, such that
instead of executing it at the end of dpkg's run, the commands are placed
into a batch script in /var/lib/somewhere and executed by a
hypothetical "firstboot" script.

and generally speaking, i imagine that CDD's (as well as those doing preseeded
custom installs) would appreciate having such a "firstboot" feature from
dpkg, anyway.

i'm not at all familiar enough with either triggers or d-i to know if this is
feasible though.



sean


All times are GMT. The time now is 04:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.