Featured Post

HOWTO: MySQL install guide for NAS4Free 10.2.x

Oct 6, 2014

Modifying your Asus Nexus 7 (2013 2nd Generation)

The beauty of the Nexus 7 over the iPad, in my opinion, is that it plays content without discrimination - I can install Kodi (XBMC) on it without a problem, along with several other functions that Apple wish to lock down - and this is without modifying it. Other than features and functionality, the price point for entry into a tablet world is great!!  The Nexus 7 is a steal,

With the upcoming release of the Nexus 9, we will no doubt see a marked reduction in the price of the 7.

 I decided it was probably as good a time as any to mess around with modifying my Nexus 7 - and I can tell you, I am nothing but pleased.

Here is a summary of what is involved.

  • Setup your computer to use fastboot
  • Unlock the Nexus 7
  • Install custom recovery software
  • Install Cyanogenmod
  • Install Google Play Store
My guide is based on Linux, Crunchbang to be specific, but you can do this on any OS.  As usual, I found my information on the internet.  Check here for another guide and reference to Windows use, although beyond fastboot setup there is nothing different.

Setup your computer to use fastboot

The first thing to do here is install Android SDK on your computer, it in turn gives you fastboot and adb on your system.

Update:  Here is a link for installing ADB and Fastboot on any system,:
http://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378

Following directions from this site, for Android SDK (http://developer.android.com/sdk/installing/index.html?pkg=studio)
  • Unpack the downloaded Tar file, android-studio-bundle-.tgz, into an appropriate location for your applications.
  • To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh (./studio.sh).
  • You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.
Regarding the last point, I had to add the environment information, as it wouldn't run without it.
  1. Install JDK -- sudo apt-get install openjdk-7-jdk
  2. Environment Variable -- sudo nano /etc/environment adding the following line:
  3. JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386
  4. Reboot, and Android Studio starts up.

Unlock the Nexus 7

NOTE Unlocking the bootloader on a Nexus device will automatically wipe all device data.
  1. Power off your Nexus 7
  2. Press and hold the Volume Down and the Power button to power on the Nexus 7.
  3. Connect the device to the computer through USB.
  4. Verify your PC sees the device by typing:
    sudo fastboot devices
  5. If you don't see your device serial number, and instead see "", fastboot is not configured properly on your machine. See fastboot documentation for more info.
  6. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
A disclaimer will display on the device that must be accepted. Use the volume keys to cycle through the options. Pressing the power button should confirm your selection.  If the device doesn't automatically reboot, reboot it from the menu. It should now be unlocked. You can confirm this is the case if you see an unlocked icon at the bottom of the Google boot screen during reboots.

At this point, download the Cyanogenmod, or whichever customer ROM you would like - to your download folder on your Nexus 7.

Install custom recovery software

Now you can install a variety of different custom recovery software, I installed TeamWin, not the latest but here you can find the latest, http://teamw.in/project/twrp2/193

  1. Download the recovery software of your choosing to your PC.
  2. Power off your Nexus 7
  3. Press and hold the Volume Down and the Power button to power on the Nexus 7.
  4. Connect the Nexus 7 to the computer via USB.
  5. Verify your PC sees the device by typing:
    sudo fastboot devices
  6. If you don't see your device serial number, and instead see "", fastboot is not configured properly on your machine.
  7. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    (Where the latter part is the filename of the recovery image)
  8. Navigate using the volume keys and select RECOVERY using the Power key.
Leave your Nexus 7 in Recovery.


Install Cyanogenmod

While in Recovery do the following:
  1. Wipe Data
  2. Select Install
    • Install new ROM from ZIP (browse to your downloaded ROM of choice)
  3. Reboot.
Once the system has rebooted, give it some time to check for updates, once all updates to the ROM are finished, make note of the version you are running and proceed to the following location and download the appropriate Google Play Store APK to your download folder.


Install Google Play Store

Now to install Google Play Store to get back all your application goodness.
  1. Power off your Nexus 7
  2. Press and hold the Volume Down and the Power button to power on the Nexus 7.
  3. Navigate using the volume keys and select RECOVERY using the Power key.
  4. Select Install
    • Install new Google Play Store from ZIP
  5. Reboot.
Now you should be running an unlocked custom ROM on your Nexus 7.

Aug 11, 2014

Home Automation Early Adopter Woes

I got sucked into the internet of things some time ago, Philips Hue bulbs is what sparked my interest. This then turned into checking out IFTTT, which led to Belkin WeMo's being purchased. I obviously use a media center, so I purchased the Harmony Ultimate - and gained some hue control.

All these devices and no real common communication between them. Don't get me wrong IFTTT is nice, but it also doesn't play with everything. Step in SmartThings hub which can speak to ZigBee and Z-Wave, as well as the Hue hub - things get a little better.

Having had this setup for months, consisting of the following:

I can safely say I'm happy and I have a few automated activities setup, but I guess the worst thing is the range right now. 

My router is in my basement and it appears that the network is getting busy - I wonder how much g/n, Z-Wave, ZigBee traffic I can handle on my air-waves??? I think I am hitting a limit.

I am currently seeing issues with range in my WeMo's. If my WeMo insight on my first floor is on, my 2nd floor bedroom devices aren't detected - if I switch the first floor insight off and give it a minute, I see the previous problematic devices in the app again - I don't believe this to be Belkin related, just network congestion/interference.

Belkin decided to use standard Wi-Fi rather than ZigBee or Z-wave, and they "cheaped" out using G over N.  I have considered moving to Zigbee, because while they have a shorter range than Z-Wave, my Hue bulbs use ZigBee - and just list Z-wave, Zigbee creates a besh network for extending overall range.

It does seem that Z-wave is far more popular than Zigbee.

I have also considered if making changes at the router, I am wondering if purchasing an AC wireless router would improve anything???  I know I will be still using G, but will my transmission power be better?

In summary, I'm an early adopter and I am happy with what I have gained. While some of the devices were expensive, I invest to make the future brighter for everyone. Hopefully we learn going forward.  Interested in what Google's purchase of Nest will have on Google's future in home automation. 

Does anyone have any tips or experiences about their own automation solutions?

Aug 1, 2014

Kodi, the re-branding that XBMC deserves!

I've used XBMC on several systems in the past 10 years:


As well as several custom built home theater systems.

Finally after 10 years XBMC is shedding it's ties to the original Xbox and renaming itself Kodi - and I embrace this change fully.

While XBMC brings back old memories of hacking away at an Xbox to get more out of it, it no longer needs the association for exposure. Kodi is a strong application in its own right, with a multitude of 3rd party support - and several 3rd parties basing their own branch of software on the core, such as the Boxee Box by D-Link and the highly successful Plex appliaction which even runs on the Amazon Fire TV.

Read more about this on the official site, which I am sure will be renamed also...

XBMC Is Getting a New Name – Introducing Kodi 14/

Congratulations and good luck to the team!

Jul 22, 2014

XBMC and Emulation

So I finally went back to trying to get emulators setup in XBMC (OpenELEC specifically).  It took me a while to get everything setup, but in the end everything is working perfectly.  This all stems from the fact that I got my kid into SNES games to distract him on a long-haul flight.

Now there are several post out there with pieces of information, but solbero posted a great and complete guide on the openelec forum:

http://openelec.tv/forum/128-addons/71535-guides-retroarch-friends

This venture into emulators is not a big leap from XBMC's future, rumours have been around for a while regarding XBMC implementing emulators directly into the XBMC build.  There is even a branch of OpenELEC which contains these modification - I am slightly tempted to try this,  Retroplayer + XBMC:

http://forum.xbmc.org/showthread.php?tid=173361

When it comes to emulation they key component for realism is the joypad, in my humble opinion.  Amazon sells a USB compatible SNES replica controller, and it seems to get some ok feedback:



I myself have gone down the route of Logitech Rumblepasd 2 (Wireless), simply because it has more buttons for arcade based games - and I'm a fan of Logitech products.




The main complaint I hear about the Logitech Rumblepad 2 is the analog sticks are in a square boundary - so you can't recreate free flowing circles with the sticks.  Beware the price of these things, Amazon was selling for $99.  I picked up a couple on eBay for $55 shipped - I know have 3 and will no doubt sell one to recoup.

My implementation uses ROM Collection Browser to fire up the initial games, but after that I use the back-end emulator (RetroArch) to switch games.  I configured my left analog stick to save/load states using up/down, and I configured my right analog button to bring up the retorarch menu, left analog button is configured to exit the emulator and go back to XBMC.

If anyone tries out Retorplayer + XBMC, let me know your thoughts please.

I do have a spare Pi lying around, so I am also considering RetorPie http://blog.petrockblock.com/retropie/retropie-downloads/

For XBMC here is the version of RetroArch I used:
http://sourceforge.net/projects/zaggxbmcaddons/files/?source=navbar

Containing the following list of cores/emulators:
http://sourceforge.net/p/zaggxbmcaddons/wiki/Core%20List/

Jul 2, 2014

Using DYNU as Custom Dynamic DNS on DD-WRT Router

This is a guide to setup a custom dynamic DNS on dd-wrt, specifically I have my dd-wrt router connected to my externally facing modem - it doesn't have a direct WAN connection (this is important). The configuration details should however work in most cases, it will be a simple process of changing "Do not use external ip check"

I am personally using the Netgeart 3500L, which I paid $180 for a few years ago, but you can get at a steal now - NETGEAR WNR3500L RangeMax Wireless-N300 Gigabit Router with USB - Manufacturer Refurbished

I decided to create this guide due to recent issues with no-ip.org.  Other than the fact that they were served with a take-down notice from Microsoft, I was getting tired of logging in every 30 days.  I came across the following site:

http://www.gnutomorrow.com/best-free-dynamic-dns-services-in-2013/

And decided to go with dynu.com.  The configuration is as follows, and I got most of the information from the following page with their api:

http://www.dynu.com/default.aspx?page=dnsapi

You should replace the following fields in the screenshot:

youusername with your the username found under Main Menu >> Dynamic DNS Service Details >> General Settings in your dynu.com account settings - I do not believe that your email will work.
yourpassword with yourpassword to log in to your account
yourserver with your configured dynu hostname



Note that the "Do not use external ip check" is set to no, so that the router determines it's external IP and sends it - since it isn't connected directly, and therefore has no WAN address.

Apr 28, 2014

OpenELEC on the Asus Chromebox

First off I want to say, this was the best use of $179 in a while..just buy it:

ASUS CHROMEBOX-M004U Desktop

This box blows away my old Zotac ION - and it's fanless.  It kills on performance compared to the Raspberry Pi and Zotac ION, and it's small and portable, it's fanless, it boots very quick! I love it.

Disclaimer: All the information in this guide is completely taken from the following link:

http://wiki.xbmc.org/index.php?title=ASUS_Chromebox

But I have formatted it in the appropriate manner for myself to reference in future.

Follow this guide if you want to replace Chrome OS with OpenELEC and have it boot in automatically, I do not do the backup like the wiki, I create a backup USB after the fact on a Windows box, but you can do it from any OS it appears.  I have tested this backup and it works, so this is my preferred and quicker method.

+Matt DeVillier has updated the wiki to provide an all-in-one setup script for installing OpenELEC as default, or dual boot. You must still complete steps 1.1 and 1.2. 

1 Device Preparation

1.1 Put in Developer Mode

Putting the ChromeBox in developer mode will allow you to access the underlying Linux operating system features necessary for installing XBMC.

WARNING: This will erase all user data on the device.

With the device powered off:

  • Insert a paperclip into the hole left of the SD card slot and press the recovery button
  • Power on the device, then remove the paper clip.
  • When greeted with the recovery screen, press CTRL-D to enter developer mode.
  • Press the recovery button (with paperclip) to confirm.
  • The device will reboot and wipe any existing user data.

1.2 Disable Firmware Write Protect

Disabling the firmware write protect will allow us to set the firmware boot flags to shorten the developer boot screen timeout (from 30s to ~1s), and optionally boot directly to the legacy BIOS (and into Ubuntu or OpenELEC). This is not absolutely necessary, but highly convenient and carries little to no risk.
With the device powered off and unplugged:

  • Remove (4) rubber feet from bottom of unit
  • Remove (4) screws under rubber feet
  • Separate two halves of unit
  • Remove write-protect screw circled below:
  • Reassemble in reverse order

1.3 Update the Legacy BIOS

It is necessary to update the legacy BIOS to enable booting from USB/SD media, or if replacing ChromeOS with Ubuntu/OpenELEC, as the stock legacy BIOS is completely broken. If you dual booting and using either the ChrUbuntu or ChrOpenELEC scripts to install, then this step is included as part of those scripts and does not need to be done manually.

To update the legacy BIOS:

  • Power on and boot to ChromeOS
  • Hit CTRL-ALT-F2 to open a shell
  • Login with user chronos (no password required)
  • Download the updated legacy BIOS with the command:
    curl -L http://gdurl.com/EVKN/download -o seabios.bin
  • Flash the new bios with the command:
    sudo flashrom -w -i RW_LEGACY:seabios.bin


This updated legacy BIOS has a ~1.5s wait on the 'Press ECS to show boot menu' screen.

1.4 Set Developer Boot Flags

Setting the following boot flags will allow you to boot either to a backup copy of ChromeOS on USB/SD (using CTRL-U) or to the legacy BIOS (using CTRL-L) and into Ubuntu or OpenELEC.
Important: These boot flags must be set before installing either Ubuntu or OpenELEC.
To set the boot flags, perform the following steps:

  • Power off your ChromeBox, then power on but do not login.
  • Press CTRL-ALT-F2 to open a shell.
  • Login as user chronos, no password is needed.
  • Run the commands:
  • sudo crossystem dev_boot_usb=1
  • sudo crossystem dev_boot_legacy=1
  • Do not reset, proceed to section 1.5 - original wiki doesn't force you to do this, so if you want to change the commands later you appear to have to reinstall Chrome OS and do everything again.


1.5 Set Firmware Boot Flags

With the firmware write-protect disabled, we can shorten the default developer-mode boot wait time (from 30s to ~1s) and set the ChromeBox to default to booting the legacy BIOS (and into Ubuntu or OpenELEC) instead of requiring CTRL-D or CTRL-L to be pressed each time.


  • Power on and boot to ChromeOS
  • Hit CTRL-ALT-F2 to get to command prompt
  • Login with user chronos (no password required)

  • To shorten the boot wait time only, run the command:
    sudo set_gbb_flags.sh 0x1
    (This is the same as immediately pressing CTRL-D

  • To shorten the boot wait time and set the default boot to the legacy BIOS:
    sudo set_gbb_flags.sh 0x489
    (This is the same as immediately pressing CTRL-L)

  • To reset these options to default, use:
    sudo set_gbb_flags.sh 0x0



1.6 Create a Recovery Media for ChromeOS (on USB/SD)

Follow this guide:
https://support.google.com/chromebook/answer/1080595?hl=en

I corrupted my backup from the wiki, so this was my only option - but it is tested and works.

2 Installing OpenELEC


In order to install OpenELEC, you'll need to download a custom build tailored to the ChromeBox. This build differs from the regular OpenELEC Generic x86_64 build in that it uses a slightly older version of the syslinux bootloader (5.10, vs 6.02), as the version included with OpenELEC does not work properly on the ChromeBox at this time. This custom build also includes a fix for some MCE IR remotes, which fail to work when connected to USB 3.0 ports (fix has been submitted as a patch and hopefully will be included in future Linux and OpenELEC releases).

2.1 Installation steps:

Download the custom build of OpenELEC from http://gdurl.com/qnDc/download

Once downloaded, unzip/extract the files.

  • Insert a USB stick and run the create_installstick installer.
  • See the OpenELEC wiki instructions for more details on creating the USB installation media.
  • Power off your ChomeBox. Insert the USB/SD installation media.
  • Power on and press CTRL-L to boot to legacy BIOS
  • Press ESC to bring up the boot menu and select the number corresponding to your USB installation media
  • The OpenELEC installer will load
  • Choose the 'Quick Install' menu option
  • Select the target disk for install (the internal HDD should be the only option presented)
  • Hit Yes/Ok to the prompts confirming that the target disk will be erased/overwritten
  • When the installer has finished, remove the installation media and select Reboot.


If you have set the firmware boot flags as above, OpenELEC should boot right up in about 15 seconds. Otherwise, you will need to hit CTRL-L to boot the legacy BIOS.

That's it, you can update to the latest official OpenELEC build. Afterwards, updates should be automatic.

Update:  Please check the following location for a list of known issues an their available workarounds:
http://wiki.xbmc.org/index.php?title=ASUS_Chromebox#Known_issues_.2B_Fixes.2FWorkarounds

Mar 7, 2014

OpenVPN on NAS4Free

If you are using a more recent version of NAS4Free than 9.2, check out the following guide:
http://www.geekfreely.com/2015/12/howto-openvpn-installation-guide-for.html

Otherwise, continue...

In this post I intend to describe the steps required for securing your NAS4Free server so that all external communication with it is conducted via VPN.  To achieve this we are going to setup OpenVPN on the NAS4Free server and configure it to use a VPN service, which there are many to choose from.


While this site contains information regarding bittorrents, please note I do not necessarily agree with the opinions of any external site I link to, and I do not condone, or conduct illegal downloading.

Important Notes:

  • This was conducted on a FULL NAS4Free installation, not embedded.
  • Change /mnt/Data to your own storage location
  • Change 192.168.0.* to your NAS4Free IP address
  • Some of the directories may already exists from previous HOWTOs
cd /mnt/Data
mkdir Extensions
cd Extensions
mkdir var
mkdir usr
mkdir tmp

INSTALLING OPENVPN

Set the temporary directory for the packages, as well as the site to fetch packages from (if you are installing onto a 32 bit system change “amd64″ to “i386″):

setenv PKG_TMPDIR /mnt/Data/Extensions/tmp/
setenv PACKAGESITE "http://ftp6.us.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-9.0-release/Latest/"

Install OpenVPN:
pkg_add -rv openvpn

Move openvpn file so it does not get executed every time when system is being started, otherwise your boot process will get stopped and you will be asked for a username/password.  NAS4Free executes all the files inside "rc.d" folder on startup.

mv /usr/local/etc/rc.d/openvpn /usr/local/etc/openvpn/

Install Certificates and .ovpn files.
mkdir /usr/local/etc/openvpn

Download your certificates *.crt as well as *.ovpn , rename them to *.crt->openvpn.crt and *.ovpn->openvpn.conf copy them using WinSCP to /usr/local/etc/openvpn/

Once copied edit the openvpn.conf and you should see something like that:

client
dev tun
proto udp
remote 11.170.97.173 443 # - Your server IP and OpenVPN Port
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca openvpn.crt
auth-user-pass
comp-lzo
verb 3

Add the following line to openvpn.conf, so passwords aren't stored in memory:
auth-nocache  Don't use auth-nocache, as renegotiation after timeout will fail.

Just make sure after "ca" there is openvpn.crt, also check the 2nd line if you have got dev tun or dev tap

Test OpenVPN connection:
/usr/local/etc/openvpn/openvpn onestart /usr/local/etc/openvpn/openvpn.conf

Download the following torrent to make sure your legal torrents are downloaded privately:
http://torguard.net/checkmytorrentipaddress.php

Edit rc.conf to enable OpenVPN.  Open up your NAS' web interface and head to System > Advanced > rc.conf and add the following variables:P

openvpn_enable with a value of YES
openvpn_if with a value of tun or tap depending on the contents of openvpn.conf

Now we need to make it autostart, so back to SSH:
pkg_add -r expect

nano /usr/local/etc/openvpn/autosignon

In the file just insert:
#!/usr/local/bin/expect -f
set force_conservative 0
spawn /usr/local/etc/openvpn/openvpn start /usr/local/etc/openvpn/openvpn.conf
match_max 100000
expect -exact "Enter Auth Username:"
send -- "YOUR USERNAME!\r"
expect -exact "Enter Auth Password:"
send -- "YOUR PASSWORD!\r"
expect eof

Save your changes and make that script executable by running the following command:

chmod +x autosignon

AUTOSTART OPENVPN
In NAS4Free webGUI, navigate to: “System|Advanced|Command scripts” and insert the following start-up command (PreInit):

/usr/local/etc/openvpn/autosignon

CONFIGURE FIREWALL
So this is a bit hit or miss for me, I almost feel like I am having to restart my NAS4Free box before I see the changes from the firewall applied. My VPN provider doesn't have a list anymore for which IPs they assign, so I just have to kinda guess. The purpose of the firewall is to provide detection if the event of the VPN service going down, and by protection we mean - no external connection.


If you wish to test your NAS4Free box IP directly from command line, install curl.

pkg_add -rv curl

Then enter the following:

curl ifconfig.me

But you can also check your torrent client directly too!
http://checkmytorrentip.net/torrentip/checkMyTorrentIp.png.torrent

9/15/2014 Update:  CHange torrent IP tracking address.

Mar 5, 2014

Setting up CouchPotato and Sickbeard on NAS4Free

The two applications I am going to place on my NAS4Free box are Couchpotato and Sickbeard.

Please note, this is for informational purposes only and I do not condone, or conduct illegal downloading.  I actually retrieved most of the information from the following site:

http://forums.nas4free.org/viewtopic.php?f=55&t=3929&p=20364&hilit=sickbeard#p20364

...but some of the steps were slightly different because I already had MySQL installed, for example.

Important Notes:
  • This was conducted on a FULL NAS4Free installation, not embedded.
  • Change /mnt/Data to your own storage location
  • Change 192.168.0.* to your NAS4Free IP address

SETTING UP FOR SICKBEARD INSTALLATION

Let's make the appropriate directory structure first:

cd /mnt/Data
mkdir Extensions
cd Extensions
mkdir var
mkdir usr
mkdir tmp

Additionally, do the following to map the var and usr directories to the /mnt/Data partition, so as not to use up space on the OS partition (specifically with logs, and cached images):

mount_unionfs -o w /mnt/Data/Extensions/var/ /var/
mount_unionfs -o w /mnt/Data/Extensions/usr/ /usr/

Also add both these lines as Command Scripts under the advanced settings, as PostInit .
Set the temporary directory for the packages, as well as the site to fetch packages from (if you are installing onto a 32 bit system change “amd64″ to “i386″):

setenv PKG_TMPDIR /mnt/Data/Extensions/tmp/
setenv PACKAGESITE "http://ftp6.us.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-9.0-release/Latest/"

Installed the required packages for the applications to run:

pkg_add -rv python27
pkg_add -rv unzip
pkg_add -rv py27-yenc
pkg_add -rv py27-cheetah
pkg_add -rv py27-openssl
pkg_add -rv py27-feedparser
pkg_add -rv py27-utils
pkg_add -rv unrar
pkg_add -rv par2cmdline

Now install Sickbeard:

fetch "http://github.com/midgetspy/Sick-Beard/tarball/master"
tar -xzf master
rm master
mv midgetspy-Sick-Beard-fb37d33 Sickbeard
mv Sickbeard /mnt/Data/Extensions/
chmod -R 777 /mnt/Data/Extensions/Sickbeard

Test Sickbeard :
/usr/local/bin/python2.7 /mnt/Data/Extensions/Sickbeard/SickBeard.py --quiet &

Now to configure Sickbeard to startup with your NAS4Free box

CONFIGURING SICKBEARD TO STARTUP ON BOOT

cd /mnt/Data/Extensions/Sickbeard
nano sd.sh

Paste the following code into the editor that appears, replacing your IP address on the first line, your Sick beard username on the second line, and your Sick Beard password on the third line (you can create a username and password for Sick Beard from its web interface):

#!/bin/sh
fetch "http://192.168.0.4:8081/home/shutdown/ «_EOF
yoursickbeardUSERNAMEhere
yoursickbeardPASSWORDhere
_EOF

Save your changes and make that script executable by running the following command:

chmod +x sd.sh

Lastly, head back into NAS4Free's web interface, and go to System > Advanced > Command Scripts. Click the plus sign and add this as a "PostIinit" command:

/usr/local/bin/python2.7 /mnt/Data/Extensions/Sickbeard/SickBeard.py --quiet &

Add the following command as a "Shutdown" command as well:

/mnt/Data/Extensions/Sickbeard/sd.sh

Remember, as you set up Sick Beard, to use absolute file paths in all the settings e.g.

/mnt/Data/Downloads/Complete

SETTING UP FOR COUCHPOTATO INSTALLATION

cd /mnt/Data/Extensions/tmp
fetch "https://github.com/RuudBurger/CouchPotatoServer/tarball/master"
tar -xzf master
rm master
mv RuudBurger* CouchPotato
mv /mnt/Data/Extensions/tmp/CouchPotato /mnt/Data/Extensions/CouchPotato

Test CouchPotato
/usr/local/bin/python2.7 /mnt/Data/Extensions/CouchPotato/CouchPotato.py --quiet &


CONFIGURING COUCHPOTATO TO STARTUP ON BOOT

Head back into NAS4Free's web interface, and go to System > Advanced > Command Scripts. Click the plus sign and add this as a "PostIinit" command:

/usr/local/bin/python2.7 /mnt/Data/Extensions/CouchPotato/CouchPotato.py --quiet &

Remember, as you set up CouchPotato, to use absolute file paths in all the settings e.g.

/mnt/Data/Downloads/Complete


Feb 8, 2014

Installing a centralized MySQL DB on NAS4Free for XBMC library sharing

I have updated these guides for NAS4Free version 10.2.x, check them out here:
http://www.geekfreely.com/2015/12/howto-mysql-install-guide-for-nas4free.html
http://www.geekfreely.com/2015/12/howto-configuring-kodi-to-use-nas4free.html

So I have just set this up, and I have not tested it thoroughly yet, but I wanted to get it down on paper so I don't forget.  As with some of my other posts this is the merging of other peoples work and findings.

NOTE THIS IS FOR A FULL INSTALL OF NAS4FREE

For MySQL setup on NAS4Free I followed this guide:
https://sites.google.com/site/aganimkarmiel/home/free-time/freenas-extensions

And for XBMC setup I followed this guide:
http://wiki.xbmc.org/index.php?title=HOW-TO:Share_libraries_using_MySQL/Setting_up_XBMC

Here is all that information put into a single guide:

Installing and Setting Up MySQL

Create a directory to store MySQL data files, in my case I create a sub-directory in /mnt/data/db/mysql to store database files.

# mkdir -p /mnt/data/db/mysql

where /data - is Mount point name.  Provide full rights to this location:

# chmod 777 /mnt/data/db/mysql

By default the MySQL server on NAS4Free stores database files in /var/db/mysql which does not exist at this point, so let's make a symbolic link in that directory:

# ln -s /mnt/data/db/mysql /var/db/mysql

Create the group and user 'mysql' using the NAS4Free WebGUI, it is important because NAS4Free will forget about the users created on command line after reboot.

Group
Name: mysql
ID: 88

User
Name: mysql
Fullname: mysql
UserID: 88
Primary Group: mysql
NO PASSWORD

Now install MySQL 5.5:

# pkg_add -r mysql55-server
# rehash

Execute the following command to create default databases and tables, and upgrade:

# cd /usr/local/bin
# mysql_install_db
# mysql_upgrade

Give all permissions to the user and group mysql for /mnt/data/db

# chown -R mysql:mysql /mnt/data/db/mysql/

Execute 

# mysqld_safe &
Now, this created  .err and .pid into /mnt/data/db/mysql folder.  Check errors written into .err

Add mysql_enable=”Yes” into /etc/rc.conf.  GUI is preferable to make this change (select System | Advanced | rc.conf), but the following command works just as well:

# echo 'mysql_enable="YES"' >> /etc/rc.conf

I found that after a NAS4Free upgrade the command line option no longer existed.  I recommend doing it via GUI.

Reboot your box and type the following command to make sure MySQL is running:

# top

If it is not running, type the following command to start MySQL:

# /usr/local/etc/rc.d/mysql-server start

Secure MySQL using the following wizard:

# mysql_secure_installation

Log into MySQL:

# mysql -u root -p

You are now in mysql administration, conduct the following commands in MySQL to allow XBMC access.

# CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
# GRANT ALL ON *.* TO 'xbmc';
# quit;

Configuring XBMC to use NAS4Free MySQL DB

Export your music and your video directories, you can to this as separate or single file, I tried to do separate which is the suggested, but I have no idea where the files where put - so I just started afresh.  If you want to try and retain your current "master" DBs, follow the steps here:


Otherwise you can just continue on with this guide.

Create (or add to, if you already have one) an advancedsettings.xml file in your XBMC userdata folder.
Using nano copy and paste the following information into the advancedsettings.xml file, if there is already content, merge the sections appropriately:

advancedsettings.xml configuration found in the following location:
http://wiki.xbmc.org/index.php?title=HOW-TO:Share_libraries_using_MySQL/Setting_up_XBMC

and should look like this:
<advancedsettings>
    <videodatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </videodatabase>

    <musicdatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </musicdatabase>

     <videolibrary>
          <importwatchedstate>true</importwatchedstate>
     </videolibrary>
</advancedsettings>

Replace the two instances of ***.***.***.*** with local network IP address of your NAS4Free server. It is recommended not to use its NetBIOS name, as not all devices may be able to resolve them.

Save the file as advancedsettings.xml.  Copy this advancedsettings.xml file you just created to the userdata folder of every XBMC install you want to sync with.

If you exported your existing DBs, go ahead and import them.  If you created a fresh DB, scan all your content again, make sure to use the NAS4Free server IP rather than NetBIOS for your shares, as mentioned - not all devices may resolve the NetBIOS.

One of the first changes you’ll want to make, on your XBMC systems, is to alter what XBMC does in response to you pressing play on a file. By default XBMC simply plays the file from the beginning. Since we now have an XBMC system that remembers our place across multiple machines, we want XBMC to prompt us.

Navigate to Settings | File Lists and set the Default select action to Choose. We want XBMC to ask us what to do when we’re opening a file instead of automatically playing it from the start.

As a final note, specifically with Openelec and Raspberry Pi, although Openelec suggest this for WiFi boxes, set Wait for network before starting XBMC under Openelec addon settings, network.
That is it...you should be good to go.  Let me know how it goes for you, or if you have any issues.

Updates from lindsay added: http://forums.nas4free.org/viewtopic.php?f=71&t=6026&p=33121#p33119

Additional updates from lindsay:

Optimizing the DB using a cron, I used the following command to test before making the cron:
# mysqlcheck -os -u xbmc -pxbmc --all-databases