Ubuntu 16.04 curl timeouts kodi 17.1

[ I did a forum/google search for my error message and couldn’t find a solution to this, so posting it here in case it helps someone else ]

Symptoms:

Couldn’t install addons
Plex wouldn’t download cover art
kodi.log had lots of “ccurlfile::stat – failed: timeout was reached” entries

System:

Ubuntu 16.04
Kodi 17.1

Solution that worked for me

This just randomly started happening, I’m assuming a Ubuntu update I installed upset something somewhere with curl/kodi. Fetching the failed URLs from the command line worked perfectly, so this was a bit of a tricky issue.

I tried disabling ipv6, testing my DNS and changing the resolvers I was using, but given I could fetch the failed files from the command line it seemed unlikely to me that any of these would be the issue.

I found something in the kodi wiki referring to changing the curlclienttimeout.

In ~/.kodi/userdata/advancedsettings.xml I changed the curlclienttimeout from 3 seconds to 30 seconds (perhaps excessive but given it’s working now I’m unlikely to experiment) as per Advancedsettings.xml#cache (wiki)

<curlclienttimeout>30</curlclienttimeout>

This solved my problem.