Wednesday, November 30, 2016

Easily install Logitech Media Server (Squeezebox Server) and Squeezelite on your Pi with Armbian Jessie

Do you have any spare Pi?
I am talking about the Raspberry Pi, Orange Pi, Banana Pi, Cubieboard, pcDuino, Odroid, NanoPi and the likes...

Why not transform it into a Sonos-like multimedia server and player?
It's soooo easy!

All we need is two nice pieces of software: the Logitech Media Server (aka Squeezebox server) and a player to connect to it, which is going to be Squeezelite.

First of all, download the right image of Armbian for your board HERE
Please choose "Jessie server" image, if available. This is the version for server usage, with no desktop environments.
Follow the instructions and setup the operating system (we have faith you can manage this on your own, since you have a spare development board...)

How to install the Logitech Media Server / Squeezebox Server

Now, we have to install the Logitech Media Server, but we have to download it first. From the command line give the following command:
wget http://downloads.slimdevices.com/nightly/7.9/sc/ffd0b97/logitechmediaserver_7.9.0~1480398011_arm.deb -O lms.deb
(Please notice that from http...to..._arm.deb there are no spaces)
And let's wait for the file to be downloaded.  If you get a file not found error, you'll have to visit this website with a browser:
http://downloads.slimdevices.com/nightly/?ver=7.9
Find the most recent version of the _arm.deb version available, right click on it to copy it's link, and substitute this link in the above command.

Once the Logitech Media Server installation package has been downloaded, proceed with its installation:
sudo dpkg -i lms.deb
That's it! The Logitech Media Server is now installed, and you can go to:
http://ip-address-of-the-board:9000
 from any browser to set it up.

How to install the Squeezelite player

To actually play/stream your music collection or listen to online radios, you'll also need a player. This can be installed on the same board as the Logitech Media Server (so you will have a Server and a Player on the same machine), or on different boards which will work as players that connect to the Server (you can have as many players as you want!)

So, let's install Squeezelite, the Player "side" of this combo.
First we need to refresh the packages list of our installation:
sudo apt-get update
 Then we can install squeezelite:
sudo apt-get install squeezelite
That's basically it! Squeezelite will be installed and will automatically be launched at startup.

If you are using an external usb soundcard you might need to tweak with the squeezelite configuration file, which is /etc/default/squeezelite

First you will need to find out the name of the soundcard, and to do this you have to issue the following command:
sudo /usr/bin/squeezelite -l
Check the output and identify the name of your sound card. Copy it, then open the configuration file:
sudo nano /etc/default/squeezelite
Find the following line:
SL_SOUNDCARD="sysdefault:CARD=ALSA"
and substitute sysdefault:CARD=ALSA with the name of the card you have copied before.

If you want to give your player a different name than your hostname, just edit this line:
SL_NAME="$(hostname -s)"
and change the string within the quotes to the name you want to give this player.

The other options usually don't need to be touched.
That was easy, wasn't it?

Enjoy your music on your Pi!

48 comments:

  1. Hello,

    Interesting article , many thanks. I'm interested solely in running the Logitech Squeezebox Server on a stand alone low power device. Sorry not a developer but have an electronics background. Only just stumbled across your fine blog. Looks like you can simply install the server and that's all that's required. I'm now a bit confused as to the best Raspberry Pi to buy to try this out as I can see that there is only support (tested releases) for sort models / derivatives of the Pi. Can you give me any advice on the best / low cost Pi please. I also need it to be reasonably fast as I have 1400 CD's that often need to be scanned. Thanks in advance.

    ReplyDelete
    Replies
    1. As you only need a server, my advice is to get the most powerful board your
      money can buy, even though my server has been running perfectly on an old
      raspberry pi 1 model B.
      If you don't want to fiddle much you will find it easier to use a raspberry
      pi, due to its very large community.
      Regarding the 1400 CDs to be scanned, this is something that needs to be
      done just once. After the library has been created, you will only update
      the library which means that the workload on the board will be much less.
      If you want to save money, an OrangePi PC is probably the best bang for the
      buck, costing just about $15

      Delete
  2. Hello , thanks for such a quick response. Absolute cost is less of an issue. Priority today is (1) ease of install. Most of the articles I've seen to date suggest that it's not as simple as say install under Windows/Mac or perhaps Ubuntu... I'm tempted to go Raspian, Raspberry Pi as in principle there are lots of people with experience. less for I guess for Armbian.

    The reason I mention the rescan is that I've had to do it on my Atom EEE900 PC with Win7 a few times , when cover artwork is changed or files are added/removed. A rescan should work I know but as mentioned I've found it necessary. The new project is supposed to be a replacement (lower power) and or backup for the existing rig. Hope this clarifies my needs today. Thanks once more.

    Alan

    ReplyDelete
    Replies
    1. Please consider that all these Single-Board Computers run with linux: raspbian and armbian are just two different distributions of linux, mostly derived by Debian, hence the -bian suffix.
      This is because Windows needs too many resources and it would be impossible to run it on such devices.
      I would go with a Raspberry Pi, since the community is very large and you will find easy help for any problem you might encounter. It's relatively cheap, so if you have doubts about your skills with linux, you can experiment with it without breaking the bank. But it's not that hard to learn, and very interesting too.

      Delete
  3. So after all this fine comment from you. Can I

    a) use any raspberry pi? Speed aside

    b) simply follow the above guide and expect a simple experience?

    Thanks again

    ReplyDelete
  4. so in summary can I


    a) use any raspberry pi ? Speed issue aside.

    b) simply follow your simple guide above?

    Thanks again

    ReplyDelete
  5. Ahh forgot to ask. Which build would I select for a standard pi as it's not listed in the stable builds?

    ReplyDelete
    Replies
    1. Yes, as a Squeezebox server any raspberry pi will be fine.
      In this case, just use raspbian and you should be ok following this tutorial.
      Otherwise, if your only goal is to install the Squeezebox server, you can use DietPi (www.dietpi.com) which is a very easy to use version of armbian.
      With DietPi you can install the Squeezebox Server on your board with just a couple of clicks.

      Delete
  6. Many thanks once again. In the process of buying a faster Pi before trying.

    ReplyDelete
    Replies
    1. You're welcome. Should you encounter any problems just ask here, I will be glad to help if I can.
      Just keep in mind that these boards need a good power supply and a good quality Class 10 microSD card to work flawlessly. Bad power supplies and/or cards are the most common cause of failure.
      Have fun!

      Delete
  7. Hello,

    Well I've now installed Raspian Stretch on my V1.0 pi (original and rather slow). Have installed 7.7.5 , the and the nightly build. The only version that partially works ? is 7.9.0 in so far that I can see the squeezeboxserver running as a service. The squeezeboxserver log file shows that the 'server has died and is restarting' a multiple number of times. I cannot browse to the server. Starting and stopping the service with 7.7.5 does not seem to work but believe it did with 7.9.0.

    (I removed the packages at each stage with 'sudo apt-get Logitechmediaserver' before installing another version.)

    There seems very little I can do at this stage as I don't appear to have any diagnostic information. Any idea what might be wrong?

    By the way I can SSH into the Pi without problem.

    Thanks in advance for your help.

    Alan

    ReplyDelete
    Replies
    1. There is a known incompatibility between Stretch-based linux images and the squeezebox server.
      They are trying to figure that out, but there's no solution as of now.
      The only way to solve is to use an older raspbian Jessie image on your Raspberry Pi.
      I'm sorry about this but I have only found out about this today.

      Delete
    2. No need to apologise , do you know what version might be OK. I'm downloading a zip dated 2015-11-21.zip. Thanks...

      How do you find these facts out, if you don't mind me asking?

      Delete
    3. That's too old. Download the latest Jessie here:

      http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/

      I am a moderator on the DietPi forum (when I have the time for it) and I have just read about this issue on a post on there today.

      Delete
  8. Ok, many thanks I'll give that a try

    ReplyDelete
    Replies
    1. No problem, hope this solves your problem.

      Delete
    2. Too many "problems", sorry. This is what happens when I don't read what I am writing :)

      Delete
  9. Hello , many thanks. I can see the browser interface. I've executed the following without any known ill effect:
    sudo apt-get update

    sudo apt-get dist-upgrade

    Next steps for me are mount an external hard disk with approx. 700G of Flac and MP3's and make this available over my home network so that I can add / modify music from my Windows 10 computer.

    Is this a good guide for mounting a disk drive?

    https://goo.gl/zjjJuD

    I realise I will have to install samba for the networking.

    This is a rehearsal today as I intend to replace my pi with Version 2 model.

    Thanks again.

    ReplyDelete
  10. Forgot ask , you say 'they are trying to figure this out' they being Raspian or the squeezeboxserver developers?

    ReplyDelete
  11. Any guide should work, as the mounting process has not changed much during time. :)
    Just remember that it's of utter importance the kind of partition used to format you hard drive (FAT, FAT32, NTFS, EXT2, ecc.) because you will need to pass this information with the 'mount' command.

    I'm not sure who is working on the incompatibility with Stretch images, but I guess all the parties involved are probably looking for a solution.

    BTW, the dist-upgrade you launched should have updated your raspbian installation to the latest available, so it would be interesting to see if you now have a Stretch version of raspbian installed.

    ReplyDelete
  12. Yes, I was concerned that these commands might upgrade Jessie to Stretch but listing the the 'os-release' in /etc shows:

    PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="8"
    VERSION="8 (jessie)"

    According to a few sites like this one:
    https://goo.gl/xqRRX3

    need to udpate the repositories in order to upgrade the to Stretch.

    Of course, I'm just following these sites as written.

    Looks to me like:

    a) I still have Jessie (although foolishly didn't take a note of the version number before updating.

    b) The Setup wizard for the Logitechmediaserver is still accessible, via IP:9000. So I reckon I'm still ok at this point.

    Next step as mentioned is to mount a USB stick as a rehearsal for a larger USB drive.



    ReplyDelete
    Replies
    1. Yes, you need to update the repositories in order to upgrade to the new version.
      As a general rule, though the command "apt-get dist-upgrade" should be used for this purpose.
      If you simply want to update your installed packages to the latest version available on current repositories you should issue the following two commands:

      sudo apt-get update
      sudo apt-get upgrade

      The first one updates the list of the latest packages versions that are available at the moment, and the second upgrades those installed packages that are older than the available version.

      Luckily you have not messed up your installation, since LMS still works, but IMHO it would be better to use the aforementioned commands to update your board.

      Delete
  13. Seasons Greetings

    Hello, hope you don't me mind asking today (if your following Boxing Day) . Happy to wait of course. Had success playing music via a USB stick but not so with a small USB hard drive. I'm using an active hub to power the drive. The Pi can see the FLAC music in a folder called /media/pi/FLAC using it's file manager . But when I try and browse to the music from the LMS browser settings I can see the \media\usb folder but not \media\pi for some reason?

    The ..\pi folder was automatically generated when the drive was inserted. I've executed the following:

    sudo chown pi:pi /media/pi/FLAC (FLAC is the name of the folder on the drive)
    sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /media/pi/FLAC

    Formatted under Windows 10 as FAT32

    I guess this is a permissions issue or similar but don't really know now how to resolve. Thanks again for any advice.


    ReplyDelete
  14. Forgot mention there are two associated parts to the Hard drive

    /dev/sda1: LABEL="EFI" UUID="70D6-1701" TYPE="vfat" PARTLABEL="EF" PARTUUID="669ff096-0310-431d-8f88-dc9f0d8591d6"
    /dev/sda2: LABEL="FLAC" UUID="19F2-0F8B" TYPE="vfat" PARTLABEL="Ba" PARTUUID="846faa13-24e2-445d-9c04-dd8155b1f4a4"

    Perhaps my mount command should be the sda2 ?

    I'll try it

    Alan

    ReplyDelete
  15. Ok, I think the above was due to poor formatting on my part and sorted and have a single partition now.

    This articles (below) has helped me get the the hard drive running.
    http://wiki.slimdevices.com/index.php/MusicOnLinuxUSBHardDrives

    So thanks again for your patience.

    My intention is now to use Winscp to move files to the Pi. Unfortunately this seems to only partially work. Some tracks from an Album upload but others fail. I've used Winscp in the past on another Linux system (Fedora , Vortexbox ) albeit mainly for downloading files after they've been ripped. I get error code 5 from Winscp - Bad message (badly formatted packet or protocol incompatibility). I've tried Bitvise too but this fails in a similar manner. Any thoughts?

    ReplyDelete
    Replies
    1. Hi! Sorry for the delay but I was out of town for the holidays. Glad you sorted out the problem with the hard drive.
      Regarding your last question, I am not an expert in this field. I can only tell you that the easiest way to send files to the Pi is to create a shared "upload" folder on it using samba. Another easy way is to install an FTP server on the Pi and send files to it via FTP.
      If you are willing to learn new things with the command line, you can also send files via ssh, although this is probably the least user-friendly method.

      Delete
  16. No worries about the delay. Will post this on the Raspberry Pi forum I think. Thanks once more.

    ReplyDelete
  17. Hello,

    Some time since we spoke. Well last night my Logitechmediaserver stopped working. I requested a full library rescan and it all died. Approx. 1500 CD's in Flac about 500G on an external Hard Drive. Been running without problems for 6-8 weeks. The Pi itself seems to respond and operate via Putty. I've attempted to remove 7.9.0 Logitechmediaserver and revert to 7.7.5. Assuming I've removed OK it's worrying that this doesn't work either. I had installed VNC but this doesn't seem to work properly now as well but maybe unrelated. I'm starting to be concerned about the reliability of this platform / combination. It ran previously for 3 years under Win7 without a glitch. e.g. found this link https://goo.gl/nxbB1A
    Guess you can't comment on my woes . But not sure the best step now. Clean install perhaps with 7.7.5 not 7.9.0 as I was running. Still Jessie of course based on your advice. Thanks again.

    ReplyDelete
    Replies
    1. What do you mean with "it all died"?
      Can you browse the music files from the terminal?
      Do you receive any error messages?
      I've been running LMS on an OrangePi for more than two years now, and it's very stable. I don't honestly think that what you are experiencing is due to the unreliability of this system.

      Delete
  18. Hi,

    OK , so the server is no longer visible from within the Browser. Via Putty I can still interact with the Pi. I can see my music files by track for example on the hard disk . I seem to be able to install apps and believe successfully removed the 7.9.0 version of the server. As mentioned I have installed 7.7.5. The server.log file for 7.7.9 shows repeated 'server restarting' messages. I believe I've now overwritten with the new install but have the same error messages in the server.log file i.e. restarting. My guess is, either the install wasn't 100% successful for 7.7.5 or something else is interfering with it's running. i.e. the same thing that killed 7.9.0


    I tried running a file check on the Pi with the touch command i.e.

    sudo touch /forcefsck


    But don't believe this worked.

    I'm running headless at the moment but could re instate a monitor , keyboard and local mouse if useful.

    My inclination is to start again ! But not sure:

    a) Which version of LogitechmediaServer offers my best chance of long term running.

    b) What else might/should I do?

    Do you think this is a fluke event or is it likely to happen again from your experience?

    Hope this helps explain my situation.

    By the way I now have another Raspberry Pi 2 (similar to the now damaged install). I even have a model 3 but this was set aside for Samba sharing experiments.

    Thanks again.

    ReplyDelete
    Replies
    1. Unfortunately it's very difficult to pinpoint the problem.
      Have you "touched" the RPi in any way recently? I mean: have you installed anything new? Have you upgraded any package?

      Is your power supply reliable? Most problems with these boards come from unreliable power sources. Also the SD card might get corrupted and create problems.

      If you use the board for LMS only, my advice is to start again from scratch, possibly on a new card. It's not a long process. Just download the latest version of LMS, it should work fine.

      Also, after you finish the setup and everything is working fine (LMS and any other programs you might want to install on the board) make a backup of the card and store it on your desktop computer, so that you can overwrite the SD card with a fully ready installation, in case anything goes wrong or the card corrupts.

      Delete
  19. Hello and thanks,

    No not touched a thing. A few weeks ago I updated the iPlayer radio plug in to work with the revised standard. The power supply is OK but not a known brand. So could change to a genuine unit. I've a separate active usb hub for the drive with it's own PSU. The PI itself measures about 2W max at the mains side.

    I feared you might suggest this approach but as you say not too long to do.

    When you say latest version can you be a bit more specific please.

    Thanks

    ReplyDelete
    Replies
    1. Believe it or not, most of the problems with these boards come from unstable power supplies. Just a little voltage spike can corrupt sd cards and create what look like software problems but aren't.
      So, just to be safe, be sure to use only quality power supplies for the boards.

      Regarding the LMS version, just go here:

      http://downloads.slimdevices.com/nightly/?ver=7.9

      and download the latest nightly version.
      Otherwise, if you want the stable version, go here:

      http://downloads.slimdevices.com/LogitechMediaServer_v7.9.0/

      Delete
  20. Hi, just starting to re install . In fact I had a proper Raspberry Pi power supply on the Pi itself , but only a 1A Power supply on the hub/disk drive. Perhaps a bit low . Although a 2.5 inch new Toshiba I measured 4/5W peak on a the drive at the mains. This could have led to the crash. I've replaced with a 2.1A PSU.
    Let's hope this lasts a bit longer.

    ReplyDelete
    Replies
    1. If you are 100% positive that it's not a software issue, I am pretty confident that a good PSU will solve the problem.
      Please also consider that a good SD card is required, too. If you are using anything but a "premium" card (SanDisk, Toshiba and the likes) please upgrade it ASAP.
      A good card with a reliable PSU will avoid 95% of possible non-software issues.
      Keep me posted :)

      Delete
  21. Can you help me with this error message, I've downloaded last night's build with Jessie as before:

    sudo dpkg -i logitechmediaserver_7.9.1_night.deb
    Selecting previously unselected package logitechmediaserver.
    (Reading database ... 115260 files and directories currently installed.)
    Preparing to unpack logitechmediaserver_7.9.1_night.deb ...
    Unpacking logitechmediaserver (7.9.1~1521043527) ...
    dpkg: dependency problems prevent configuration of logitechmediaserver:
    logitechmediaserver depends on libio-socket-ssl-perl; however:
    Package libio-socket-ssl-perl is not installed.

    dpkg: error processing package logitechmediaserver (--install):
    dependency problems - leaving unconfigured
    Processing triggers for systemd (215-17+deb8u7) ...
    Errors were encountered while processing:
    logitechmediaserver

    Perhaps this version is too new for Jessie ?

    ReplyDelete
  22. Just install it via apt-get:

    sudo apt-get install libio-socket-ssl-perl

    (not sure about the package name though)

    ReplyDelete
  23. Re your other comments on SD cards, I'm using good quality high speed cards. I'm going to revert to 7.9.0 and try again with a fresh Jessie install.

    ReplyDelete
    Replies
    1. Good! I was not implying you weren't, just pointing out that using good quality cards helps avoid many issues. :)

      Delete
    2. Don't worry keep these comments coming. I may have found the problem (1A only adaptor on the hard drive supply) I hope so any way. About to install today as delays prevented this yesterday.

      Delete
    3. OK, I think a better adapter will give you more peace of heart in any case.
      Have you already tried installing the missing package with apt-get?

      Delete
  24. Hello,

    I wanted to keep to a single change at this point. So have reverted to the previous version 7.9.0 . Trust that's not daft. I'd like to see how the new power supply offers a solution to my recent failure.

    In truth I wasn't 100% sure why this new Perl component is required. Did you manage to find out what that version is called or how would I find the right one ?

    Thanks again.

    ReplyDelete
    Replies
    1. I think that the command I've written before should work fine.

      Delete
  25. Hello Again,

    Well the Squeezebox player has been running now for 3+ months without a known incident. But seemed to die this morning/last night. Unable to SSH or VNC to it or view the filing system remotely. I took the plunge and powered down and up again. Seems to be running again without any obvious to me issues. Slightly disappointing that it's only stayed up this amount of time. As mentioned I had previously run under Windows 7 on an Asus EEE PC solid state PC and it never failed over a number of years. Of course for me it's hard to say whether this is a Pi/Jessie/Logitech issue? Any thoughts or ideas ? For now I'm just going to leave as is and hope it continues to run. What would your expectations be for such a system ? Thanks once more.

    ReplyDelete
  26. Hello,

    Finally got round to putting a monitor on the Pi , as it had resumed playing following a power cycle and then stopped once more. I've copied the log file off the disc and looks to me like it's trying to do a firmware update ? Not sure what's causing that that? It's not succeeding. But my guess it's going to fall over again. Here's the last extract from the file:


    "18-06-29 04:17:18.8478] main::init (388) Starting Logitech Media Server (v7.9.0, 1488878280, Wed Mar 8 14:36:54 UTC 2017) perl 5.020002 - arm-linux-gnueabihf-thread-multi-64int
    [18-06-29 04:17:20.9091] Slim::Utils::Misc::msg (1244) Warning: [04:17:20.9071] DBIx::Class::ResultSet::update_or_create(): Query returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single at /usr/share/perl5/Slim/Schema.pm line 1877
    [18-07-04 10:33:32.7861] Slim::Utils::Firmware::downloadAsyncError (581) Warning: Firmware: Failed to download http://update.slimdevices.com/update/firmware/7.9.0/fab4.version (Error on HTTP socket: Operation now in progress), will try again in 10 minutes."

    Can you make any sense of this?

    Thanks once more.

    ReplyDelete