Perl and Lyrion Media Server

After reading some topics about getting Lyrion Media Server (previously Logitecht Media Server) running on OpenWRT, I am trying it myself. My hardware is a BananaPi BPI-R4, so I have enough processing power, ram and storage available. My first attempt is to run it natively on OpenWRT. I have very little knowledge on docker or chroot environments.

So, here is what I did:

  • Got the latest ARM Linux tarball from https://lyrion.org/downloads/
  • Created a build with Perl installed (5.40 is the current version)
  • Extracted the tarball on my BPI-R4
  • Tried running “perl slimserver.pl”

The error I got was about missing Perl modules. After trying to install the applicable modules available with OpenWRT, there are still some modules missing:

The following modules failed to load: EV JSON::XS Digest::SHA1 YAML::XS Sub::Name

Apparently, perlbase-digest does not contain Digest::SHA1

So, where do I go next, besides going the docker route? Can I request a certain perl module in a bug report? Or anything else? I read a few things about CPAN, can I cross-compile these modules on an x86_64 system for an aarch64 target?

I have the following apks installed:

root@router:~# apk info |grep perl
perl
perl-clone
perl-dbi
perl-encode-locale
perl-html-parser
perl-html-tagset
perl-http-date
perl-http-message
perl-io-html
perl-lwp-mediatypes
perl-uri
perl-xml-parser
perl-xs-parse-keyword
perl-xs-parse-sublike
perlbase-autoloader
perlbase-autosplit
perlbase-b
perlbase-base
perlbase-bytes
perlbase-class
perlbase-compress
perlbase-config
perlbase-cpan
perlbase-cwd
perlbase-data
perlbase-digest
perlbase-dirhandle
perlbase-dynaloader
perlbase-encode
perlbase-errno
perlbase-essential
perlbase-extutils
perlbase-fcntl
perlbase-feature
perlbase-file
perlbase-filehandle
perlbase-findbin
perlbase-getopt
perlbase-http-tiny
perlbase-i18n
perlbase-integer
perlbase-io
perlbase-ipc
perlbase-json-pp
perlbase-list
perlbase-locale
perlbase-mime
perlbase-net
perlbase-opcode
perlbase-ostype
perlbase-params
perlbase-posix
perlbase-re
perlbase-safe
perlbase-scalar
perlbase-selectsaver
perlbase-selfloader
perlbase-socket
perlbase-storable
perlbase-symbol
perlbase-sys
perlbase-text
perlbase-tie
perlbase-time
perlbase-unicore
perlbase-universal
perlbase-utf8
perlbase-version
perlbase-xsloader

Why not stable OpenWrt?

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button (red circle; this works best in the 'Markdown' composer view in the blue oval):

Screenshot 2025-10-20 at 8.14.14 PM

Remember to redact passwords, VPN keys, MAC addresses and any public IP addresses you may have:

ubus call system board

I gave up on running Lyrion Media Server natively when it was still Logitech Media Server and switched to the docker container. I succeeded several times in getting it up and running (on Arch, not on OpenWrt), but then the next update to either Perl or LMS broke it.

Sorry I thought I did that but I got some mess in the editor. It's cleaned up now.

root@router:~# ubus call system board
{
        "kernel": "6.12.59",
        "hostname": "router.avbohemen.lok",
        "system": "ARMv8 Processor rev 0",
        "model": "Banana Pi BPI-R4 (2x SFP+)",
        "board_name": "bananapi,bpi-r4",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "firmware_url": "https://downloads.openwrt.org/",
                "revision": "r32096-2e944e083e",
                "target": "mediatek/filogic",
                "description": "OpenWrt SNAPSHOT r32096-2e944e083e",
                "builddate": "1764148608"
        }
}

Why not stable OpenWRT? I want to put in Perl natively, and I have several other packages in as well. Besides that, I have found the snapshots pretty stable and with my WiFi7 card the latest driver appears more stable. I have been running snapshots for over 10 years on multiple routers, with barely any issues.

Now, do you have any ideas on my questions?

OpenWrt is not self-hosting, but you can build on debian, fedora and the likes.

Technically, the user wants to compile on another CPU. Perhaps they just need to download/use the aarch64 SDK for their target device onto the x68_64 machine?

Missing perl modules was one of the problems I encountered. Inspired by this blog, I tried to build my own perl (a version that supports LMS). Don’t remember the result now. :slight_smile:

Thats an interesting idea. However, for this I need to either (a) create a build environment directly on my router or (b) cross-compile perl including all needed modules.

Cross-compiling works great for OpenWRT itself, because it is the regular way of creating your own build and it is well documented. Perl is also available, however not all modules have their own Makefile. So, for the needed modules, I would have to create my own Makefiles I guess... I will try some things later after more reading.

Another way to go is the simple getting started how-to at https://lyrion.org/getting-started/beginners-guide-lms-on-raspberry-pi/ and setup a Raspberry Pi Zero W2. Even though that is relatively cheap, my BananaPi R4 has more processing power, more memory (8GB) and enough storage (8GB eMMC). So therefore I will try my best to get it running on my router :slight_smile:

OpenWrt is not a valid build host

OpenWrt is not a valid build host

Then how should I proceed to create the Perl modules so they can be used on OpenWrt?

To run Lyrion on ARM platform devices with OpenWrt, you need to install a Debian environment using chroot.

Ensure the device has at least 700MB of available space.

Step 1: Install Required Packages and Set Up Debian
opkg update
opkg install debootstrap binutils bash

mkdir /debian

if [ "$(uname -m)" = "aarch64" ]; then
debootstrap --arch=arm64 --foreign --variant=minbase bullseye /debian http://deb.debian.org/debian
else
debootstrap --arch=armhf --foreign --variant=minbase bullseye /debian http://deb.debian.org/debian
fi

mkdir -p /debian/dev
mkdir -p /debian/proc
mkdir -p /debian/sys

chroot /debian /bin/bash -c "/debootstrap/debootstrap --second-stage"
chroot /debian /bin/bash -c "apt-get update && apt-get install -y apt dpkg bash coreutils"

Step 2: Enter the Debian Environment and Install Dependencies
chroot /debian /bin/bash

apt-get update
apt-get install -y sudo curl wget perl libio-socket-ssl-perl libnet-ssleay-perl
apt-get install -y libcrypt-openssl-rsa-perl

apt-get install -y
perl-modules
libio-socket-ssl-perl
libnet-ssleay-perl
libcgi-pm-perl
libdbd-mysql-perl
libjson-xs-perl
libxml-parser-perl
libgd-gd2-perl
libimage-info-perl
libaudio-scan-perl

apt-get install -y
libev-perl
libtemplate-perl
libyaml-perl
libclass-xsaccessor-perl

Step 3: Download and Install Lyrion
wget https://downloads.lms-community.org/LyrionMusicServer_v9.0.3/lyrionmusicserver_9.0.3_arm.deb
dpkg -i lyrionmusicserver_9.0.3_arm.deb

mkdir -p /var/lib/squeezeboxserver

groupadd squeezeboxserver
usermod -g squeezeboxserver squeezeboxserver
usermod -a -G audio squeezeboxserver
chown -R squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver

Step 4: Exit the Debian Environment
exit

Step 5: Create a Startup Script for LMS in OpenWrt
cat > /bin/start-lms.sh << 'EOF'
#!/bin/sh
echo "=== Starting Lyrion Music Server ==="
mount --bind /dev /debian/dev/
mount --bind /proc /debian/proc/
mount --bind /sys /debian/sys/
mount --bind /tmp /debian/tmp/
chroot /debian /bin/sh -c "
mkdir -p /var/lib/squeezeboxserver/prefs /var/lib/squeezeboxserver/cache /var/log/squeezeboxserver
chown -R squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver /var/log/squeezeboxserver
export LANG=C
export LC_ALL=C
nohup sudo -u squeezeboxserver /usr/sbin/squeezeboxserver
--prefsdir /var/lib/squeezeboxserver/prefs
--logdir /var/log/squeezeboxserver
--cachedir /var/lib/squeezeboxserver/cache
--daemon > /dev/null 2>&1 &
"
echo "=== LMS started successfully ==="
EOF

chmod +x /bin/start-lms.sh

Step 6: Start the Service
sh /bin/start-lms.sh

Step 7: Access and Configuration

  • Access the LMS web interface at: http://[device-ip]:9000

Enjoy it!!!

I have used multiple OpenWRT AP devices (with I2S codec) running squeezelite-full as clients, combining network coverage and music playback into one integrated solution.

3 Likes

In stead of a startup script and run it on every power-on/reboot, I put necessary commands in LuCI→System->Startup->Local Startup (/etc/rc.local).

Yep, probably (sleep 60 ; /opt/how-you-start-it-lyrion) & to give some time for network to come ready.

I don’t do the wait. My /etc/rc.local has these five lines:

mount --bind /dev /chroot/dev/
mount --bind /proc /chroot/proc/
mount --bind /sys /chroot/sys/
mount --bind /lms /chroot/lms/
chroot /chroot /bin/bash service lyrionmusicserver start

Note: /lms is where I mount the partition for the music and the player list

It has been working fine on all the routers - EA8500, MR8300, MR6300, Pogoplug E02 - I have/had installed LMS.

Ok, I decided the chroot environment was the best option. Here is my recipe, and my comments:

opkg install debootstrap

Yes, the chroot page from openwrt says to install binutils, but I did not find it necessary. Also bash can be skipped, the standard shell is good enough. Bash is installed in the chroot environment later. Since my BananaPi R4 has 8GB of eMMC storage, I simply decided tot extend the root filesystem. No need for external storage.

mkdir -p /opt/debian

debootstrap --arch=arm64 --foreign --variant=minbase bookworm /opt/debian http://deb.debian.org/debian

chroot /opt/debian /bin/bash -c "/debootstrap/debootstrap --second-stage"

I went for Debian 12, bookworm. Bash and coreutils are already installed in the second stage.

Install dependencies and create a usefull debian environment:

chroot /opt/debian /bin/bash

apt-get update
apt-get install -y sudo apt-utils curl wget perl libio-socket-ssl-perl \
libnet-ssleay-perl  libcrypt-openssl-rsa-perl procps psmisc vim dialog

apt-get install -y libcgi-pm-perl libdbd-mysql-perl libjson-xs-perl \
libxml-parser-perl libgd-gd2-perl libimage-info-perl libaudio-scan-perl \
libev-perl libtemplate-perl libyaml-perl libclass-xsaccessor-perl \
libdigest-sha-perl libsub-name-perl

procps and psmisc are prerequisits of LMS 9.1.0 (nightly builds). libdigest-sha-perl and libsub-name-perl are also needed.

wget https://downloads.lms-community.org/nightly/lyrionmusicserver_9.1.0~1765045466_arm.deb
dpkg -i lyrionmusicserver_9.1.0~1765045466_arm.deb

No need to add a group or change ownership. /var/log/squeezeboxserver and /var/lib/squeezeboxserver are created with squeezeboxserver:nogroup, which is fine.

I did change the user squeezeboxserver to enable login, edit /etc/passwd and change /usr/sbin/nologin to /bin/bash.

Startup, and testing:

mount --bind /dev /debian/dev
mount --bind /proc /debian/proc
mount --bind /sys /debian/sys
mount --bind /tmp /debian/tmp
chroot /opt/debian /bin/bash

su - squeezeboxserver
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
/usr/sbin/squeezeboxserver --prefsdir /var/lib/squeezeboxserver/prefs \
--logdir /var/log/squeezeboxserver --cachedir /var/lib/squeezeboxserver/cache \ 
--httpaddr 192.168.1.1 --daemon

Add --httpaddr <br-lan ip> in the startup parameters, otherwise it would bind to the br-wan address of OpenWRT and disallow any GUI actions because any LAN client is not in the same subnet. After that, the LMS GUI is available from http://<br-lan ip>:9000

And it is sufficient to start LMS via rc.local:

mount --bind /dev /opt/debian/dev
mount --bind /proc /opt/debian/proc
mount --bind /sys /opt/debian/sys
mount --bind /tmp /opt/debian/tmp
chroot /opt/debian /bin/bash -c "service lyrionmusicserver start"

Thanks!