How to implement Plex Media Server on older NAS

By 2014-11-19 November 28th, 2014 Buffalo + Plex

This is a quick introduction on how I implemented Plex Media Server v0.9.11 on the Buffalo Linkstation Pro Duo. It is not meant to be a full description with step-by-step instructions but a summary of to-dos for developers.

The problem

Starting with PMS v0.9.10.3 all versions require GLIBC 2.9 or above. The Buffalo Linkstation uses GLIBC 2.5 hence when you try to run Plex on the NAS, it will fail. The real issue is that you can’t just upgrade GLIBC as it is a core component of the linux system and all other applications use it. If you rip it out and replace it with a different version you might end up killing random applications on your NAS or even the kernel which also relies on GLIBC. Although GLIBC versions are supposed to be backward compatible it’s much harder to test each and every feature of the NAS against the new glibc than somehow telling Plex to run against new versions. Adding insult to injury Plex Media Server is hard wired to look at the /lib folder for glibc first, which is the standard folder for system component libraries too. In any other case you would be able to redirect your application to look for glibc in a different folder, so multiple versions of glibc could coexist. This is not the case with Plex.

Some background

GLIBC stands for the GNU libc implementation of the C libraries which is maintained by the Free Software Foundation. The library is supposed to be compatible with the POSIX standard but different implementations do things differently. For example the uClibC implementation is a much smaller implementation than the GNU glibc version which is a plus for embedded systems. The EGLIBC project was another implementation based on the GLIBC project targetting embedded systems. It strived to stay source and binary compatible with GLIBC and eventually the GNU community merged the whole project into GLIBC.

Details of implementation

For the purpose of integrating Plex onto the Linkstation, I used a version of the EGLIBC library from the Debian repository. (Version 2.13) This way I didn’t have to compile my own version. After downloading the packages (there were a few dependencies) I added some of the local binaries (like bash and the dev folder structure) to create a jailroot environment. I unpacked the latest Plex server in there and ran it using chroot.

The necessary Debian libraries:
ftp://ftp.debian.org/debian/pool/main/g/gcc-4.7/gcc-4.7-base_4.7.2-5_armel.deb
ftp://ftp.debian.org/debian/pool/main/g/gcc-4.7/libgcc1_4.7.2-5_armel.deb
ftp://ftp.debian.org/debian/pool/main/e/eglibc/libc-bin_2.13-38+deb7u6_armel.deb
ftp://ftp.debian.org/debian/pool/main/e/eglibc/libc6_2.13-38+deb7u6_armel.deb
You can unpack them using ar and then unpack the file data.tar.gz from within.

The necessary additional files:

  • /bin/bash
  • /bin/sh
  • /usr/bin/rsync
  • /etc/localtime
  • /etc/resolv.conf

The necessary additional file systems:

  • /dev
  • /proc
  • /mnt/array1 or /mnt/disk1 or /mnt/disk2 depending on how you set up your NAS

You can mount them with –bind or for some of them using -t. You need /usr/bin/rsync because Plex uses that to copy the plugins from the binary directory to the config directory (called “Library”). If you miss it, you won’t get the web interface for example. Also you need /bin/sh because Plex uses it to call rsync. Plex was also complaining when it couldn’t open /etc/localtime and you wouldn’t get anything off the Internet if you don’t set /etc/resolv.conf. /bin/bash might be optional at this point but I felt more comfortable having it.

When all this is set up, you can use chroot to run Plex from the prepared environment. Plex will only see the folders you set up so you don’t expose all your operating system files to the web interface. Don’t forget to set your HOME environment variable where you want your Plex database to reside.

5 Comments

  • jezzaaaa says:

    Hi, great work with your firmware. I tried to do this on my Buffalo Duo (LS-WTGL) but couldn’t get it to chroot. When I tried to run “chroot /path/to/plexroot /bin/bash” it says “FATAL: kernel too old”. I’m guessing that glibc library is too new for my kernel. If I copy stock libraries into palce, it works. I’m using the stock firmware but with Optware added. I didn’t want to install your complete firmware for fear of losing some of my local customisations. Any ideas? Might there be an older glibc that is still supported by the Plex binary?

    • garyt says:

      Did you copy the plexroot folder from my firmware? Try copying your /bin/bash to your plexroot and see if that can use the newer glibc.

      • jezzaaaa says:

        No, I didn’t use your firmware, just your instructions above.

        I tried copying /bin/bash into plexroot/bin/ but still get the same error.

        Just for fun, I grabbed the “bash-static” deb package from the same source as the libraries. That won’t run either, with the same “kernel too old” message.

        Hmm, I think there’s something fundamentally wrong with me doing this on my Duo Pro. If I run “file” on the different libc files I get different EABI strings and different “for GNU/Linux” versions:

        $ file /opt/local/plexroot/lib/arm-linux-gnueabi/libc-2.13.so
        /opt/local/plexroot/lib/arm-linux-gnueabi/libc-2.13.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=e4414173f09223bbb2c985bc01ff9ea0f9ceeba9, for GNU/Linux 2.6.26, stripped
        $ file /lib/libc-2.3.6.so
        /lib/libc-2.3.6.so: ELF 32-bit LSB shared object, ARM, EABI4 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.4.17, not stripped

        I’m guessing my kernel is older than yours. But as far as I can tell, I’m running the latest stock firmware.

  • jezzaaaa says:

    Ah, I think I know what’s going on. I didn’t know there were two Pro Duos. Mine is LS-WTGL/R1 and it would seem yours is a much newer LS-WVL, complete with 2.6 kernel. Is there any hope for my stock firmware, or should I bite the bullet and just upgrade to a hacked firmware with a new kernel?

    • garyt says:

      I don’t know much about the firmware of the old Pro Duo, but if you want to use it with Plex, I recommend against it. Even on newer 600MHz processors the Plex user interface times out for some people and the LS-WTGL/R1 has a 400MHz processor. In comparison, the newer Pro Duo has a 1600MHz processor.
      If you want to use it for other Linux-related projects, check if someone hacked it for optware and use that instead.