I have a hobby/home project. I’m developing an NodeJS app and I would like to get it running on a Raspberry Pi 2 with 7" touch display. The application UI is running in a browser (Chromium) in kiosk mode. So my main problem is now that the official Raspbian image is a Debian Wheezy OS and only support Chromium v22. This version is from 2012 and is very old and slow. At the time of writing the latest Chromium is v45 and is available for instance in the Ubuntu MATE OS.
Some days ago I found an excellent blog from the Hypriot’s guys. They offer a SD card image for Raspberry Pi’s that is based on the Debian distribution and optimised for running Docker. Lately they switched from Wheezy to Jessie (latest version kernel is v4.1.6). Their image is very small (1.4GB) — which is good — but there is no pre-installed X which I will need to run my application. So after downloading and flashing it, I started to install a lightweight X-Server and the latest Chromium browser.
At first, I recommend to update the package list
sudo apt-get update
1. Install X server and LightDM
I’m using “ — no-install-recommends” because I don’t want to install unnecessary applications. That is because I will be running only the Chromium browser and NodeJS (maybe in a container).
sudo apt-get install --no-install-recommends xserver-xorg xinit xserver-xorg-video-fbdev lxde lxde-common lightdm
2. Set autologin
If you would like to login automatically with “pi” user, you need to open /etc/lightdm/lightdm.conf file and uncomment the autologin-user line and change to this:
3. Compile fbturbo driver
In the official Raspbian distribution there is an fbturbo driver for X. The fbturbo video driver offers much better graphics peformance as it is optimised for ARM and the Raspberry Pi. Unfortunately the Jessie repository doesn’t contain the xserver-xorg-video-fbturbo package so we need to build it from source. I used the following Github repository to get the sources: https://github.com/ssvb/xf86-video-fbturbo. In the wiki of the repository there is an installation guide, but for your convenience I will summarize the necessary steps here:
- Install requirement packages to compile and build
sudo apt-get install git build-essential xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake libdrm-dev
2. Clone repository
git clone https://github.com/ssvb/xf86-video-fbturbo.git
3. Compile, make and install
sudo make install
After it, you have 2 files in your /usr/lib/xorg/modules/drivers folder (fbturbo_drv.la and fbturbo_drv.so).
4. You need to create a 99-fbturbo.conf file in /usr/share/X11/xorg.conf.d/ folder with this content:
Section “Device” Identifier “Allwinner A10/A13 FBDEV” Driver “fbturbo” Option “fbdev” “/dev/fb0”
Option “SwapbuffersWait” “true”
5. Then restart your Pi and check your monitor or LCD screen.
You will see this:
4. Install Chromium browser
Like with the fbturbo package the Jessie repository doesn’t contain the latest version of Chromium browser. So again we need to build it ourselves.
In this page, you will find the latest Chromium builds to Ubuntu (for ARM architecture too).
Now we download the neccessary deb files and try to install them:
wget https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage/+build/7916060/+files/chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.debwget https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage/+build/7916060/+files/chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.debsudo dpkg -i chromium-codecs-ffmpeg-extra_45.0.2454.85–0ubuntu0.15.04.1.1181_armhf.deb chromium-browser_45.0.2454.85–0ubuntu0.15.04.1.1181_armhf.deb
Note that in the last line the first package needs to be the ffmpeg-extra package and after that the Chromium browser package .The order of the packages here is really important!
After exectuing the command we will get an error that some package is old or missing. We can solve this problem if we execute this command:
sudo apt-get install -f
Afterwards we will try to install chromium again:
sudo dpkg -i chromium-codecs-ffmpeg-extra_45.0.2454.85–0ubuntu0.15.04.1.1181_armhf.deb chromium-browser_45.0.2454.85–0ubuntu0.15.04.1.1181_armhf.deb
And Chromium will be installed succesfully.
5. Install raspi-config
I had a problem with the screen, because there was overscan around the edge and also the screen resolution was not corrent. To address this I installed raspi-config. It allows me to edit the famous config.txt in the /boot folder to set the correct resolution and get rid of the overscan problem.
I found a script which downloads and installs raspi-config from a deb package: https://github.com/snubbegbg/install_raspi-config
Executing the command from the script install raspi-config:
wget http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20150131-5_all.debsudo dpkg -i raspi-config_20150131-5_all.deb
Now run “raspi_config” or create a config.txt file in /boot/ folder and set your settings. This is my config.txt:
We are ready. Now we have a Debian Jessy OS on Raspberry Pi 2 with GUI, Docker and the latest Chromium. The OS size is only 1.5G. It’s great!
Free memory after X started: ~720MB (72%)
Free memory after Chromium started: ~550MB (55%)
If you have an official 7" Raspberry Touch LCD, you have to update the kernel to make it work.
After restart, the boot screen will appear on the 7" LCD. But the filesystem will be read-only and X cannot start. I don’t know, this is the best solution, but I can solve the problem with:
- Remount the root:
sudo mount -o remount,rw /
2. Change /etc/fstab file content to:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
Reboot and it will work again.
If you got GDBus….PolicyKit1 error message when X started, install some other packages too:
sudo apt-get install policykit-1 hal
My home portal app on Hypriot Jessy OS in Raspberry Pi 2 with official Pi Touch LCD Display:
Update #1 (2015.10.01)
You can use these scripts too to install X11 and Chromium: