Justin Latimer

OpenELEC SSH Issues

Have you found you can't connect to your Raspberry Pi running OpenELEC even though SSH is enabled? This happened to me, so I thought I'd write down what happened in case anyone else does the same thing. It actually took me quite a while to work out.

Around the time of the first release of Kodi, I was running OpenELEC 4.2.1 on my Raspberry Pi. I use USB drive for storage to speed things up because I have an average SD card. Unfortunately I forgot to turn of auto updates for add ons, and some of them auto updated to Kodi versions and broke. Rollback didn't work. So when OpenELEC 5.0 was released, I thought I'd do a fresh install. I formatted my SD and USB and imaged them. But even though I could successfully go through the OpenELEC installer, I couldn't connect over SSH!

Turns out when I formatted the USB, I accidently formatted it FAT32 instead of ext4. This meant that the SSH process couldn't create the key files because FAT32 doesn't support the right permissions model. It took me a while to figure this out, especially without being able to SSH in... Luckily OpenELEC makes log files accessible via Samba if you enable that. Once I formatted the USB drive ext4, everything worked perfectly!

Tags:

EC2 Dynamic DNS with dnsimple and Powershell

I've been wanting to do some native development on Windows, and it's actually been quite a while since I've had a Windows machine in my house. So, to the cloud! AWS lets you rent machines by the hour, with a service called EC2.

The new T2 instance types seem to be just what is needed for this project - they've got a cool system while when the box is idling, they build up CPU credits, which can then be used when CPU bursts are needed. Because most of the time the machine will be idling while I'm typing and thinking, it will build up credits and compiling will burn through them.

I don't want to leave the machine running when I'm not using it, and I don't want to pay the extra for an Elastic IP - I'm trying to keep this as low cost as possible. This means that the public IP changes every time the machine starts, which is a minor inconvenience, I wanted to assign a subdomain to this machine to make RDPing easier. I host my DNS with dnsimple and they have an API. So I whipped up a Powershell script which runs on boot that uses the dnsimple API to update the DNS for the machine.

$ip = Invoke-RestMethod -Method Get -Uri "http://icanhazip.com/"
$body = @{ record = @{ content = $ip } } | ConvertTo-Json -Compress
Invoke-RestMethod -Method Put `
    -ContentType "application/json" `
    -Headers @{
        "X-DNSimple-Domain-Token" = "YOU_TOKEN_HERE";
     } `
    -Uri "https://api.dnsimple.com/v1/domains/YOUR_DOMAIN_HERE/records/YOU_RECORD_ID_HERE" `
    -Body $body

I've got it running from an Windows Scheduled Task that runs on startup. You've got to make sure the task runs as "Network Service" and set it to run before a user logs on. I also configured it to try 3 times if it fails, just in case the network takes a bit to come up. Works really well! Here are some pictures of the Scheduled Task configuration for reference.

DNS Scheduled Task Security Settings

DNS Scheduled Task Trigger Settings

DNS Scheduled Task Actions Settings

DNS Scheduled Task Settings

Tags:

Cloud9 Workspace Disk Quota

I've been working on a new project on the bus, using the new Cloud9 IDE. It's in C++ using boost. I'm experimenting with using GYP to build boost and using a git submodule to include a specific version of boost from the boost github superproject.

So far this approach is working well, but there is one problem: the history of the boost superproject is quite large. I was getting pretty close to the disk space limit of my Cloud9 workspace (1.5GB quota, 32MB remaining), and was getting a little red warning banner at the top of the screen every time I loaded it. But yesterday when I loaded my workspace, I got a migrating screen. When it finished, I didn't get a warning.

Sure enough, when I checked quota -s the results were as below:

Size  Used Avail  Use%
4.7G  1.4G  3.2G   30%

I checked and I couldn't find any announcements about increased disk space, so I'm not sure what the deal is, but I'm certainly not complaining! Thanks Cloud9!

Tags: