TurnKey Linux Virtual Appliance Library

TKLBAM-backup error can't connect to host

Backups (daily) worked fine for months, nothing changed and now 4 servers say when running tklbam-backup:

Traceback (most recent call last):
File "/usr/bin/tklbam-backup", line 266, in <module>
File "/usr/bin/tklbam-backup", line 195, in main
conf.profile = get_profile(hb)
File "/usr/bin/tklbam-backup", line 122, in get_profile
new_profile = hb.get_new_profile(turnkey_version, profile_timestamp)
File "/usr/lib/tklbam/hub.py", line 205, in get_new_profile
response = self._api('GET', 'archive/timestamp/', attrs)
File "/usr/lib/tklbam/hub.py", line 183, in _api
return API.request(method, self.API_URL + uri, attrs, headers)
File "/usr/lib/tklbam/hub.py", line 115, in request
File "/usr/lib/python2.6/dist-packages/pycurl_wrapper.py", line 55, in get
return self._perform()
File "/usr/lib/python2.6/dist-packages/pycurl_wrapper.py", line 40, in _perform
pycurl.error: (7, "couldn't connect to host")

No proxy, no firewall rule changes,...

Alon Swartz's picture

DNS propagation?

The Hub's frontend IP was changed a few days ago, so my guess is the DNS servers you are using have not updated their cache. In general, I recommend using Googles public DNS service:,

The new Hub's IP address is - you can use that to test your server is getting the correct IP. But do not hardcode that in your hosts file, that's what DNS is for:

ping hub.turnkeylinux.org

I hope the above helps. If you still have issues please post back.

BTW, we took very careful care before the change to reduce the Hub records TTL to the minimum, wait over 24 hours for propagation to happen, and only then make the change.

Same here

I am seeing the same thing.  In my case, I just enabled the backups for the first time a few days ago, and I selected the option to run one backup daily.

The backup runs fine from a shell, but when run via cron.daily I also see the same error.  I thought maybe it was PATH related, so I manually modified the PATH inside tklbam-backup but now I get a new set of errors:


warning: using cached profile because of a Hub error: (500, '<html>\n<head>\n    <style type="text/css">\n    body {\n        font-family', ' Verdana, sans-serif;\n        line-height: 1.4em;\n    }\n    h1 {\n        font-size: 160%;\n        font-weight: bold;\n        color: #495961;\n        letter-spacing: -1px;\n        text-shadow: 1px 1px 0px #ddd;\n    }\n    hr {\n        border: none;\n        border-bottom: 1px solid #DDDDDD;\n        clear: both;\n        overflow: hidden;\n        margin-bottom: 10px;\n    }\n    p {\n        color: #495961;\n    }\n\n    .lifted-edges {\n        position: relative;\n    }\n    .lifted-edges:before,\n    .lifted-edges:after {\n        content: "";\n        position: absolute;\n        z-index: -1;\n        bottom: 15px;\n        left: 10px;\n        width: 50%;\n        height: 20%;\n        max-width: 300px;\n        -moz-transform: rotate(-3deg);\n        -o-transform: rotate(-3deg);\n        -webkit-transform: rotate(-3deg);\n        -ms-transform: rotate(-3deg);\n        transform: rotate(-3deg);\n        -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);\n        -webkit-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);\n        box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);\n        -moz-border-radius: 4px;\n        border-radius: 4px;\n    }\n    .lifted-edges:after {\n        right: 10px;\n        left: auto;\n        -moz-transform: rotate(3deg);\n        -o-transform: rotate(3deg);\n        -webkit-transform: rotate(3deg);\n        -ms-transform: rotate(3deg);\n        transform: rotate(3deg);\n    }\n    .outer {\n        width: 630px;\n        margin: 3em auto;\n    }\n    .inner {\n        background: white;\n        -moz-border-radius: 4px;\n        border-radius: 4px;\n        padding: 25px;\n        -moz-box-shadow: 0 1px 5px rgba(0,0,0,0.3), 0px 0px 80px rgba(0,0,0,0.07) inset;\n        -webkit-box-shadow: 0 1px 5px rgba(0,0,0,0.3), 0px 0px 80px rgba(0,0,0,0.07) inset;\n        box-shadow: 0 1px 5px rgba(0,0,0,0.3), 0px 0px 80px rgba(0,0,0,0.07) inset;\n    }\n    </style>\n</head>\n\n<body>\n    <div class="outer lifted-edges"><div class="inner">\n        <h1>Oops! Something went wrong</h1>\n        <hr/>\n        <p>\n            We are probably doing a little maintenance, no need to worry.<br/>\n            Sorry about this, please try again shortly.\n        </p>\n        <p>If you repeatedly receive this error, please consider\n        <a href="mailto:admin@turnkeylinux.org">reporting</a> it.</p>\n    </div></div>\n</body>\n\n</html>\n')
Traceback (most recent call last):
 File "/usr/bin/tklbam-backup", line 266, in <module>
 File "/usr/bin/tklbam-backup", line 199, in main
   registry.credentials = hb.get_credentials()
 File "/usr/lib/tklbam/hub.py", line 191, in get_credentials
   response = self._api('GET', 'credentials/')
 File "/usr/lib/tklbam/hub.py", line 183, in _api
   return API.request(method, self.API_URL + uri, attrs, headers)
 File "/usr/lib/tklbam/hub.py", line 115, in request
 File "/usr/lib/python2.6/dist-packages/pycurl_wrapper.py", line 55, in get
   return self._perform()
 File "/usr/lib/python2.6/dist-packages/pycurl_wrapper.py", line 40, in _perform
pycurl.error: (52, 'GnuTLS recv error (-9): A TLS packet with unexpected length was received.')
run-parts: /etc/cron.daily/tklbam-backup exited with return code 1

Error 7 - Can't get past the first screen


I've entered the API key and when I click continue I get the following error:

Error: (7, "couldn't connect to host")

Any ideas? I presume it is nothing to do with the machine with the Turnkey installation on it as this was provided by Turnkey. Could it be something to do with a firewall? Do we need to open certain ports to enable the connection to work?

Thanks for any advice.

Jeremy's picture

Could be Firewall

or something else to do with networking.

For starters I'd be testing that the TKL appliance can ping other machines and can also be pinged...

Will give it a test - thank

Will give it a test - thank you

multiple interfaces

I had the same error (7, "couldn't connect to host") after configuring a second interface on my turnkey linux vm. I may have messed up the configuration through the frontend or the scripts generating the config add a default gateway on the second interface as well. This can be straightened out by editing /etc/network/interfaces as root. Here's an example configuration that uses the default route and gateway via eth0. Note that the first two lines indicating an automated setup have been deleted and that the second interface does not list neither a gateway nor DNS servers.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto eth1
iface eth1 inet static
Reboot and check the routing table:
$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0   U         0 0          0 eth1         UG        0 0          0 eth0
Note that there is only a single '' destination. When you see two of these you are likely to have a problem. With the single default gateway tklbam worked as expected.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)