Home > Ubuntu, Ubuntu Server > The etckeeper chronicles, part 2

The etckeeper chronicles, part 2

February 26, 2009 Leave a comment Go to comments

In the previous episode, we’ve covered installation and basic usage of etckeeper. One common argument against having /etc under revision control is that it’s rather tedious to commit changes every time you change the configuration. While this is indeed desirable (in order to get a change history that makes sense), etckeeper on Jaunty has a few features that really help in that area.

Autocommitting changes due to package installation/upgrade

Whenever you install, remove or upgrade packages, /etc contents may change. Rather than forcing you to commit those changes manually, etckeeper has a cool APT integration feature that does it for you. It even automatically commits any uncommitted change before the apt run so that you can really tell what changed. Let’s try that:

$ sudo apt-get upgrade
[...]
Committing to: /etc/                          
modified lsb-base-logging.sh
Committed revision 3.
$ sudo bzr log /etc
------------------------------------------------------------
revno: 3
committer: thc 
branch nick: jaunty-test /etc repository
timestamp: Sun 2009-02-22 11:36:29 +0000
message:
  committing changes in /etc after apt run
  
  Package changes:
  -lsb-base 3.2-20ubuntu2
  -lsb-release 3.2-20ubuntu2
  +lsb-base 3.2-20ubuntu3
  +lsb-release 3.2-20ubuntu3
[...]
 

No more cold sweat during upgrades !

Daily autocommits

Some lazy folks forget to commit their changes. Or they just don’t want to care about it. How about being able to get a day-by-day history of configuration file changes without ever manually committing anything ? That’s where the recently-added daily autocommit saves the day. It will catch uncommitted changes every night and autocommit them for you:

$ sudo bzr log --line /etc
4: root 2009-02-23 daily autocommit
3: thc 2009-02-22 committing changes in /etc after apt run
2: thc 2009-02-22 Change domain name to mycompany.com
1: thc 2009-02-22 Initial commit
 

Don’t want those autocommits to potentially mess up your well-maintained commit history ? You can easily disable them in /etc/etckeeper/etckeeper.conf.

etckeeper by default ?

With these two options enabled by default, without any specific user interaction, you can automatically build a nice history of the changes made by package installs or day-by-day by the user. You don’t really need to care about it, and this history will be ready for you the day you need it.

That makes etckeeper something that could be installed by default, for example on server installs. The user could completely ignore it until the day he needs it, and discover that during all that time etckeeper automatically logged everything.

In next episode

In part 3 of the etckeeper chronicles we’ll expose the current limitations of etckeeper and the future work planned to overcome them. Stay tuned !

Categories: Ubuntu, Ubuntu Server
  1. February 26, 2009 at 17:40

    Is there a way to get etckeeper + bzr in Hardy?

  2. February 27, 2009 at 10:51

    This software is pretty damn neat. The aptitude autocommit feature is present from 0.14 (which is in Hardy).

    mariuss: etckeeper is in universe in Hardy. bzr is in main. Install both and then edit /etc/etckeeper/etckeeper.conf and set VCS=”bzr” and comment out VCS=”git”.

  3. Thierry Carrez
    March 2, 2009 at 07:12

    @mariuss: The version of etckeeper in hardy doesn’t support the etckeeper bzr plugin so you have to manually run “etckeeper precommit” before you run “etckeeper commit” to keep everything in sync. That’s the reason why I wouldn’t recommend the use of this combo (as did the etckeeper author by that time). If you want to test it, however, it’s as simple as George said it is🙂

  4. March 2, 2009 at 17:02

    Thanks for the clarifications.

    Any chance etckeeper will be back-ported to Hardy? Being LTS it will be a while before it will be upgraded on servers.

    With precommit missing, it is not any worse than using plain bzr, is it?

  5. Simon
    October 16, 2009 at 07:25

    it’s dead easy to grab the latest snapshot from http://git.kitenet.net/?p=etckeeper.git and install it yourself – that’s what I’ve done on my Hardy LTS servers🙂

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s