Tuesday, May 27, 2014

The joys of Netflix on Linux and how to set it up

Many people use Windows to watch Netflix. They may take it for granted that it just works, yet enjoy it just the same. Part of the reason for this success is that Microsoft and Netflix entered into a partnership to provide the security demanded by the content creators and the convenience demanded by the consumers they serve. Unfortunately, that partnership did not consider the casual Linux user.

On Friday, going into a nice 3-day weekend for the Memorial Day holiday, I had the misfortune to find that Netflix stopped working on my Linux machine at home. I did hours of research again on how to install it properly, how to test it, only to find that no matter what I did, I could not get it to work.

On Linux, we use a very nice utility called Pipelight, a play on the name of Silverlight, the Microsoft product that Netflix uses to stream video to its customers. Silverlight requires Windows to run, which means that it requires a Windows application programming interface to work. To run Silverlight on Linux, we use another application called Wine - a compatibility layer that allows a Linux machine to run Windows programs. All of that runs within a browser like Chrome or Firefox.

As you can see, there are layers of software needed to get Netflix to work properly on Linux. Wine provides the interface, or compatibility layer. Piplelight is the software used to play videos from Netflix and your browser of choice is at the top of the stack, providing you with the means to connect to the Netflix website to watch the movies on Netflix.

I had avoided using this stack of software for quite some time out of security concerns. But after doing some digging, I learned that most if not all of the Windows viruses go after bugs and flaws in the Windows kernel, the software that manages the hardware. Since the Windows kernel does not exist on a Linux machine, there is nothing beyond the Wine application layer for a virus to grab hold of. Further compounding the problems for Windows virus is that the version of Wine that I use is customized just for running Netflix. All that is not needed in Wine to run Netflix is removed. All that remains is tuned to make Netflix run well, and believe me, it runs very well.

So after discovering that Netflix stopped working on my machine, I did some research and tried re-installing the components to get it working again. Eventually, I decided to try a clean install. I removed all of the components required to run Netflix and then started from scratch. Along the way, I was able to compile a list of commands used to install Pipleight and all its dependencies:

sudo add-apt-repository ppa:pipelight/stable
sudo apt-get update
sudo apt-get install --install-recommends pipelight-multi
sudo pipelight-plugin --update
sudo pipelight-plugin --enable silverlight


The first command adds a repository, a place where Linux can find the software. One thing I like about Linux is the use of repositories like this one. That means I'm not going to to some website to download the software I want. Instead, Linux uses repositories to keep software up to date. The repositories make it easier to gather software from trusted sources.

The next command updates the list of available software with the new repository directive in place. The following command with apt-get install, will install Pipelight and all of its dependencies.

The last two commands update the Pipelight plugin that is used in the browser and enable the plugin. After the last command, you will be prompted to accept a license agreement in order to use Sliverlight, the Microsoft product used to display Netflix.

You can test the Silverlight plugin here and you can verify that the Silverlight plugin is enabled:

sudo pipelight-plugin --list-enabled

There is one more thing to do. Netflix will check to see if you are running Windows, so you will need to install an add-on for your browser. The add-on will fool the Netflix servers into thinking you're running Windows. For Chrome there is UserAgent Switcher and UserAgent Spoofer. For Firefox, there is UserAgent Overrider. All of them work well for their respective browsers.

I did all of this and still it would not work. While researching the problem, I found that Google had released a new version of Chrome. That new version of Chrome breaks Piplelight. So I tried Firefox and that worked. Problem solved. I was able to get on with Star Trek: Into Darkness. I must say, JJ Abrams did a great job with this one and I highly recommend it to the Star Trek fans out there.

I hope you find this information helpful.

No comments: