Jaime Frutos Morales's blog


Installing & using etckeeper in Ubuntu 9.04

Filed under: SysAdmin, Ubuntu — acidborg @ 16:28

Etckeeper is a collection of tools to store /etc in a version control system. It allows you to read the changes that have been made to the files in /etc, document these changes and recover a previous version of a modified file in case we made some changes that we don’t want to keep.

Its installation is trivial:

apt-get install etckeeper

By default, Bazaar Distributed Version Control System is used, but you can use Git, Mercurial or Darcs instead. You just have to edit its configuration file (/etc/etckeeper/etckeeper.conf) and uncomment the line with your favorite DVCS (and comment the line VCS=”bzr” if you don’t want to use Bazaar).

To initialize etckeeper use:

etckeeper init

To make your first commit to etckeeper use:

etckeeper commit "Initial commit"

Any time you make a change to any file in /etc and you want to document it, use the previous command with the corresponding explanation.

Changes to /etc before installing new software using dpkg or apt are kept automatically by default. You can change this by editing its configuration file and uncommenting “AVOID_COMMIT_BEFORE_INSTALL=1”. Besides, etckeeper commits changes automatically every day, so if you want to avoid it, uncomment “AVOID_DAILY_AUTOCOMMITS=1” in its configuration file.

Here are some useful commands to take advantage of etckeeper if you use Bazaar DVCS:

  • To show etckeeper’s history:

    bzr log --line /etc

  • To show differences between the last version and the current state of /etc:

    bzr diff /etc

  • To show changes in version X:

    bzr diff -cX /etc

  • To recover version X of a FILE:

    bzr revert -rX /etc/FILE


  1. AFAIK git is the default

    Hi Jaime,

    Thanks for let me know about the existence of etckeeper 🙂

    AFAIK, git is the default VCS in etckeeper, that’s what I’ve read on the quick tutorial and that’s what I’ve found, at least, on hardy heron.

    Comment by Anonymous — 09/06/2009 @ 06:37

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog at WordPress.com.

%d bloggers like this: