LinuxCommandLibrary

etckeeper

Track /etc configuration directory in version control

TLDR

Set up a Git repo and perform various setup tasks (run from /etc)

$ sudo etckeeper init
copy

Commit all changes in /etc
$ sudo etckeeper commit [message]
copy

Run arbitrary Git commands
$ sudo etckeeper vcs [status]
copy

Check if there are uncommitted changes (only returns an exit code)
$ sudo etckeeper unclean
copy

Destroy existing repo and stop tracking changes
$ sudo etckeeper uninit
copy

SYNOPSIS

etckeeper [-h | --help] [-v | --verbose] [action [action arguments]]

PARAMETERS

-h, --help
    Show help message and exit

-v, --verbose
    Increase verbosity (repeatable)

init
    Initialize /etc repository

commit [message]
    Commit changes with optional message

update
    Update VCS working tree

update-ignore
    Update working tree ignoring listed files

vcs [args]
    Pass through to underlying VCS

pre-install
    Pre-installation hook

post-install
    Post-installation hook

pre-remove
    Pre-removal hook

post-remove
    Post-removal hook

gc
    Garbage collect repository

register-ignore
    Register file to ignore list

list-ignores
    List ignored files

ignore
    Add file to ignore list

unignore
    Remove file from ignore list

unclean
    Check if working directory is clean

has-ignores
    Check for any ignored files

files-changed-since
    List files changed since revision

DESCRIPTION

Etckeeper is a set of tools designed to keep the /etc directory under version control, allowing system administrators to track changes to configuration files. It integrates seamlessly with package managers like APT, Pacman, Yum, and others, automatically committing changes before and after package installations, upgrades, or removals.

Primarily used on Linux systems, etckeeper supports multiple VCS backends including git (default), Mercurial, Bazaar, and Darcs. After installation, running etckeeper init sets up the repository. Manual changes can be committed with etckeeper commit "message", providing a full history of who changed what and when.

Key benefits include easy rollbacks of problematic updates, auditing configuration drifts, and safe experimentation with system tweaks. It hooks into package manager scripts to ensure /etc remains versioned without manual intervention. While powerful for servers and workstations, it requires root privileges and careful ignore list management to exclude transient files.

Etckeeper prevents configuration loss from failed updates and enables git log or git bisect for debugging issues over time. (248 words)

CAVEATS

Requires root privileges; must install a supported VCS first; configure ignores for transient files like logs; binary files may need special handling; not ideal for very large /etc.

SUPPORTED PACKAGE MANAGERS

APT, Pacman, Yum/RPM, Portage, Slackware's slapt-get, and others via hooks.

IGNORE FILES

Edit /etc/etckeeper/ignores or use etckeeper ignore for files like /etc/mtab, /etc/fstab to avoid spurious commits.

VCS BACKEND

Set via ETCKEEPER_VCS=git|hg|bzr|darcs; git recommended for efficiency.

HISTORY

Created by Joey Hess in 2007 for Debian; integrates VCS with package managers; widely used in Debian/Ubuntu derivatives and other distros; actively maintained with support for more package managers over time.

SEE ALSO

git(1), hg(1), bzr(1), darcs(1), apt(8), dpkg(8), pacman(8)

Copied to clipboard