Sunday, May 25, 2014

How to Install PyTivo on Synology NAS

PyTivo is a free program that allows you to serve to your Tivo videos, pics and music stored on your Synology. Here are instructions that attempt to be complete enough so that most anyone can get PyTivo working on their Synology NAS.

There are a number of web pages and forum entries talking about how to get PyTivo to run on a Synology NAS but they assume that you are already knowledgeable about Linux and this very process. I have attempted to provide a complete set of steps so that just about anyone can get PyTivo to work on their Synology.

The steps will cover the following:

  • Setup of a Command Line Interface (CLI) to send commands to the Synology NAS.
  • Installing ipkg using a bootstrap. This will make it easy to install other programs such as PyTivo.
  • Installing Git which makes it easier to download open source programs such as PyTivo.
  • Install Python which is needed to run PyTivo.
  • Download and install PyTivo.
  • Setup of PyTivo.

And now for the steps.

  1. Download PuTTY. This is the CLI program that enables SSH communications with the NAS.
  2. Log onto Synology NAS
  3. Enable SSH on the Synology NAS. This will allow you to externally execute commands on the NAS.
    1. Go to Control Panel and select the "Terminal & SNMP" page.
    2. Check the box for Enable SSH Service
    3. Click Apply.
  4. While in Control Panel lookup the CPU type. You will need this to get the correct ipkg bootstrap.
    1. Select the "Info Center" page.
    2. Look for and note the value after "CPU". For example, the CPU on the DS213j is "MARVELL Armada 370"
  5. Find the correct bootstrap. In most cases, you will download and install using commands typed into the PuTTY command window (see step 7).
  6. Execute PuTTY.exe
    1. The Configuration screen will appear. Enter the IP address for the Synology NAS, enter a name for the "Saved Session" and hit Save. You will reuse this session info in the future so you don’t have to reenter the IP address.
    2. Click on Open. You will get a command window asking, "login as".
    3. Login using the "root" account. The password is the same as admin.
  7. Using the PuTTY CLI, the following commands are to download and install the bootstrap for the Armada 370. Each bootstrap has its own instructions. Note the first command is too long to fit on one line in the window below but it is to be entered as one line.
    • /usr/syno/bin/wget --no-check-certificate -O
    • unzip
    • cd ds213j_bootstrap-master
    • sh
  8. Verify the install
    • source /etc/profile
    • ipkg info
      You will see something like:
      Package: wget
      Version: 1.12-2
      Conflicts: wget-ssl
      Status: install user installed
      Architecture: arm
      Installed-Time: 1400475847

      Successfully terminated.
  9. Make sure everything is up to date
    • ipkg update
    • ipkg upgrade
  10. If you haven’t already installed python using the Synology Package Center (the recommended method), you can install it from the PuTTY CLI. However, using the command below will not likely install the latest version.
    • ipkg install python
  11. Install git to make it easier to download pyTivo.
    • ipkg install git
  12. Verify the location of ffmpeg.
    • ls /usr/syno/bin/ffmpeg

    You will see the path repeated if the file exists at this location. If it doesn’t, you will need to install it.
  13. Install pyTivo
    • mkdir -p /usr/local/src/pytivo
    • cd /usr/local/src/pytivo
    • git clone git://
    • cd /usr/local
    • ln -s src/pytivo/wmcbrine pyTivo
    • cd pyTivo
    • cp pyTivo.conf.dist pyTivo.conf
  14. Edit pyTivo.conf and set the path to ffmpeg (from step 12).
    • vi pyTivo.conf

    vi is a text editor. Here are some useful commands (Hit ESC to enter a command):
    delete line
    insert line above cursor
    insert line below cursor
    save and quit
    :q! {Enter}
    quit without saving
    The line to be changed will say
    but it needs to say

    More commands available at
  15. Additional changes to the file include changing the name of the Share (which displays on your Tivo under "Now Playing"), changing the path for that share, and adding additional shares if needed.
    1. The default share is MyMovies and appears in the file as "[MyMovies]" (a section header).
    2. The correct path will be something like "path=/volume1/video".
  16. Find the location of python.
    Depending on how you installed python, it will likely be in one of the following two directories:
    • /usr/bin
    • /opt/bin
    Run the following two commands to see if it is in one of those directories. The response of each command will either be a repeat of the path indicating the file is there or "No such file or directory".
    • ls /usr/bin/python
    • ls /opt/bin/python

    You can get the version of python by running it (and then hit {Ctrl}+D to exit). For example:
    • /usr/bin/python
      You will see something like:
      Python 2.7.6 (default, Apr 8 2014, 23:36:51)
      [GCC 4.6.4] on linux2
      Type "help", "copyright", "credits" or "license" for more information.

  17. Create file "". If you’ve been following the instructions, you are already in the "/usr/local/src/pytivo/wmcbrine" directory and don’t need to specify it.
    • vi

    The contents will be as follows. Note that you will either be entering "/usr/bin/python" or "/opt/bin/python" on line 2.
sleep 60
/usr/bin/python /usr/local/pyTivo/ > /dev/null 2>&1 &

  1. Create file "".
    • vi

    The contents will be as follows (from Iluvatar on

start() {
   echo -n ""Starting pyTivo: ""
   ps | grep | grep python
   [ $RETVAL -eq 0 ] && echo ""pyTivo already running: Exiting"" && exit 1

   sh /usr/local/pyTivo/ > /dev/null 2>&1 &
   [ $RETVAL -eq 0 ] && echo -n ""done""
   return $RETVAL

stop() {
   echo -n ""Stopping pyTivo: ""
   kill -9 `ps |grep |grep python | awk -F" " '{print $1}'`
   [ $RETVAL -eq 0 ] && echo -n ""done""
   return $RETVAL

case ""$1"" in
    sleep 1
    echo ""Usage: $0 {start|stop|restart}""
    exit 1
exit $RETVAL

  1. Make the two .sh files executable.
    • chmod 755
    • chmod 755

  2. Create a link to so that it will get auto started when the NAS is booted. The file has to appear as if it is located under "/usr/syno/etc/rc.d/" and has "S99" at the beginning of its name.
  • ln -s /usr/local/pyTivo/ /usr/syno/etc/rc.d/

  1. Restart the NAS and, after a minute, pyTivo should have a web page at http://your_NAS:9032. You can make option changes here instead of reediting the pyTivo.conf file. You can also start pyTivo without a restart by running the following:
    • /usr/syno/etc/rc.d/ start

A lot of steps, but this should be enough to get you enabled. However, there is the question of whether this is even worthwhile given that Synology now has native support for Chromecast.

Read more »

Thursday, February 7, 2013

Windows Server – Force Your Network Connection to Where it Belongs

What to do when Windows marks your network connection as Public when it is on the private LAN or marks it Private when it is on the public Internet. Click "Read more!" for some answers.

Microsoft uses Network Location Awareness (NLA) to determine if a network connection is on a public LAN, private LAN, or domain network. Often, it gets it wrong. The issue with wrong placement is that the firewall rules that get used are based on the connection’s location.

There are circumstances where the location can be corrected from within the "Network and Sharing Center". Often such changes do not survive a reboot or other network changes. You cannot use this method to move a connection to a less secure location (e.g. move Public to Private as Private usually has more relaxed firewall rules).

Below are steps you can take to help NLA properly recognize the connections location. The instructions are based on Windows 2008 R2 but they will work on other versions with little modification.

"Unidentified" Network – Move From Public to Private or Domain

If NLA can't determine a connections location, it names it "Unidentified" and marks the location as Public. It chooses Public because that is most secure and you wouldn’t want anything less if the connection is on the DMZ.

There are two easy ways to fix this. One uses the Local Security Policy to change the default location of unidentified networks. The second method uses a change to the network connection properties to give NLA the information it needs to properly place the location.

Using Local Security Policy

This should only be used if the computer will never have any connections on the Public LAN. Otherwise, you run the risk of having a less secure firewall profile applied to your public connection.

  1. Open "Local Security Policy".

  2. Click on "Network List Manager Policies" in the left pane. (This selection is buried in older versions of Windows.)

  3. Double-click on "Unidentified Networks" in the right pane.

  4. For computers that only exist on the private network, it is OK to set "Location type" to "private".

Using Network Connection Properties

This is not about adding a gateway IP as that doesn’t work properly on a multi-homed server. Instead we will be adding a DNS suffix so that NLA can properly locate the domain controller which is how it knows to mark the location as “Domain network”.

  1. Go to Network Connections (from the Network and Sharing Center, click on "Change adapter settings".)

  2. Go to the properties of one network connection marked as "Unidentified" but on the private LAN.

  3. Go to the properties for IPv4.

  4. Click the "Advanced..." button.

  5. Select the DNS tab.

  6. Enter your domain name into the text box for "DNS suffix for this connection:".

  7. Disable and then enable the connection to get NLA to re-identify the location.

After enabling the connection, the Status should change to the domain name and Network Category to "Domain network". Depending on your setup, it is likely that you only need to "fix" one connection to get all the related connections to see the domain.

Move From Private to Public

Usually, just setting the gateway IP on one of the public connections is enough to get NLA to set the location properly. If that doesn’t work, there are more drastic steps available. However, this is usually an indication of an improper and possibly unsecure network setup as NLA is seeing something that shouldn’t be there. For example, your domain controller should never be accessible on the public LAN.

There are two common ways to force NLA to mark a connection as public. One is to use a firewall rule to block NLA so that it has no choice but to use the default location. The other is to use the registry to disable NLA on the connection.

Using the Firewall

I haven’t tested this but the theory seems sound.

  1. Open "Windows Firewall with Advanced Security".

  2. Go to Outbound rules.

  3. Click on "New Rule…".

  4. Use these settings:
    Rule Type:Custom
    Program:Select "All programs" and then click on "Customize…". Select "Network Location Awareness" (short name is NlaSvc).
    Protocol and Ports:Protocol type = Any.
    Scope:Local IPs = Enter all your public IPs. Double-check for connections with multiple IPs.

  5. Once rule is enabled, disable and then enable the network connection to get NLA to re-identify the location.

Using the Registry

I have not had this work for me but my circumstance may be different from yours. Finding the correct connection number is a bit hit or miss as there are a lot more entries than you would expect.

  1. Run regedit

  2. Go to HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}

  3. Underneath you should see several keys labeled 0000, 0001, 0002 etc… Look through these and find the adapters where you want to disable NLA.

  4. For each of the adapters, add a new DWORD value named "*NdisDeviceType" and set it to 1 (make sure you get the * at the beginning of the name).

Getting Drastic

The location profiles are housed in the registry and it seems harmless to delete them and let Windows rebuild them. You will definitely want to backup the registry first and you will likely need to be connected to the server via KVM rather than remote (RDP). I will not take any responsibility if you choose this step as I am primarily putting this here for reference.

The location of the profiles is:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles

Read more »

Thursday, September 23, 2010

FIX - Windows Media Player Crashes Immediately on Open

This is a fix for one of the causes of Media Player consistently crashing with the message, “Windows Media Player has stopped working."

Friday, July 9, 2010

SQLDMO for SQL Server 2005/2008
and Your Installation

This article is for those building an install for a VB6 program that uses SQLDMO to control Microsoft SQL Server. Connecting to SQL Server 2000 is easy but now you are having trouble dealing with SQL Server 2005 and 2008.

Here is the solution.

Wednesday, September 2, 2009

(or, The One that Got Away)

So, you're in your car waiting for the crossing guard to go up. But instead of seeing a train, you see some guy running down the tracks. That was me. Click "Read more!" to find out why.

Read more »

Thursday, August 27, 2009

Building a High-end Windows 2008 Database Server

This is a comprehensive article on building a database server with an eye on maximizing performance. This covers both the building of the hardware and the setup of the OS and SQL Server.

Read more »

Saturday, August 4, 2001

Hatsu hana (The first blossoms)

This is a simple haiku that I wrote to my then future wife on her birthday. She was in Japan visiting her parents while I was stuck at home in California.

Read more »


This is another poem that I wrote to my then future wife on her birthday. She was in Japan visiting her parents while I was stuck at home in California.

Read more »