Exploring a Winkhub .ubi image


When my rooted winkhub died, I pulled out my backup from my closet, which was still on version .01, and rooted it.
After rooting it, I scp'd over all my config/scripts, but noticed that half of my lights and switches didn't work. I needed to update - my previous hub had been on 0.86, but that image was no longer available. I could only find the latest - 2.49 at the time. I didn't want to update to this version:

  • I wasn't confident in the ability to update to that version without losing ssh access
  • It removed tools I rely on, such as php, which I use for my openhab updating setup.

So I thought I would try to just pull off of the latest update what I could, and manually copy them over.

The Image

The image is hosted on Amazon S3, and as of time of this writing was version 2.49.

It's in a format called UBIFS, which I was unfamiliar with. UBI images seem to be designed more for flashing than mounting, and there was no easy way to dig files out of it. I found a promising tool called ubi_reader, so I decided to try it.

Docker up

I don't have any linux VM's set up anymore in VirtualBox/Fusion, so I just used Docker for Mac to grab me a linux:

  • I used the base ubuntu image for simplicity.
  • I used docker run with my desktop (where I'd downloaded the image to) mounted inside to get linux'ing quickly:
docker run -it \
  -v /Users/jaiken/Desktop:/desktop \
  --name ubuntu2 \

Inside the docker

Once inside the docker, I followed setup instructions from the ubi_reader project's readme, but added missing dependencies like python.

# Install dependencies:
apt-get update
apt-get install git liblzo2-dev python python-lzo python-setuptools

# Build ubi_reader
cd /desktop
git clone https://github.com/jrspruitt/ubi_reader
cd ubi_reader
python setup.py install

# Extract!
ubireader_extract_files -v -o /desktop/wink249 /desktop/app-rootfs.ubi

There were a bunch of warning messages flooded to the console, but most of the image extracted successfully.

Grab the goods!

Looking through the extracted files, I found the database updates I needed:

cd ~/Desktop/wink249/292528381/rootfs/
scp database_default/apron-default.db winkhub:/database
scp database_default/apron.db winkhub:/database
scp database_default/lutron-db-default.sqlite winkhub:/database
scp database_default/lutron-db.sqlite winkhub:/database

After copying them over, I was able to get my devices all paired successfully, and get all my lights/switches openhab'ed up again.


I'm a Ruby/Rails developer currently working for UserTesting, living in Southern Utah.
More about the author →