понедельник, 23 июня 2014 г.

Installing Google Chromium on ARM devices with Flash plugin - solution

What's the problem?

Here is the solution how to install Google Chromium (open source version web browser Chrome) in Linux without building it from source. The problem is that in many Linux distributions like Debian, Kali Linux the Chromium package is only available for amd and i386 architectures. There is no ARM (ARMHF and ARMEL) versions. I couldn't build it from source using native Debain source repositories because it doesn't have instructions for building under ARM. Using Google approach was also a failure.

How to install Chromium? Step by step manual.

The suggested method is quick and easy way to install Chromium from .deb packages in any Debian-like system and on any ARM device (Raspberry PI, Odroid, Cubieboard, etc.). The .deb package can be downloaded from Marko's repositories, but they are too old. I suggest using Ubunty repositories instead. The Chromium browser itself can be downloaded from here as a *.deb package. In my system I also required to download chromium-codecs-ffmpeg-extra package because Chromium requires it.

The installation process is as follow:
  1. Download chromium *.deb package from the link above (it was version 34 at the time this manual was written).
  2. Download chromium-codecs-ffmpeg-extra package from the link above.
  3. Install the packages by command (you may need to change the file names of the packages accroding to those you have downloaded in step 1 and 2): dpkg -i chromium-codecs-ffmpeg-extra_34.0.1847.116-0ubuntu~ chromium-browser_34.0.1847.116-0ubuntu~
The installation is complete. 

Problem - unmet dependencies

In my case I had unmet dependencies because of my Kali Linux 1.0.7 (is a fork of Debain Wheezy) had an old version of libc6 library. The newer version was available only at jessie (testing) branch. To install it I had to add the following lines to /etc/apt/sources.list:

deb http://ftp.us.debian.org/debian testing main contrib non-free
deb-src http://ftp.us.debian.org/debian testing main contrib non-free
deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

Debian usually has preferences file that correctly handles testing & stable version of packages, so the above lines won't move our Linux completely to testing branch. My version of Kali Linux didn't have such preferences set, so I had to setup them manually. I created a file in /etc/apt/preferences.d/main.pref with the following content:
Package: *
Pin: release n=kali
Pin-Priority: 350

Package: *
Pin: release n=kali-bleeding-edge
Pin-Priority: 300

Package: *
Pin: release n=jessie
Pin-Priority: 10

The first 2 blocks describe internal packages of Kali Linux that have a higher priority than Debian Jessie package. Note: if you're using Debian Wheezy, you should have one block with n=wheezy instead of the 2 above. After the changes are saved, you should run command 
apt-get update

Then you should explicitly install the new libc6 package by running the following command:
apt-get install libc6 -t testing

After that all dependencies should be met and you can try to install the Chromium browser again.

Installing Flash Player

The usual flashplugin-nonfree for Linux is not available for ARM devices. The solution is to use PepperFlash plugin. It's not available for the public from the Google team, but thanks to Lee Harris we can download it from his site. It's a link for the plugin for ARMv7 ripped from original Google OS from Chromebook. If you don't trust the link above you may try to rip it out yourself. After you download the archive you should extract the Pepperflash dir to /usr/lib. After that you need to do the following changes to the Chromium config file /etc/chromium-browser/default. You should modify it, so it has a line:
CHROMIUM_FLAGS="--ppapi-flash-path=/usr/lib/PepperFlash/libpepflashplayer.so --ppapi-flash-version="

Running Chromium with root rights

The Chromium browser doesn't launch as a root. You can change that behavior by editing it's config file /etc/chromium-browser/default. You should modify it, so it has a line:
CHROMIUM_FLAGS="-password-store=detect -user-data-dir"
If you need flash support, the line should look like this:
CHROMIUM_FLAGS="--ppapi-flash-path=/usr/lib/PepperFlash/libpepflashplayer.so --ppapi-flash-version= -password-store=detect -user-data-dir"

The results

The Chromium works great with Flash, tested on ODROID-XU (armhf) with Kali Linux 1.0.7. The screenshot:

As you can see the Google sign-in feature is working, so all the bookmarks, history, passwords are being synced. Also all the plugins (add-ons) are working.