Raspberry Pi Install Firefox



Sudo apt-get install firefox-esr open Firefox and skip 'import Data from Chromium', close Firefox copy /examples/firefoxExample.py to /Projects/InstaPy and edit file to your liking. The first of the lightweight browsers that we are going to talk about is Lynx.

This is a guide for setting up a RAM based RPI3 which is able to run X, and firefox. This tutorial will go through setting up auto login for Alpine, and starting X on boot without user interaction. It is a type of kiosk machine.

Tested as of 05/2020 - RPI

12/2020 - x86

  • 2Steps
  • 3Tips/Troubleshooting

Overview

This guide uses the following:

  • aarch64 img
  • RPI3
  • community repo is used.

It is based off of this guide: Raspberry_Pi. Due to the dependencies required to run X and FF, there is very little RAM disk space for the user to operate in, after this tutorial is complete (about 30MB is v3.11). Take this into consideration. It's possible that the RPI4 with its additional RAM, may fare better.

Firefox

aarch64 is used, because firefox-esr is in the community repo. armhf (as of v3.11) does not have firefox prepackaged in the base or community repo.

See https://pkgs.alpinelinux.org/packages?name=*firefox*&branch=v3.11&arch=aarch64

Note that the aarch64 build is not compatible with all RPI. See Raspberry Pi.

Steps

Base Install

These steps are duplicated from Raspberry_Pi page.

Use fdisk or gdisk to format the SD card. You must have the first partitionbe a bootable, FAT filesystem. e.g.:

untar onto mounted disk

If you plan to enable increased RAM (e.g. for RPI4 with 2 or 4GB) or otherconfig settings, do so in a usercfg.txt now.

Again, duplicating the Raspberry Pi page


saving space: busybox instead of chronyd, dropbear instead of openssh

After setup, make sure dropbear is installed

Start it:

Add it to the default runlevel:

If you need an accurate clock, enable software/ntp here (optional, i don't need a clock for the website I view).

Browser Client Install

Enable community repo (/etc/apk/repositories) (uncomment community)

install firefox and X dependencies:

Note that the fonts/icon theme are required for FF to display correctly. Without these, firefox will load, but text will not render on the browser menus.

the RAM tmp fs remaining can be viewed while installing, with watch df -h

install firefox

install X

The RPI also requires for X:

note: this command can vary if you are using x86. For example, I installed no xf86-video... drivers, and had a libEGL.so missing library error on Xorg, and that was resolved via 'apk search libEGL.so' which pointed to mesa-egl. Note that apk search is case sensitive.

At this point, we have about 421MB used up (if NTP was not setup).

AutoLogin, Startx automatically on Boot

At this point, you should be able to login as root, and run startx manually. Now, we will add a number of configuration files that allow this to happen without user interaction.

/root/ doesn't save any files, so it's necessary to edit files in /etc/ and lbu_commit -d after all changes. First let's add a file that will call firefox.lbu_commit is alpine local backup. If you want to save folders other than /etc see:https://wiki.alpinelinux.org/wiki/Alpine_local_backup#Include_special_files.2Ffolders_to_the_apkovlalso see: /etc/apk/protected_paths.d/lbu.list

create a file named /etc/startup.sh:

We have to edit xinitrc, and the profile configs. Normally, this would be done in the user's directory, but here we will use the globals for simplicity.

In this file put:

At the end of /etc/profile (leave the existing file) append

And remember to: lbu_commit -d For autologin, alpine uses busybox, which has an alias to /sbin/getty as well as /bin/login. It's possible to navigate to /sbin/ or /bin/ and run /sbin/getty -h to see what settings are available. To have root auto login upon boot, review the existing inittab and edit as needed, according to the config below.

Disable Screensaver, and refresh webpage (optional)

As a kiosk, the RPI will need to have the screensaver (DPMS) disabled. Also, my particular application (video streams) required a refresh occasionally. These were managed with xorg.conf, xdotool, and crontab respectively.

Contents of /etc/X11/xorg.conf

Raspberry Pi Install Firefox
Section 'Extensions' Option 'DPMS' 'Disable'EndSection

# apk add xdotool

Note that xset is not an option here, as it's not included by default. It can be installed from repositories, if needed.That's it. Now reboot, and watch the RPI boot into firefox without user intervention. At this point, you have a functioning minimal OS booting from RAM, with firefox, and ~30MB of available space for further configuration.

Tips/Troubleshooting

Why was this setup used? Why not Awesome, or dwm?

I ran through a few different setups of alpine on the rpi, and found that (dwm | awesome) & firefox required too many dependencies to run on an RPI3 with 512MB in /tmp (running in RAM), or other browsers which used less dependencies were unstable (the application was viewing video streams). Therefore, running firefox direct off X was just barely able to fit into the available space, and was stable. This is one of the reasons aarch64 was used, instead of armhf. RPI4 w/more ram may not have this issue.

If your application doesn't require media (i.e. a static webpage) you may be able to run other browsers, such as midori, falkon, or surf, without stability issues on the RPI.

It is possible that VLC would also fit into the limited space on the RPI. This was not tested.

Width & height of firefox doesn't fit the monitor

Firefox can be called with -height and -width flags, e.g.

Periodic Firefox Crashes on RPI3 due to Low Memory

With the RPI3, I found firefox crashing reliably after a couple days uptime of watching video. On the server I saw notices of memory running out. This may have been a memory leak, and with the small amount of RAM available, it would crash firefox, leaving the screen blank.

The solution was to setup a nightly reboot of the system via cron, and this has kept the system stable since. However, if I was to do this again, I would try an RPI4 with >1GB ram which may obviate the need for a nightly reboot.

Raspberry Pi Install Firefox

x86 Stability with 20+ mjpeg streams

I've tested the above in order to watch mjpeg streams from Zoneminder. I ran into a limit of perhaps 15-20 streams at once (low fps) thereafter streams will cut out, and reappear, in a type of artistic fashion, where upon there are always a couple of streams blacking out, and a few coming back. This is on amd64 hardware. With low numbers of streams (I run 6 on the RPI3, and perhaps 15 on the x86, this is not an issue. This error does not appear on e.g. x86 Debian with dwm + firefox. todo: test alpine w/dwm.

Related Links

Raspberry Pi Install Firefox Latest

Retrieved from 'http://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_3_-_Browser_Client&oldid=18351'