Skip to content

How to fix a configuration model


I’ve written a tutorial to show how a configuration model can be updated to cope with new features provided by new software release.

This tutorial shows how to add a new parameter provided by OpenSsh 5.9 into Ssh model. This example can be applied to other models (like Dpkg model).

I hope that people will be able now to perform simple enhancements to current models.

Feedback are welcome

Dpkg source editor/checker is going native


As Config::Model was becoming too big with too many dependencies, I’ve moved all Debian stuff from Config::Model repository into a separate Debian repository.

If you install only libconfig-model-perl 2.026-1 (from experimental), the command ‘cme check dpkg’ will not work. You must also install libconfig-model-dpkg-perl to get it back. libconfig-model-dpkg-perl is currently in experimental.

libconfig-model-dpkg-perl repository is hosted on Alioth in debian perl-packaging team and is a Debian native package. Nevertheless, it will be uploaded to CPAN. (just like dh-make-perl).
All people involved in packaging are welcome to hack it or suggest improvements

I’ll upload both packages into unstable once the dust settles.

All the best

Kerberos configuration editor looking for a maintainer


A while ago, Peter Knowles wrote a configuration model for Kerberos. Unfortunately, his priorities shifted before he completed this work. He was kind enough to send me the prototype in hope someone could take over.

Although I do not know Kerberos, I believe the model is rather complete. Just click on the image below to judge for yourself:

Class diagram of Kerberos configuration model

This work was released under a LGPL-2+ license.

There are some tasks left to get a Kerberos configuration editor. These are mentioned in config-model-kerberos readme file.

To look at the code, just clone config-model-kerberos with


If you need more information on Config::Model, see:

If you are interested in adopting Kerberos model, please keep us informed on config-model-users at This will avoid duplicated work. On my side, I’ll gladly answer questions related to Config::Model to help you get started.

All the best

cme fix dpkg now track and display changes


I’ve released Config::Model 2.018 which is now able to track the changes done with cme to your configuration data.

Thw GUI now features a new menu entry File -> show unsaved change that will give you a list of the changes done since running the command or since the last save (whichever occured last). For instance:

This feature is also available in non-graphic mode.

As an example, let’s refresh the lcdproc package:

$ cme fix dpkg
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Warning in 'control source Standards-Version' value '3.9.2': Current standards version is 3.9.3
Warning in 'copyright Format' value '': Format does not match the recommended URL for DEP-5

- control source Standards-Version: '3.9.2' -> '3.9.3' # applied fix
- copyright Format: '' -> '' # applied fix

The Changes list can be reused to update the changelog, but the author does not dare injecting this directly in debian/changelog…

Let’s check the resulting changes:

$ git diff
diff --git a/debian/control b/debian/control
index 11a5b8a..2b81192 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@ Build-Depends: autoconf,
-Standards-Version: 3.9.2
+Standards-Version: 3.9.3
 Vcs-Git: git://
diff --git a/debian/copyright b/debian/copyright
index 6cea444..4b48619 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,4 +1,4 @@
 Upstream-Name: lcdproc
 Upstream-Contact: William W. Ferrell 

Last but not least, this track and display changes features is also available for other models, like OpenSsh, lcdproc, multistrap

All the best

A success story for Config::Model


Here’s a mail telling how the Config::Model Perl module was used to refactor existing configuration tools in Perl. Some punctuation and blank lines were added to improve the flow of this text. The full name and mail address of gkr is withheld on his request.

I took over a perl script that was responsible to pull data from several sources and push it after validation and re-packaging including some meta data into one of our production systems.

The script was never intended to be used for more then a few month. But as things go, we were still using it after a few years. Only now for a lot more sources. Since all the configuration of sources and meta data were contained as a single hash in this script, it became very unwieldy. Although the configuration seldom changed, once it got added it was not an option to keep it like this especially as we decided to prepare a Debian package for faster installation and version tracking. So I had to re-work it and was looking for some library that was allowing me to define how the configuration has to look like, providing sensible hard coded and computed defaults for some of the values.

This was when I found Config::Model on Cpan. It was, after some digging into the documentation, quite simple to define a rough first version of the complete config, including global default values as ini file and very simple to read in and write out. A more advanced version was not working because the Config::Model in Debian squeeze did not provide needed features.

Switching to yaml as configuration file format not only increased readability but also worked with the standard Squeeze package. Consistency is checked automatically inside the model so broken configurations are more unlikely in the future.

Of course I had some work re-factoring the original source but Config::Model allowed an easy addition of a value-checked and documented configuration file. To access the Config::Model::Instance I added small wrapper packages that allowed an easy access of the config elements by name to make the source easier to understand. The re-factoring needed for creating a Debian package for the Script – which is now a set of modules and a small executable – was simple once I had Config::Model working, since I was able to add new configuration items effortlessly and remove a lot of hard coded parameters.

I don’t use the cli tool yet for configuration editing but that’s going to be the next step.

Many thanks to gkr for this feedback. Let’s hope he will continue to give feedback on his usage of Config::Model.

All the best

My setup for vdr automatic wake up and shutdown


Like all kids, my kids really enjoy watching cartoons. Unfortunately, most of them are broadcast during the morning, sometimes very early in the morning. Since I don’t want my kids to wake up (or wake me up…) too early in the morning to watch cartoon, I record the most interesting programs with vdr (I also edit out commercials before my kids watch them)

To limit my carbon (or equivalent radio-active waste) footprint, I do not want to leave the computer on 24/24, so the machine has to power up by itself before a recording time.

So I’ve setup vdr to automatically setup the wake up time of the computer and shutdown the machine once the recording is finished. Note that this machine is also my main home machine, so it must not shutdown while I’m working on it (typing this blog, for instance).

This should have been easy and fairly documented. Well, it was not that easy. A lot of doc mentions nvram-wakeup which is more or less obsolete. Other docs were in German. So, here’s a summary of the setup so other can benefit from my experience.

First, this was done on a Debian/sid machine, this post should be usable on other distros, provided some adaptations. These adaptations are left as an exercise to the reader (which is marketing lingo for “I don’t have a clue”)

First add this line in /etc/default/vdr:


When vdr has nothing to do, it will run some shutdown scripts, including /usr/share/vdr/shutdown-hooks/S90.custom, which is a link to /etc/vdr/shutdown-hooks/S90.custom.

The output of this script will be eval’ed by vdr, so vdr knows what to do next (e.g. abort shutdown, display a message to user, retry later…).

Here are the possible output of a vdr shutdown script (list taken from vdr-wiki):

  • To abort the shutdown, exit with an errorlevel != 0.
  • If you want a message to be displayed on the OSD when aborting a shutdown,
    then write to stdout:
    ABORT_MESSAGE=<message to display>
  • If you want to defer the shutdown, write to stdout:
    TRY_AGAIN=<minutes to wait before next shutdown request>
  • To overwrite the command that will be executed to shutdown the machine
    after all shutdown hooks have been processed, write to stdout:
    SHUTDOWNCMD=<new shutdown command>
    echo "ABORT_MESSAGE=\"I do not want to shutdown now!\"" ; exit 1

This script will mess with /sys/class/rtc/rtc0/wakealarm so it must be run as root. But vdr will launch this script and does not run as root. Instead of setting a suid bit, let’s setup sudo to enable this script to gain root privilege from vdr. Add this line in /etc/sudoers (with visudo):

vdr ALL= NOPASSWD: /etc/vdr/shutdown-hooks/S90.custom *

And here’s a commented Perl script that handle the shutdown test:

use IO::File ;
use 5.10.0 ;
use English;
use Path::Class; 

use Sys::Syslog qw(:standard :macros);  # standard functions & macros
openlog('vdr-shutdown', "", "user");

Here’s the call to sudo to gain root privilege (if not already run as root):

if ($EUID) {
    system('sudo','/etc/vdr/shutdown-hooks/S90.custom', @ARGV) ;
    syslog(info => "vdr-shutdown: sudo myself returned $@") ;

Get the next timer info from the command arguments provided by vdr:

my ($next_timer,$interval) = @ARGV ;

Setup the next alarm in the mother board:

if ( $next_timer) {
  my $dev_fh = IO::File->new("> /sys/class/rtc/rtc0/wakealarm");
  die "cannot open $dev_fh: $!" unless $dev_fh ;
  my $newtime = $next_timer - 300  ;  # Start 5 minutes earlier
  $dev_fh->print( "$newtime\n" ) ;
  $dev_fh->close ;

  syslog(info => "vdr-shutdown: set wakeup to $newtime") ;

Now, let’s check if someone is logged on the system. Weirdly enough, forking a command from this Perl script does not work when it’s run by vdr. Calling the ‘who’ command always return empty. The trick to find if anyone is logged is to check the content of /dev/pts directory. No files in there means that nobody is logged:

my @pts  = dir('/dev/pts')->children;
syslog(info => "vdr-shutdown:  found pts @pts") ;

if (@pts > 1) {
    syslog(info => "vdr-shutdown: retry later: someone is logged") ;
    say 'ABORT_MESSAGE="someone is logged, shutting down deferred"';
    say 'TRY_AGAIN=30'
else {
    syslog(info => "vdr-shutdown: nobody is logged, halting") ;

Now some cleanup then exit:

closelog() ;

exit 0;

This script has been working for one month, and not a single programs was missed. My kids are happy.

I’m not so happy because I now have a lot of commercials to edit out ;-)

All the best

My activities during Perl/QA hackathon in Paris


Last week-end, I’ve participated Perl/QA hackathon in Paris.

Here’s a short summary of the main activities during this week-end. I was not in the best of shape due to a nasty (biological) bug that wore me down before the hackathon.

First of all, I discussed with rjbs about the bunch of debian patches I’ve written for Software::License. These patches (and hacks) are used in Debian to provide licenses summaries in Debian::Dpkg::Copyright model to help write Debian copyright files. License management is boring but necessary. cme and Software::License help in making this task slightly less boring. Ricardo kindly suggested some modifications and agreed to include my patches. I implemented these modifications directly during the hackathon.

The other tasks during this week-end were (not necessarily in that order):

  • I discussed with alanhaggai and gave him some ideas to fix his Archive::Zip module
  • I did a live demo of Debian packaging to ribasushi: I updated the Debian package libdbix-class-schema-loader-perl from CPAN and uploaded it in Debian.
  • I presented how to package Perl modules for Debian. renormalist will package his own module Data::Dpath and its dependencies for Debian. I will sponsor his packages once they are available on Debian perl’s team git repository. Unless gregoa beats me to it :-)
  • I discussed with Slaven Rezic some binding weirdness found in Perl/Tk HList. Config::Model’s graphical interface provide a viewer widget and and editor widget for configuration items. As expected, the viewer is invoked by a single left click. One would expect a double click to invoke the editor widget. But the double click bindinngdoes not owrk in HList when the single click is used. Currently the editor widget is invoked with a right-click, which is not user-friendly. According to Slaven, the bug might be hidden quite deep in Perl/Tk guts. Fixing it won’t be easy.
  • As a Debian/sid user, I’ve been quite spoiled: I’ve always had a recent Perl available on my system. I’ve neved had to compile Perl since my HPUX days back in last century. However, Config;:Model tests failed with Perl 5.15.9, a development version not available in Debian (sid is not that unstable). Thanks to Xavier Caron, I’ve learned about perlbrew and cpanminus to reproduce this bug and fix the issue. Many apologies to miyagawa for asking dumb questions about cpanm: the disctinction between runtime and build time does not apply to cpan minus. I guess that’s the drawback of wearing 2 hats (Debian dev hat and Perl dev hat): your brain may get confused and you conflate issues. Oops.

Many thanks to FreeSide who sponsored my travel, to the hackathons organisers and to all the participants for their welcome.

All the best


Get every new post delivered to your Inbox.