Raspberry Pi Owners - Timekoin Image Updated Feb 21, 2014

Having issues with your Timekoin Server? Someone might be able to answer your questions here.
Post Reply
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Raspberry Pi Owners - Timekoin Image Updated Feb 21, 2014

Post by KnightMB »

I've started a new sticky topic here for questions & answers if necessary.

Minimum Specs:
Raspberry Pi (rev B - 512MB model) Recommend
Raspberry Pi (rev A - 215MB model) Will work, but will use a lot of swap drive space on SD card
16GB or larger SD Card (Class 6 or better)
True 5v micro-USB power supply that does at least 700 ma for the device

Image for Download
  1. 8GB SD Card Image - Built with Arch Linux + Turbo Mode - Version 3.36 Installed + Full Database + Timekoin Client v1.25
    Download Here
Changes from previous image (v3.2).
  1. Updated Timekoin Server to latest version
  2. Timekoin Client now included with image (http://server.ip/tkclient/)
  3. Added ability to have device auto-start Timekoin from power failure (details below)
  4. Added ability to run on Rev A boards (may eat SD card eventually)
  5. Self-signed SSL Support Added (use HTTPS now if needed)
  6. Update Transaction History Database as of Feb 21, 2014 before image was created
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by KnightMB »

How to setup your Raspberry Pi to re-start Timekoin from a unexpected power failure.

If you are like me, your Pi sits in a corner somewhere just humming along. But what happens if the power goes out while you are away. Well, when it finally comes back on, your Pi will boot up. First it will run a disk check (on the SD card) which can take a while if it was in the middle of some activity when the power failed. Next after the OS boots, MariaDB will run it's own database integrity check upon starting, which can take a little longer, maybe almost 10 minutes sometimes. Finally, the device is up and ready, but unless you log back in and actually start the process, it won't do anything else.

The extra step to have it start after all these checks finish can be setup with one permission setting in Timekoin and one script file modification.
  1. First, login to your Timekoin Server and head over to the Options tab. Click on the Manage Hash Code Access button at the bottom.
  2. Next will create a permission to allow our script to start Timekoin. To do this, simply pick an empty field and start with a name. The Name is just descriptive, can be anything you like. For these instructions will call it "Start Timekoin".
  3. Next is the Hashcode, which is really just another name for the password. This is the password it will take to start the Timekoin Server. I would suggest picking something a little more creative than 12345 for security reasons. ;)
  4. Next is the permissions allowed. To the right is a bunch of check boxes, we only need a check mark in the tk_start_stop box. Click the "Save Settings" button at the bottom and wait for the "Hashcode Settings Saved!" confirmation.
  5. Now, the next step requires editing one script file. The file is located at /etc/cron.hourly/start-timekoin

    Code: Select all

    #!/bin/sh
    #
    # Start Timekoin Server script written by KnightMB (2014)
    #
    # Start Timekoin Process
    #curl "http://localhost/timekoin/api.php?action=tk_start_stop&active=1&hash=12345"
    
    # Start Watchdog
    #curl "http://localhost/timekoin/api.php?action=tk_start_stop&active=3&hash=12345"
    
    exit 0
    
  6. Inside this file, both commands to start Timekoin + Watchdog are currently disabled with the # in front of them. To enable, simply delete the # in front of the command.
  7. But wait! You are not done. See the last part of the command &hash=12345" The hash=12345 is where the password goes that you just created earlier. The 12345 is just an example. Set this to your password, example &hash=mypasswordhere" Then you can save the file and exit. :mrgreen:
You are finished. You might ask, "Isn't this going to keep starting it over and over?" Nope, the command only starts the process. If it is already running, it will simply be ignored.

Next you might ask "Why the hourly cron job?" Mainly because if the system has the unexpected power failure, it is going to spend time doing disk and database checks. If you try to start Timekoin in the middle of these straight from boot up, it just simply won't work or could miss. So to avoid that, a job that runs over and over will eventually get the system up and running again. Because the Pi system boots and has to reset it's own clock, the hourly cron job is usually run last once the system is finished doing other task and if it is too busy, at least it will try the command in the next hour just in case, every hour until the Timekoin is running again. So while it is not an instant start from power failure process, works more like a eventually start from power failure process.

Of course, it is not 100% bullet proof process because if the SD card becomes damaged for any reason (power surge, power brown out, power flipping), it won't do much good if the system can't boot. :?
whiteb
Posts: 122
Joined: Sun Dec 15, 2013 4:44 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by whiteb »

OOPS, because of the random PI lockups, I decided to install PI watchdog in Archlinux. Mistake.

For some reason, Watchdog ended up in a permanent loop, and system just rebooted.

Spent a few hours looking for a solution. Ended up going with Paragon EXTFS to mount the partition, and kill (Rename actually) Watchdog's config file, so on boot, it panic's and wont load.

I am going to go to sleep now :)
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by warmach »

I just tried the PI image on a Raspberry Pi 2, but it wouldn't boot. I put the same SD card into a Pi 1, no problem. The image needs to be updated to work with the Pi 2.
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by KnightMB »

warmach wrote:I just tried the PI image on a Raspberry Pi 2, but it wouldn't boot. I put the same SD card into a Pi 1, no problem. The image needs to be updated to work with the Pi 2.
Just to clarify, Pi 1 such as the Rev B with 512 MB of RAM? I see the Pi 2 has much better specs, I need to grab one to try it out, looks interesting. :)
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by warmach »

KnightMB wrote:
warmach wrote:I just tried the PI image on a Raspberry Pi 2, but it wouldn't boot. I put the same SD card into a Pi 1, no problem. The image needs to be updated to work with the Pi 2.
Just to clarify, Pi 1 such as the Rev B with 512 MB of RAM? I see the Pi 2 has much better specs, I need to grab one to try it out, looks interesting. :)
Yes, you are correct. Raspian works on both versions of Pi but I do not know anything about Archlinux
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by KnightMB »

warmach wrote:
KnightMB wrote:
warmach wrote:I just tried the PI image on a Raspberry Pi 2, but it wouldn't boot. I put the same SD card into a Pi 1, no problem. The image needs to be updated to work with the Pi 2.
Just to clarify, Pi 1 such as the Rev B with 512 MB of RAM? I see the Pi 2 has much better specs, I need to grab one to try it out, looks interesting. :)
Yes, you are correct. Raspian works on both versions of Pi but I do not know anything about Archlinux
Archlinux support seems to have gotten really wonky on the Pi, I tried to update a test one and basically after the update, nothing worked anymore. I haven't tried all the other OS that one can load on the Pi, do you have any that you think would make a good "headless" OS for the Pi? It wouldn't be any big deal to switch them, I am not partial to any flavor of Linux to run, just looking for one that will do the job the best. :)
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by warmach »

KnightMB wrote: Archlinux support seems to have gotten really wonky on the Pi, I tried to update a test one and basically after the update, nothing worked anymore. I haven't tried all the other OS that one can load on the Pi, do you have any that you think would make a good "headless" OS for the Pi? It wouldn't be any big deal to switch them, I am not partial to any flavor of Linux to run, just looking for one that will do the job the best. :)
My only experience is with Raspian. It is a Ubuntu spin off but I do not think it was intended to be a headless machine. I am sure unnecessary services could be disabled to make it use resources better. TK has worked fine in it for me in the past. Although I did have enough "weird" things happen that stopped timekoin that I created a bash script to restart it automatically.
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Raspberry Pi Owners - Timekoin Image Updated Feb 21, 201

Post by KnightMB »

On the download page, https://www.raspberrypi.org/downloads/

I see that Arch Linux is gone now, maybe they dropped support?

But, the Raspbian does have 3 flavors, one of them is the "Raspbian Jessie Lite" which is just the OS (no desktop, etc.) which is perfect because it looks like the Raspbian has better support for the Pi 1 and Pi 2 and your experience is that work across both of them which is great news, otherwise 2 separate images would have to be created. So the next update to the Timekoin Pi image might just be switching over the Raspbian, those running the old Arch Linux image would only need to save their keys and reload back into the new image for an upgrade for example. :)
Post Reply