Ubuntu – Backup stops because of claim ‘Computer name changed’, which is it not true

backupdeja-dupduplicity

Using Ubuntu 16.04, deja-dup 34.2, and duplicity 0.7.06.

To start a weekly backup I connected the usual external drive with the usual computer, gave the password and received the halt message:

The existing backup is of a computer named correctname, but the current computer name is correctname.lan. If this is unexpected, you should back up to a different location.

Cancel/Continue

This is unexpected. Not because I plugged the external drive into the wrong computer, but because the name of the computer is indeed correct. Checked with uname -n.

I am not quite inclined to back up in a different location, because I would not want to have this issue happen again with other names/computers. Fresh backups are time-consuming, among other considerations.

The questions arise: how comes that deja-dup/duplicity is making up this name? how to fix this?

Added. By clicking on Continue you do perform an incremental backup. Still the halt message is an unnecessary stop in the procedure to avoid if possible.

Best Answer

Using Ubuntu 19.10, deja-dup 40.1, duplicity 0.8.04.

The questions arise: how comes that deja-dup/duplicity is making up this name?

According to bug reports (ranging as far back as 2010), it's a bug in affecting . Duplicity prefers the fully-qualified domain name (FQDN) for the backup's computer name.

  • The way the FQDN lookup is performed is affected by both your computer's network configuration, and the way the network the computer is connected to behaves.
  • In particular, external network changes can therefore break backups.1 This includes moving the computer from one network to another.

See

how to fix this?

The bug reports hints at editing /etc/hosts in various ways. Here's what I changed, with mycomputer being my chosen name. Note that order seems to matter.

/etc/hosts (ipv6 addresses omitted)

Original:

127.0.0.1   localhost
127.0.1.1   mycomputer

Modified:

127.0.0.1   mycomputer localhost
127.0.1.1   mycomputer

As soon as I saved the file, an automatic backup started. It worked as expected.2,3

See


1 My backups broke around the time when my ISP upgraded their infrastructure in my area to . Started seeing "hostnamed changed" with hostnames such as dynamic-xxxx-yyyy-zzzz.area-123.example.com.

2 Tried to verify by reverting the file and rebooting, but backup still works so unsure if it actually fixes the problem, or just triggers deja-dup/duplicity "the right way". Might be related to DHCP timeouts (7 days) in the ISP-owned router, or some other setting I changed. Am posting the answer anyways, but might have to revise if it stops working in a week.3

3 It has now been more than one week since writing this answer.2 Both starting a backup and verifying backups succeeded. Also rebooted and started another backup, which also succeeded. It seems the suggested fix works so far, at least for myself on my machine and in my network environment.

Related Question