Joey Hess: difficulties in backing up live git repositories
But you can t just tar.gz up the bare repositories on the server and hope for the best. Maybe a given repository will be in a valid state; maybe it won t.-- Jeff Mitchell in a followup to the recent KDE near git disaster This was a surprising statement to me. I seem to remember that one of (many) selling points for git talked about back in the day was that it avoided the problem that making a simple
cp (or backup) of a repository
could lead to an inconsistent result. A problem that subversion
repositories had, and required annoying commands to work around.
(svnadmin $something -- iirc the backend FSFS fixed or avoided most of
this issue.)
This prompted me to check how I handle it in
ikiwiki-hosting. I must have
anticipated a problem at some point, since ikisite backup takes care
to lock the git repository in a way that prevents eg, incoming pushes
while a backup is running. Probably, like the KDE developers, I was
simply exercising reasonable caution.
The following analysis has probably been written up before (train; limited
network availability; can't check), but here are some scenarios to consider:
- A non-bare repository has two parts that can clearly get out of sync
during a backup: The work tree and the
.gitdirectory.- The
.gitdirectory will likely be backed up first, sincegetdirentwill typically return it first, since it gets created first . If a change is made to the work tree during that backup, and committed while the work tree is being backed up, the backup won't include that commit -- which is no particular problem and would not be surprising upon restore. Make commit again and get on with life. - However, if (part of) the work tree is backed up before
.git, then any changes that are committed to git during the backup would not be reflected in the restored work tree, andgit diffwould show a reversion of those changes. After restore, care would need to be taken to reset the work tree (without losing any legitimate uncommitted changes).
- The
- A non-bare repository can also become broken in other ways if just
the wrong state is snapshotted. For example, if a commit is in progress
during a backup,
.git/index.lockmay exist, and prevent future commits from happening, until it's deleted. These problems can also occur if the machine dies at just the right time during a commit. Git tells you how to recover. (git could go further to avoid these problems than it does; for example it could check if.git/index.lockis actually locked using fcntl. Something I do in git-annex to make the.git/annex/index.lockfile crash safe.) - A bare repository could be receiving a push (or a non-bare repository
a pull) while the backup occurs. These are fairly similar cases,
with the main difference being that a non-bare repository has the reflog,
which can be used to recover from some inconsist states that could be
backed up. Let's concentrate on pushes to bare repositories.
- A pack could be in the process of being uploaded during a backup. The KDE developers apparently worried that this could result in a corrupt or inconsistent repository, but TTBOMK it cannot; git transfers the pack to a temp file and atomically renames it into place once the transfer is complete. A backup may include an excess temp file, but this can also happen if the system goes down while a push is in progress. Git cleans these things up.
- A push first transfers the
.git/objects, and then updates.git/refs. A backup might first back up the refs, and then the objects. In this case, it would lose the record that refs were pushed. After being restored, any push from another repository would update the refs, even using the objects that did get backed up. So git recovers from this, and it's not really a concern. - Perhaps a backup chooses to first back up the objects, and then the
refs. In this case, it could back up a newly changed ref, without
having backed up the referenced objects (because they arrived
after the backup had finished with the objects). When this happens,
your bare repository is inconsistent; you have to somehow hunt down
the correct ref for the objects you do have.
This is a bad failure mode. git could improve this, perhaps, by
maintaining a reflog for bare repositories. (Update:
core.logAllRefUpdatescan be set to true for bare repositories, but is disabled by default.)
- A "backup" of a git repository can consist of other clones of it.
Which do not include
.git/hooks/scripts,.git/configsettings, and potentially other valuable information, that strangely, we do not check into revision control despite having this nice revision control system available. This is the most likely failure mode with "git backups". :P
PS: git-annex is itself entirely crash-safe, to the best of my abilities, and also safe for naive backups. But inherits any problems with naive backups of git repositories.
Since a while 
So. following up on my previous post about implementing a libravatar server, this will be an announcement of a quick Qt5 based client library for libravatar so that everyone can put avatars everywhere!
Get it while it is hot on
there are not many RC bugs left (yeah!), this also means that my work in
this area was rather minimal last week:
I've made two new designs for
I ve been using this process for debugging the installer while launched from a Debian Live desktop. Having a full live environment at your disposal during install is a boon to debugging because you don t have to work within the constraints normally imposed upon you by the limited debian-installer environment. Caveat: running debian-installer from the debian-installer-launcher still has one or two unresolved issues, so unless you re specifically working on live integration issues like I am, compare with a conventional d-i image install to gain the added confidence the install is the same in both environments.
There are no longer active maintainers working on
So
hello.
A new relase 0.10.3 of
Update: This isn't actually that much better than letting them
access the private key, since nothing is stopping the user from
running their own SSH agent, which can be run under strace. A better
solution is in the works. Thanks Timo Juhani Lindfors and Bob Proulx
for both pointing this out.
At
This Clevo laptop is a new machine and like a lot of new machines, not all of its hardware has drivers in the current stable release of debian.
Happily, there is a driver for its rtl8723ae wireless networking device in the later 3.8 Linux kernel versions. So it s just a case of installing the package called kernel-package and following the instructions in it, to make a new linux-image package with the latest drivers in it.
One small thing which tripped me up is that you usually need to write make-kpkg rootcmd fakeroot initrd kernel-image now. I forgot the initrd option at first.
On wednesday 7. of November I gave a talk at EPFSUG in Brussels about
FreedomBox.
EPFSUG is an interest group of Free Software users working inside the
European Parliament.
The FreedomBox is a project to help non-geeks care about their
personal privacy when online, same ways as geeks have practiced for a
decade or more.
The goal is a small, cheap physical box looking like and operating like
an internet gateway or wifi router many are accustomed to nowadays - but
with three additions:
Is Croatian kiberkomunist (i.e., cyber-communist ) artist and hacker 
Noticed with a lot of happiness today that