Firefox add-on installation into Porteus Kiosk

porteus-kiosk-logo

At work we have a couple of info kiosks (we call them terminals) that we bought from some company many years ago, but the support has ended also many years ago, so they abandoned them. The kiosks were running some custom software that the company had thrown together, it didn’t seem very professional from an IT guy’s perspective, because those kiosks were lagging and eventually would hang and would need a manual restart. We were living with this for some years until eventually both kiosks just hanged and didn’t properly boot for no reason.

After this we decided to look for a solution and whadya know – there is one free and simple solution with plenty of customization options for our needs. It fits our situation perfectly and it’s called “Porteus Kiosk

“Porteus Kiosk” is a kiosk edition of Porteus, a portable Linux OS based on Slack and it seems to be popular enough to have a Wiki article for it…

Our kiosks have a “Elo TouchSystems 2515” monitor (meaning there’s no mouse or keyboard) and a “ZOTAC ZBOX ID13” mini-pc which has very low specs like an old Intel Atom CPU and 2GB of RAM.

I quickly downloaded the latest ISO (4.7.0 at the time of writing) and installed it to a flash drive, booted it up on the kiosk to test out and right away noticed some issues that I’d need to fix. The issues were that the system didn’t have a virtual keyboard, like it wasn’t primarily targeted for touch info kiosks (but PK supports most touch devices out-of-the-box) and also in my case, Elo touch screen doesn’t support multi-touch (for scrolling for ex.) and so you’d need to drag the scrollbar, but Firefox scrollbar for that Linux version is very thin and were out of touch bounds, therefore most pages couldn’t be scrolled down the traditional way. I had to find solutions to these.

First I started digging around to see if there are some solutions posted on the forums or elsewhere and I came across three threads that had various methods to solve the same problem.
The threads I found were these:
https://forum.porteus.org/viewtopic.php?t=6192
https://forum.porteus.org/viewtopic.php?f=127&t=1741
https://forum.porteus.org/viewtopic.php?t=7827

There are solutions scatted around, but the first URL had me started on the right path. It’s a good writeup, but lacks some details that are essential and I spent like 3 days trying various things to make these work… it’s like posting a recipe without telling ingredient proportions :P and so the purpose of this blog post is to make life easier for other people and future me when I need to do this again for some reason.

So I had two problems with a stock “Porteus Kiosk” – it has no virtual keyboard, and touching a scrollbar is impossibru. Solutions to both problems were the essentially the same, since everything is done in a browser (Firefox or Chrome chosen upon installation and I chose Firefox).

Solution to lack of virtual keyboard is to install a Firefox add-on “FxKeyboard“, but I chose to install v3.0.0 (which I also uploaded here in case it goes missing). This plugin isn’t compatible with the latest and greatest of Firefox, only up to 57 I think, but “Porteus Kiosk 4.7.0” has a Firefox version of 52.8.1, so we’re good.
I chose that version because it has a nicer look and most importantly it can be resized, among other things.

And a solution to being unable to scroll websites is to install a Firefox add-on “ScrollAnywhere” which is a v6.0 at the moment (and I also uploaded it here in case something breaks in new versions).

The whole process of installing Firefox add-ons to PK isn’t as straightforward but it isn’t very complicated either and essentially it’s just this:

  • Download and extract the ISO
  • unsquash 003-settings.xzm file
  • Copy the add-ons and configs to mozilla profile
  • Set correct permissions
  • squash it back
  • Build and prep an ISO
  • Install to USB drive and enjoy

For the whole modification process I used “Ubuntu 14.04.5” in a VirtualBox but any somewhat newer version will be ok. Add-on “ScrollAnywhere” only supports Firefox 52 and above – and that’s the version PK 4.7.0 has, but my version of Ubuntu doesn’t, so I downloaded version 52.8.1 from Mozilla FTP archive.

So let’s start!

  1. Boot up Ubuntu in VirtualBox, go to your Home folder, create a new folder named “kiosk”.
  2. Download a PK ISO and place it in that folder, then extract the ISO, rename the folder to “iso”.
  3. Open the terminal and do cd ~/kiosk/iso/xzm in a terminal, then unsquash 003-settings.xzm and this will extract the file into a new folder named “squashfs-root”.
  4. Open up Firefox from where it was downloaded and install the add-ons, close it.
  5. Navigate to ~/.mozilla/firefox/[insert profile folder here], copy folders “extensions”, “browser-extension-data” and files “addons.json”, “extensions.ini”, “extensions.json” to ~/kiosk/iso/xzm/squashfs-root/home/guest/.mozilla/firefox/c3pp43bg.default
    Copied files contain information about the add-ons, but some lines in them contain the wrong paths.
  6. Open those three files in gedit, replace /home/ubuntu/ to /home/guest/ and [insert profile folder here] to c3pp43bg.default
  7. Additionally, I wanted to tweak FxKeyboard a little, like increase the font size and make it narrower, so I added these lines to “prefs.js”:
    user_pref("extensions.fxkeyboard.button_font", "font: 15px sans-serif");
    user_pref("extensions.fxkeyboard.locale_picker", "en lt");
    user_pref("extensions.fxkeyboard.main_max_width", "800px");
  8. ScrollAnywhere once installed shows a button to access its settings, I had to hide it. It can easily be done modifying a “chrome/userChrome.css” file, but I needed to figure out what to write in it to hide the button.
    Following this article I found the correct ID to use and so I added this line to “chrome/userChrome.css”:

    #juraj_masiar_gmail_com_scrollanywhere-browser-action { display: none !important; }
  9. Do sudo chown -R 1000:1000 ~/kiosk/iso/xzm/squashfs-root/home/guest to set the correct permissions for PK, otherwise Firefox won’t run.
  10. Next do sudo mksquashfs squashfs-root 003-settings.xzm -comp xz -b 256K -noappend and sudo rm -rf squashfs-root.
  11. Now to build PK back into an ISO, do cd .. and ./make_iso.sh – you will most likely get an error running first time, just follow the provided instructions.
  12. At this point you can test the generated ISO in VirtualBox to see if everything works ok and if so, do cd .. and isohybrid -type 0x83 -offset 1 -h 255 -s 63 Porteus-Kiosk.iso
  13. Now the ISO can be installed to a USB drive and then installed onto your kiosk

3 comments

  1. Martin says:

    Huge thanks for this write-up. Found the same posts that you did and did not find them very helpful in getting this working.

    Curious if you ran into an issue I’m having, when installing fxkeyboard, Firefox tells me the extension is corrupt and can’t install. Same with your backed up version.

    Possibly to do with how I am running firefox, which is direct from the extracted folder from the archive site, maybe screwing with the locally installed version. Any tips on how you actually ran the old Firefox version?

    Thanks again!

  2. Kulverstukas says:

    Hello,

    That’s how you should be running Firefox, if I remember correct, and it’ll create a profile folder in your home dir.
    It might be that you’re somehow copying the add-on wrong.
    Also try to remove the installed Firefox and delete any left profiles before running Firefox from the archive.

    Also what system do you use?

  3. Martin says:

    Thanks for your reply, got there now. It appears that the downloaded firefox was updating itself, causing much confusion. Also figured a setting had to be changed in “about:config” to allow the two add-ons to be installed without certificates. Also ended up running firefox from “/usr/lib”, which seemed to help

    Dump of my notes below, hope useful to a future viewer! Sorry for the numbering, Google Docs does not export to txt nicely

    Thanks again for your guide, huge help getting this working!

    1. Setup Ubuntu in VM
    2. Downloaded Firefox to match Porteus version – https://ftp.mozilla.org/pub/firefox/releases/52.9.0esr/linux-x86_64/en-GB/ (use “wget https://ftp.mozilla.org/pub/firefox/releases/52.9.0esr/linux-x86_64/en-GB/firefox-52.9.0esr.tar.bz2” if needed)
    3. Extract
    4. “apt-get remove firefox” to remove installed version
    5. Remove “.mozilla” profile from Home folder
    6. Copy the extracted “firefox” folder to “/usr/lib/”
    7. Disable your network connection
    8. Run the extracted firefox from “/usr/lib/firefox” by running “./firefox” (running from here ensures paths are correct in various config files, otherwise defaults to “Downloads” path
    9. Disable auto updates from Firefox Settings
    10. Enable network again
    11. Go to “about:config”
    12. Find “xpinstall.signatures.required” and change to false
    13. Install add-ons:
    1. http://9v.lt/blog/materiolas/scrollanywhere-6.0-an+fx.xpi
    2. http://9v.lt/blog/materiolas/fxkeyboard-3.0.0.alpha6.xpi
    1. Edit Fxkeyboard preferences:
    1. Change “Available locales” to just “en”
    1. Download Porteus Kiosk 4.8 (has Firefox 52.9)
    2. Extract ISO in “kiosk” folder in home folder
    3. “cd /home/ubuntu/kiosk/iso/xzm”
    4. Run “unsquashfs 003-settings.xzm” (note the “fs” bit, different to guide)
    5. Navigate to “~/.mozilla/firefox/[insert profile folder here]”
    6. Copy folders:
    1. “extensions”
    2. “browser-extension-data”
    1. …….and files
    1. “addons.json”
    2. “extensions.ini”
    3. “extensions.json”
    1. Paste in “ ~/kiosk/iso/xzm/squashfs-root/home/guest/.mozilla/firefox/c3pp43bg.default”
    2. Edit the pasted “extensions.ini” to change the “extensiondirs” path to match that from the Porteus install “/home/guest/.mozilla/firefox/c3pp43bg.default”.
    3. Edit scrollanywhere preferences:
    1. Gedit “~/kiosk/iso/squashfs-root/root/guest/.mozilla/c3pp43bg.default/chrome/userChrome.css” and add following line at the bottom
    2. #juraj_masiar_gmail_com_scrollanywhere-browser-action { display: none !important; }
    3. This will disable the options button in Firefox
    1. sudo chown -R 1000:1000 ~/kiosk/iso/xzm/squashfs-root/home/guest
    2. sudo mksquashfs ~/kiosk/iso/xzm/squashfs-root ~/kiosk/iso/xzm/003-settings.xzm -comp xz -b 256K -noappend
    3. sudo rm -rf ~/kiosk/iso/xzm/squashfs-root.
    4. Download http://porteus-kiosk.org/public/files/mkisofs
    5. Make executable “chmod +x”
    6. “cp mkisofs /usr/local/bin”
    7. “cd ~/Downloads/kiosk/iso”
    8. “./make_iso.sh”

Leave a Reply

Your email address will not be published. Required fields are marked *