problem resolving host when changing wifi network

Tjaart van der Walt tjaart at
Tue Feb 4 21:53:39 GMT 2014

Thanks Nicolas,

I decided to take your last advice and make offlineimap
dependent on my network service. That way whenever my wifi reconnects it restarts
the offlineimap systemd service. This will be sufficient for my needs.

For posterity I give the technical details of my solution:
I use netctl, I edited: 

By adding the following line:

ExecUpPost="su -c '/usr/bin/systemctl restart offlineimap@<my_username>.service'"


Nicolas Sebrecht writes:

> On Fri, Jan 31, 2014 at 05:14:10PM -0600, Tjaart van der Walt wrote:
>> Hi,
>> I take my laptop to work everyday, so I switch between my wifi
>> connection at home, and the one at work. Most of the time after I get to
>> the other side I get the following error from offlineimap:
>> ERROR: Could not resolve name '' for repository 'xxx-remote'. Make sure you have configured the server name correctly and that you are online.
>> However when I try to debug, I find that I can ping the mail server:
>> ping
>> PING ( 56(84) bytes of data.
>> 64 bytes from ( icmp_seq=1 ttl=47 time=27.5 ms
> It looks like the program instance keeps the old server (I suspect it
> takes the local DHCP router) for name resolution. Do you manually or
> programatically start a new instance of offlineimap once the media has
> change?
> You might want to add a static public nameserver to the network
> configuration of the system.
>> This is rather bad, because if I run offlineimap using systemd I am not 
>> aware of this problem, and I receive no new mail.
> I would make the service to depend on the network service so it can be
> restarted on each reconnection.
> journalctl might help you to track the offlineimap state.

Tjaart van der Walt

More information about the OfflineIMAP-project mailing list