Forum: 
Tags: 

tklbam wont accept api key

rickd's picture

I'm running a turnkey lamp v12, and had a working tklbam set up before.  I had cancelled my current account linked to my key, and created a new one. 

I know you use tklbam-init --force to do this, but it didn't work, even after completely removing /var/lib/tklbam, and reinstalling from apt-get.   I'm getting a usertoken error, and can't figure out why.

My api key is good, as it worked on another appliance doing the exact same thing to update the key.

Also: I'm paying for a backup monthly standard plan. It says there is email support. I can't figure out how exactly one would access this support? There is no mention of it anywhere on the dashboard.

Thank you!

Traceback (most recent call last):
  File "/usr/bin/tklbam-init", line 209, in <module>
    main()
  File "/usr/bin/tklbam-init", line 191, in main
    credentials = hb.get_credentials()
  File "/usr/lib/tklbam/hub.py", line 188, in get_credentials
    return Credentials(response)
  File "/usr/lib/tklbam/hub.py", line 159, in __init__
    self.usertoken = response['usertoken']
KeyError: 'usertoken'

 

Jeremy Davis's picture

Also FWIW I have just emailed you direct. After reading this I had a dig in my inbox and found your email (sorry I missed it).

For other users please use the Hub's Feedback feature. Obviously posting here is a good way to go too! :)

Stuart Robichaud's picture

what's the fix for this?

Jeremy Davis's picture

The issue in this case was caused by an update to the Hub API and occurred because of a combo of an old version of TurnKey (v12.x - later versions should not be affected) and an outdated version of TKLBAM.

The solution was to update to the latest version of TKLBAM like this:

apt-get update && apt-get install tklbam
Jeremy's picture

File "/usr/bin/tklbam-init", line 209, in <module>
    main()
  File "/usr/bin/tklbam-init", line 191, in main
    credentials = hb.get_credentials()
  File "/usr/lib/tklbam/hub.py", line 188, in get_credentials
    return Credentials(response)
  File "/usr/lib/tklbam/hub.py", line 159, in __init__
    self.usertoken = response['usertoken']
 

 

I have already tried to remove the directory, and then use: apt-get update && apt-get install tklbam  followed by tklbam-init

Should I or could I try removing /usr/lib/tklbam/  as well?

Thanks

Jeremy Davis's picture

If it was working with the old key but you're trying to add a new one then perhaps you have a different issue?

What version of TurnKey are you using? If you have no idea, you should be able to run

turnkey-version

It also might be useful to know what version of TKLBAM you have:

apt-cache policy tklbam

You can try removing /usr/lib/tklbam but I'm not clear whether that might help or not. It does seem to be consistent with the error that others were getting. And that is caused by a change in the Hub API (that requires a TKLBAM update).

Jeremy's picture

I changed the API Key back to the old one and its working fine again. If i switch it however it quits working.

Jeremy Davis's picture

I will need to talk with Liraz (the TKLBAM guru) about this...
Jeremy's picture

TurnKey Linux 12.0 / Debian 6.0.5 Squeeze


apt-cache policy tklbam
tklbam:
Installed: 1.4+7+ge4e99cc
Candidate: 1.4+7+ge4e99cc
Version table:
*** 1.4+7+ge4e99cc 0


Any thoughts? I more less inherited this problem from a guy that is no longer with the company. I also noticed that there is no TKLBAM in the Webmin console but there is on several of the other servers.

Thanks!!

Jeremy's picture

I did get TKLBAM to show up in the Webmin by reinstalling the package from APT. I am able to run a backup to the API key on a different server, and if I choose restore from the box having issues I am able to see that backup, so it must be linked to that API key in some way after running tklbam-init.

Jeremy Davis's picture

You have the latest version of TKLBAM so it should be working...

So let me clarify. You have reinstated the old API key (taht worked) but from within the server you can see the backup that you made on another server (using the new API key)!?

Is that right? If so that all sounds a little messy...

TBH I would personally consider updating to the v13.0 server anyway (using your TKLBAM backup to migrate the data)... If not, at least make sure that you have the Squeeze LTS repo enabled (and added in your security sources.list) otherwise you won't have had any Debian security updates for a long time...

Jeremy's picture

I did put the old API key back in and its working. I can only see other backups made with the old API key. Whe I try the new API key I cannot backup because I get the error, but I can see the backup I made using the new API key on a different server. Is there any chance that this is a security rights issue with my Amazon account?

Jeremy Davis's picture

Firstly, sorry for slow reply.

It sounds like something weird is going on... Is the new server a v13.0 one or another old v12.x one?

I could be wrong but I suspect that you are experiencing some weird v12.x TKLBAM bug caused by some edge case that exists in your scenario...

While I'd really love to help you troubleshoot it my inclination is not to spend too much time on this. IMO the best solution is to update to a newer version of TKL first.

As of the release of v14.0RC1 we are no longer actively supporting v12.x. We're not going to completely avoid v12.x, but we only have limited resources so focusing our resources on what most people want (i.e. the new v14.0 version) seems like the most efficient way to go...

Jeremy's picture

I inherited the issue from a gentleman that is no longer with the company. So I'm not too well versed in Linux particularly command line versions. Is there a guide available that could step me through an upgrade to v14? In the end my main concern is that I get everything switched to the new API key and account.

Thanks Again,

Jeremy G

Jeremy Davis's picture

But we could make one... Here! :)

From what I understand you can back up the current machine using an old account? I understand that it's not the AWS/Hub account you want to use longer term but you can currently do that correct? Or do you no longer have access to that old account at all?

Just top clarify: WHere is the machine currently running? Where do you want your new machine running? Locally (on some virtualisation platform?) Or running on Amazon?

Also v14.0 is not yet available. It will probably be a couple of weeks away yet... Still I think upgrading to v13.0 for the moment is not a bad idea (even if you upgrade again to v14.0 in a few weeks).

Jeremy Davis's picture

I just wanted to let everyone know that we have dug a bit deeper into this issue and turns out the mistake was ours. We have just released an update to TKLBAM for v12.x servers. Updating should mean that TKLBAM on v12.x servers should now work reliably with new Hub accounts. Apologies on the delay getting this fixed and released.

So it should be a simple case of:

apt-get update && apt-get install tklbam

Then it should all work.

David McNeill's picture

The above fix also resolved this issue...

root@turnkey:/etc/cron.daily# tklbam-backup
Traceback (most recent call last):
  File "/usr/bin/tklbam-backup", line 513, in <module>
    main()
  File "/usr/bin/tklbam-backup", line 343, in main
    registry.credentials = hb.get_credentials()
  File "/usr/lib/tklbam/hub.py", line 188, in get_credentials
    return Credentials(response)
  File "/usr/lib/tklbam/hub.py", line 159, in __init__
    self.usertoken = response['usertoken']
KeyError: 'usertoken'
Ken B's picture

  404  Not Found [IP: 91.189.88.149 80] Err http://archive.ubuntu.com lucid-security/universe Packages   404  Not Found [IP: 91.189.88.149 80] Err http://archive.ubuntu.com lucid/main Packages   AND MANY MORE  
Jeremy Davis's picture

It looks like this server is v11.x. That was back when TurnKey was Ubuntu based.

It would not have had any security updates for the last 2+ years so I recommend that you migrate your data to the current v14.2 release if possible.

Rather than hijacking this thread with irrelevant info, please start a new thread.

Please share as much info as you can about the server, where it's running and what you are using it for. I'll do my best to give you as much advice and/or guidance as I can.

Post new comment