Update Flash Plugin for Firefox on Linux

Why is Flash still a thing?

Posted by John Thomas 25-Sept-2016

First of all, I hate Flash as much as the next person. Why do tons of sites ask to activate my Flash plugin when they don't have any Flash video? I can only assume some nefarious reason... Anyway, Flash is still a thing, and the support for Firefox on Linux is not the best. If you are using Firefox on Linux, then you have most likely come accross the annoying error that Firefox has prevented the outdated plugin "Adobe Flash" from running on This is how I have automated upgrading my Flash version.

It is pretty clear what the problem is: The Flash plugin for Firefox is out of date. Several years ago Adobe announced that it would no longer develop the Flash plugin for Firefox on Linux. The exception to this, is that they are still providing security updates for Flash. So, a new security update rolls out, and you will see that same warning message. It is actually non-trivial to update the Flash plugin for Firefox. For different Firefox versions, and different Linux distros, the Firefox plugin file resides in different locations, so there is conflicting information out there on the googlesphere.

tl;dr You can skip to the automated script at the bottom

Want to check to see if your Flash version is up to date?

You will see something like this:

alt text

Steps to update the Flash plugin

  1. Download the *.tar.gz package from https://get.adobe.com/flashplayer/

  2. Extract the downloaded file Once downloaded, extract the files into any folder and look inside. You will see 3 important things:

    • libflashplayer.so

      • This is the actual Flash plugin that you need Firefox to load.
    • usr folder

      • This has some Flash property files, and images. You don't really need to wory about what is inside this folder, just that you have access to it.
    • readme.txt file

      • These are the instructions to install the Flash plugin. If you loo
  3. Identify the location(s) of the browser plugin directory The reason why I am writing this, is that there is one rather annoying step to the readme.txt which reads "Identify the location of the browser plugins directory, based on your Linux distribution and Firefox version"

    OK... where is that? Well the best way that I have found to do this, is to use the "find" command in linux

     $ sudo find / -name libflashplayer.so
    
     /home/user/Downloads/install_flash_player_11_linux.x86_64/libflashplayer.so
     /opt/mint-flashplugin-11/libflashplayer.so
     /var/lib/dpkg/alternatives/libflashplayer.so
     /var/lib/mozilla/plugins/libflashplayer.so
     /etc/alternatives/libflashplayer.so
     /usr/lib/mozilla/plugins/libflashplayer.so
    

    Now, one of the files in that output is the recently downloaded libflashplayer.so. For me this one is the one I just donwloaded:

    /home/user/Downloads/install_flash_player_11_linux.x86_64/libflashplayer.so

    I don't know why there are so many libflashplayer.so files, but some of them are actually symlinks to files and don't really need to be replaced. If you want to find out which ones are symlinks you can stat each one. The ones that show a size of around 100 bytes or less are symlinks. From my output, I found two old libflashplayer.so files:

    • /opt/mint-flashplugin-11/libflashplayer.so
    • /var/lib/mozilla/plugins/libflashplayer.so
  4. Replace the old libflashplayer.so with the new libflashplayer.so

    You can do this through the Linux GUI or through the terminal like this:

     $ sudo cp <path_to_downloaded_files>/libflashplayer.so /opt/mint-flashplugin-11/
     $ sudo cp <path_to_downloaded_files>/libflashplayer.so /var/lib/mozilla/plugins/libflashplayer.so
    
  5. Copy the Flash Player Local Settings configurations files to the /usr directory.

    Remember that 'usr' folder that we downloaded? We need to copy the contents of that folder into the computer's '/usr' folder. You can do so by running this command:

     $ sudo cp -r <path_to_downloaded_files>/usr/* /usr
    
  6. Restart Firefox, and validate that the new Flash Plugin in loaded.

    Go to https://www.mozilla.org/en-US/plugincheck/ and you should see that the Adobe Flash Player plugin is up to date!

Automatically update Flash

The above steps too annoying for you? Me too. Here is a script that automatically updates Flash for Firefox on Linux.

#!/usr/bin/env bash

# Static DL Link:
# https://get.adobe.com/flashplayer/download/?installer=FP_11.2_for_other_Linux_64-bit_(.tar.gz)_-_NPAPI&standalone=1
#
#Installing using the plugin tar.gz:
#  o Unpack the plugin tar.gz and copy the files to the appropriate location.
#  o Save the plugin tar.gz locally and note the location the file was saved to.
#  o Launch terminal and change directories to the location the file was saved to.
#  o Unpack the tar.gz file.  Once unpacked you will see the following:
#    + libflashplayer.so
#    + /usr
#  o Identify the location of the browser plugins directory, based on your Linux distribution and Firefox version
#  o Copy libflashplayer.so to the appropriate browser plugins directory.  At the prompt type:
#    + cp libflashlayer.so <BrowserPluginsLocation>
#  o Copy the Flash Player Local Settings configurations files to the /usr directory.  At the prompt type:
#    + sudo cp -r usr/* /usr

# Example download link
# https://fpdownload.adobe.com/get/flashplayer/pdc/11.2.202.632/install_flash_player_11_linux.x86_64.tar.gz

downloadFlash(){
  # Find sType from static URL
  sType=$(curl -v -L --silent 'https://get.adobe.com/flashplayer/' 2>&1 \
    | grep 'sType' \
    | sed $'s/^.*sType: "//' \
    | sed $'s/",//'
  )

  # Find Download Link from static URL
  dlink=$(curl -v -L --silent "https://get.adobe.com/flashplayer/download/?installer=FP_24.0_for_Linux_64-bit_(.tar.gz)_-_NPAPI&sType=$sType&standalone=1" 2>&1 \
    | grep "fpdownload.adobe.com" \
    | sed $'s/^.*location.href = \'//' \
    | sed $'s/\';".*//'
  )
  echo "Download Link found: $dlink"

  if [ -z "$dlink" ]; then
    echo 'No download link found! Aborting'
    exit 1
  fi

  # Download to /tmp
  curl -o /tmp/flash.tar.gz $dlink
}

extractFlashTar() {
  mkdir -p /tmp/flash
  tar -xzf /tmp/flash.tar.gz -C /tmp/flash
}


replaceSOFiles() {
  echo "Replacing old libflashplayer.so files with the newest one."
  sudo find / -name libflashplayer.so -type f -exec cp /tmp/flash/libflashplayer.so {} \;
}

copyUSRFolder() {
  echo "Copying flash usr files"
  # This is prolly dangerous...
  sudo cp -r /tmp/flash/usr/* /usr
}

removeFlashFiles() {
  echo "Removing tmp flash files."
  rm -rf /tmp/flash
  rm /tmp/flash.tar.gz
}


echo "Updating Flash..."

downloadFlash
extractFlashTar
replaceSOFiles
copyUSRFolder
removeFlashFiles

echo "Done."