Duplicity fail, hostname not known

Duplicity backup fails to start with message “hostname not known.”

duplicity --version                                                                                                    
duplicity 3.0.5.1 June 25, 2025
```
hostname -f                                                                                                     
chas-pc
```
 ip addr show                                                                                            1|1|0|0 ✔ 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
```

/etc/hosts:

# Standard host addresses 
127.0.0.1  localhost
::1        localhost ip6-localhost ip6-loopback 
ff02::1    ip6-allnodes 
ff02::2    ip6-allrouters 
# This host address 
127.0.1.1  chas-pc
```

Would it be safe for me to change the “# This host address / 127.0.1.1” in /etc/hosts to 127.0.0.1, and is this lilkely to solve the Duplicity problem?

You can have as many hostnames against any single IP address as you want in there. You don’t even need them on separate lines, just start the line with the IP address and follow it with a space-delimited list of whatever hostnames you want.

This is very untypical if at all possible. Are you sure it is not 0.0.1? Otherwise yes uncomment localhost.

2 Likes

I changed the IP to 127.0.0.1 in /etc/hosts but Duplicity still says hostname not known and won’t backup.

# This host address is a comment – any line behind a # is a comment – you can delete it, or leave it, it really makes no difference.

127.0.1.1 chas-pc should be left alone. Likewise, don’t touch 127.0.0.1 localhost. However, I strongly suggest you remove the ``` from:

You can add other loopback addresses using the following general examples;

127.0.0.1  mysite.local
127.0.0.1  anothersite.org

Whatever site addresses you place next to the 127.0.0.1 will be redirected to your own computer; your localhost. As an example (I do not recommend doing this), if you added 127.0.0.1 manjaro.org to your /etc/hosts file, every attempt to browse to https://manjaro.org would result in opening 127.0.0.1 (your localhost).

This is just general information; I know nothing of Duplicity. However, I suspect a certain port might be needed; perhaps check the documentation.

I assume the ```` is a formatting error, it should be 3 backticks by the way.

I’d just comment out that line altogether for testing, otherwise it should be 127.0.0.1

A quick google search showed 127.0.1.1 is probably dns cache server (which is not installed by default). So, the OP has to undo whatever mess he did with the dns service on the pc.

Looks like https://xyproblem.info/

2 Likes

Numerous attempts to make changes following hints and suggestions made here did not result in a solution. What finally worked was disconnecting the VPN. So while that is not what I would consider a totally valid “solution,” I’m going to mark this solved (as it is, sort of, for now). Thanks to all of you for your input; I appreciate it.

A good vpn changes the dns :slight_smile:

So what appears to be happening is that your VPN is setting a DNS server which is resolving a particular hostname in a way you don’t want.

If you want to be able to over-ride DNS lookup with an entry in /etc/hosts, you can edit /etc/nsswitch.conf and change the line that starts hosts: so that files is in that line before dns. This will ensure that any DNS lookup looks at your hosts file first and only queries a DNS server if the hostname isn’t in there.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.