Ping localhost failed in BackupPC after Ubuntu 12.04 upgrade

After upgrading my backup server from the previous LTS release (Lucid) to the new one, the config which backs up /etc on localhost was failing.  It was failing because pings to localhost were failing.  This is no good – localhost should be pingable. :)  Ultimately, this is because IPv6 is enabled by default now.  I don’t use IPv6 on my internal network, mostly because it’s new and scary and I don’t like change.  Or because I just don’t need it.  So, here’s how to disable IPv6 on your Ubuntu 12.04 / Precise box:

sauer@pyro:~$ ip addr show lo
 1: lo: mtu 16436 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo
 inet6 ::1/128 scope host
 valid_lft forever preferred_lft forever
 sauer@pyro:~$ sudo sysctl net.ipv6.conf.all.disable_ipv6
 net.ipv6.conf.all.disable_ipv6 = 0
 sauer@pyro:~$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
 net.ipv6.conf.all.disable_ipv6 = 1
 sauer@pyro:~$ ip addr show lo
 1: lo: mtu 16436 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo

Note how the inet6 address goes away as soon as ipv6 is disabled.  This will be in effect until you next reboot.  To make it permanent, you can create a file in sysctl.d and apply that (then run sysctl again just to make sure it was set):

sauer@pyro:~$ echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee /etc/sysctl.d/60-disableipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
sauer@pyro:~$ sudo start procps
procps stop/waiting
sauer@pyro:~$ sudo sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1

The other option is to actually configure the path to ping6 in the BackupPC config file (/etc/backuppc/config.pl) by putting in a value for Ping6Path – such as $Conf{Ping6Path} = ‘/bin/ping6’;  The default config on newer systems has that parameter set to an empty string; older installs which have been upgraded don’t even have that parameter included.

Your choice of solution will vary based on whether or not you use IPv6.  If you don’t know, then you’re not using IPv6 and can pretty safely just disable it.  Otherwise, just configure BackupPC the way it should’ve been configured to begin with.