MusicLounge: Upgrade Server To Editon 2023

Upgrade MusicLounge Server Editon 2021 To Editon 2023

# Important Notice: The image disk of the 2023 edition for Raspberry PI 4, Odroid C4 and amd64 platform are available for download HERE.
#
# follow the instructions below to upgrade your edition 2021 of MusicLounge. The audiophile server must be already installed and operational.
#
# be sure your data partition is resized
# Odroid C4 with Armbian

  1. $ sudo systemctl enable armbian-resize-filesystem
  2. $ sudo reboot

# Raspberry PI 4 with RaspPI OS, simply run raspi-config and select Advanced Options > Expand Filesystem and reboot

  1. $ sudo raspi-config

# expanding your partition during the boot can take a while (depending the size of your SD Card) so be patient,

# at first boot you should see

Usage of /: 71% of 3.7G

# after expansion on 16GB SD Card

Usage of /: 19% of 14G

# for debian amd64 expand your hard drive if needed using gparted on live distro or from desktop PC is easy
# first move the swap sda2 to end and then resize sda1
# click this link to read the tutorial to expand your disk with GParted


# First, ensure your system is up-to-date in it’s current release.
# update unpncli signature
# go to https://www.lesbonscomptes.com/pages/signatures.html
# download lesbonscomptes.gpg and copy to /usr/share/keyrings/

  1. $ cd ~/Downloads/
  2. $ sudo cp lesbonscomptes.gpg /usr/share/keyrings/

# update buster (ed. 2021) pkgs, the distro must be up to date

  1. $ sudo apt update

# now upgrade pkgs, during installation
# keep local smb.conf
# choose the internal hard drive /dev/sda to install grub if needed (and NOT /dev/sda1)
# otherwise select [default=N] reply

  1. $ sudo apt upgrade

# make a full upgrade to be sure

  1. $ sudo apt full-upgrade

# run update again and you should read
# All packages are up to date.

  1. $ sudo apt update

# now update sources list

  1. $ sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list
  2. $ sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*.list

# update to bullseye sources.list with the entries below

  1. $ sudo nano /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
deb http://security.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security/ bullseye-security main contrib non-free

# check and update upnpcli source list

  1. $ sudo nano /etc/apt/sources.list.d/*
deb [signed-by=/usr/share/keyrings/lesbonscomptes.gpg] http://www.lesbonscomptes.com/upmpdcli/downloads/debian/ bullseye main
deb-src [signed-by=/usr/share/keyrings/lesbonscomptes.gpg] http://www.lesbonscomptes.com/upmpdcli/downloads/debian/ bullseye main
  1. $ sudo apt clean
  2. $ sudo apt update

# IMPORTANT: on any error fix your sources list before going further

# say YES for restarting services automatically
# for all request (i.e. update conf files) during the upgrade say no
[default=N]

  1. $ sudo apt upgrade

# may require to remove gcc 8 base if the command failed during upgrade because of libc6-dev

  1. $ sudo apt-get remove libgcc-8-dev

# for all request during the upgrade say ‘n’
[default=N] # and obviously keep smb.conf
# make a full upgrade

  1. $ sudo apt full-upgrade

# run update again and you should read
# All packages are up to date.
# otherwise run $ sudo apt full-upgrade AGAIN

  1. $ sudo apt update

# cleanup pkgs

  1. $ sudo apt autoremove -y

# reboot

  1. $ sudo shutdown -r now

# MPD Upgrade
# check the latest release version available on offical website musicpd.org
# for example to download and extract release 0.23.12 in mpd-0.23.12/

  1. $ cd ~/Downloads/
  2. $ sudo wget https://www.musicpd.org/download/mpd/0.23/mpd-0.23.12.tar.xz
  3. $ sudo tar xf mpd-0.23.12.tar.xz

# or get the very latest (unstable dev release) by cloning the MPD git to MPD/

  1. $ sudo git clone https://github.com/MusicPlayerDaemon/MPD.git

# notice: libboost-dev dependency is no longer needed
# read the mpd tutorial to compile and install the latest version of MPD (version 0.23.12 or greater)

# after compilation and installation enable and start the service

  1. $ sudo systemctl enable mpd
  2. $ sudo systemctl start mpd
  3. $ sudo reboot

# check mpd

  1. $ sudo systemctl status mpd

#
# TROUBLESHOUTING
# in case of error (generally occurs within 5s just after playing) :

alsa_output: Decoder is too slow; playing silence to avoid xrun

# adding the following lines to all your audio output in mpd configuration (/etc/mpd.conf) may help
#

buffer_time "200000"
period_time "5084"

#
# edit mpd.conf and scroll to audio output area to add the 2 lines

  1. $ sudo nano /etc/mpd.conf
.
.
.
audio_output {
type "alsa"
name "Default"
device "hw:1,0"
mixer_type "none"
dop "no"
buffer_time "200000"
period_time "5084"
}

audio_output {
type "alsa"
name "ALSA DAC DOP"
device "hw:1,0"
mixer_type "none"
dop "yes"
buffer_time "200000"
period_time "5084"
}
.
.
.

#
# in case of non fatal binding error

server_socket: bind to '0.0.0.0:8000' failed (continuing anyway, because binding to '[::]:8000' succeeded): Failed to bind socket: Address already in use

# a binding already exists due to ipv6, however mpd is running correctly. if you do not need ipv6 support follow these instructions to disable it by using sysctl command and by adding the kernel option ipv6.disable=1 https://www.wikihow.com/Disable-Ipv6-on-Linux
# edit your nginx.conf to remove ipv6 listening by
# commenting listen [::]:80 default_server; on server block

  1. $ sudo nano /etc/nginx/sites-available/default
server {
        listen 80 default_server;
#       listen [::]:80 default_server;

# myMPD Upgrade

  1. $ cd Downloads/

# rename current directory if exists

  1. $ mv myMPD/ myMPD-10.1.7/

# read the myMPD tutorial on website
# to compile and install the latest version of myMPD (version 10.2.0 or greater)
# after compilation and installation generate the config files

  1. $ sudo systemd-run -t -p DynamicUser=yes -p StateDirectory=mympd -p CacheDirectory=mympd /usr/bin/mympd -c

# change port to 8080

  1. $ sudo nano /var/lib/mympd/config/http_port

# deactivate SSL (false)

  1. $ sudo nano /var/lib/mympd/config/ssl

# enable and start service

  1. $ sudo systemctl enable mympd
  2. $ sudo systemctl start mympd
  3. $ sudo reboot

# check

  1. $ sudo systemctl status mympd

# Raspotify Upgrade
# Install latest version of Raspotify on armhf
# before installing purge old version of raspotify

  1. $ sudo apt purge raspotify

# attention on amd64 you need to remove the Raspotify docker image

  1. $ sudo docker stop spot
  2. $ sudo docker rm spot

# list images

  1. $ sudo docker images

# get IMAGE ID and remove it

  1. $ sudo docker rmi IMAGE_ID

# if docker is no longer used you can remove it as well
# for more info see the tutorial on page:
# MusicLounge: Spotify Connect (On amd64 Distro Using Docker)
# docker image is now removed
# to install Raspotify type the following command:

$ sudo apt-get -y install curl && curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

# Edit Raspotify configuration:

  1. $ sudo nano /etc/raspotify/conf

# and change these options only

LIBRESPOT_DEVICE_NAME="MusicLounge"
LIBRESPOT_BITRATE="160"
LIBRESPOT_DEVICE="plughw:1,0"

# CTRL+O to save
# CTRL+X to exit
# now enable and start the service

  1. $ sudo systemctl daemon-reload
  2. $ sudo systemctl enable raspotify
  3. $ sudo systemctl start raspotify
  4. $ sudo reboot

# check the status

  1. $ sudo systemctl status raspotify

#
# TROUBLESHOOTING
#
# in case of warning related to libmdns

WARN  libmdns::fsm] dropping truncated packet from 192.168.x.x:5353

# this error is probably due to a bad implementation of mDNS in your router,
# you may update your router firmware or disable zeroconf (librespot discovery) and
# add your credentials to the Raspotify config
# edit conf and enable credential cache, disable discovery
# add your Spotify username and password

  1. $ sudo nano /etc/raspotify/conf
#LIBRESPOT_DISABLE_CREDENTIAL_CACHE=
...
# Disable zeroconf discovery mode.
LIBRESPOT_DISABLE_DISCOVERY=
...
LIBRESPOT_USERNAME="...."
LIBRESPOT_PASSWORD="...."

# NGINX
# check nginx service

  1. $ sudo systemctl status nginx

# in case of error

nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument

# make the following changes:

  1. $ sudo mkdir /etc/systemd/system/nginx.service.d
  2. $ sudo nano /etc/systemd/system/nginx.service.d/override.conf

# enter these lines

[Service]
ExecStartPost=/bin/sleep 0.1

# CTRL + X and Y to SAVE

  1. $ sudo systemctl daemon-reload
  2. $ sudo reboot

# open the ssh session and check the status

  1. $ sudo systemctl status nginx

# check the status of minidlna service

  1. $ sudo systemctl status minidlna

# in case of error related to autofs

/lib/systemd/system/minidlna.service:4: Failed to add dependency on autofs, ignoring: Invalid argument

# edit service to apply this fix

  1. $ sudo nano /lib/systemd/system/minidlna.service

# and replace autofs by autofs.service
# CTRL + X and Y to SAVE

  1. $ sudo systemctl daemon-reload
  2. $ sudo reboot

# check your fstab entry and journalctl (sudo journalctl -f )
# in case of error type:

CIFS VFS: Server 192.168.x.x has not responded in xxx seconds. Reconnecting...

# read carefully the SAMBA tutorial chapter “CIFS Mounts Disconnecting Issue – Read More…” (end of the page)
# otherwise disable the cron job (comment line)

  1. $ sudo nano /etc/cron.d/smb_v1_fix
#*/10 *   *   *   *   root    /home/pi/scripts/smb_v1_fix.sh >/dev/null 2>&1

# in case of dhcpcd error type

dhcpcd.service: Failed to locate executable /usr/lib/dhcpcd5/dhcpcd: No such file or directory

# check if you have an error in the status of the service

  1. $ sudo systemctl status dhcpcd
Failed to start DHCP Client Daemon.

# edit the service
# to change ExecStart command to /usr/sbin/dhcpcd -q -w

  1. $ sudo nano /etc/systemd/system/dhcpcd.service.d/wait.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/dhcpcd -q -w

# restart service and check again the status

  1. $ sudo systemctl daemon-reload
  2. $ sudo systemctl restart dhcpcd
  3. $ sudo systemctl status dhcpcd

# check the status of all other services ( airplay, roon, etc.) should be okay

# Congrats!
# Your MusicLounge audiophile server is fully updated to edition 2023
# now update the music library (database)
# use DroidMyMPD or MALP Android client
# or open your browser with http://musiclounge:8080 (or IP address)
# Enjoy!

Spotify Connect (32Bit armhf Emulation)


# STEP19

# OPTIONAL: install Spotify Connect,

# using your DAC to listen music from Spotify

# More info on librespot
https://github.com/librespot-org/librespot

# More info on Spotify connect
https://support.spotify.com/us/article/spotify-connect/

# More info on Raspotify connect
https://dtcooper.github.io/raspotify/

# Install latest version of Raspotify on amd64, arm64 and armhf is very easy
# type the following command:

$ sudo apt-get -y install curl && curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

# in case of error related to dependency like

curl : Depends: libcurl4 (= 7.74.0-1.3+deb11u7) but 7.88.1-1~bpo11+1 is to be installed

# install curl from backports

  1. $ sudo apt-get -t bullseye-backports install curl

# then install pkg

  1. $ sudo curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

# #################################################################################
# Edit Raspotify configuration:
# #################################################################################

  1. $ sudo nano /etc/raspotify/conf
LIBRESPOT_NAME="MusicLounge"
LIBRESPOT_BITRATE="160"
LIBRESPOT_DEVICE="plughw:1,0"

# CTRL+O to save
# CTRL+X to exit

  1. $ sudo systemctl enable raspotify
  1. $ sudo systemctl start raspotify

# check the status

  1. $ sudo systemctl status raspotify

# Spotify Connect is now available!
# start a song, click the devices icon (bottom left) and choose MusicLounge.
# That’s it!

Click titles below to expand to install an old version of Raspotify.


amd64 platform like Intel NUC, Gigabyte BRIX, Mini-PC,... - Click To Read More

# #################################################################################
# DEBIAN/UBUNTU AMD64 PLATFORM
# #################################################################################

# SKIP THIS TUTO and go next tutorial to learn how to install Raspotify on amd64 using Docker


armhf platform like Raspberry PI 4 - Click To Read More

# #################################################################################
# ATTENTION Raspotify Pkg Is For 32Bit Linux Distro Only, armhf platform
# #################################################################################
#
# install librespot (Raspotify) on Raspberry PI 4 with RaspiOS armhf (32Bit) is easy:

# install curl

  1. $ sudo apt-get -y install curl apt-transport-https

# Add repo and its GPG key

  1. $ curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v -
  1. $ echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list

# Install pkg

  1. $ sudo apt-get update
  1. $ sudo apt-get -y install raspotify

# read below how to configure Raspotify


arm64 platform like Odroid C4 - Click To Read More
# #################################################################################
# on arm64 platform you can force installation of Raspotify 32 Bit pkg by using multi-arch
# applicable to Odroid C4 platform for example
# #################################################################################

# Force installation on Ubuntu arm64 (64Bit) using multi-arch

# add armhf platform

  1. $ sudo dpkg --add-architecture armhf

# check if added

  1. $ sudo dpkg --print-foreign-architectures
$ armhf

# update pkgs list

  1. $ sudo apt update

# Install curl and https apt transport

  1. $ sudo apt-get -y install curl apt-transport-https

# Add repo and its GPG key

  1. $ curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v -
  1. $ echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list

# edit sources list to target armhf platform

  1. $ sudo nano /etc/apt/sources.list.d/raspotify.list

# change

deb https...

# by

deb [arch=armhf] https...

# Install pkgs list

  1. $ sudo apt-get update
  1. $ sudo apt-get -y install raspotify:armhf

# if your /var/log/syslog is fulfilled by deprecated …cp15_barrier
# add the following to any startup script like the good old /etc/rc.local
# if you are not too lazy then create a service it is better…

  1. $ sudo nano /etc/rc.local

# add this line to deactivate the warning

sudo bash -c "echo 2 > /proc/sys/abi/cp15_barrier"

# CTRL+O to save
# CTRL+X to exit


# if for some reason this did not work on your Odroid C4 (arm64 platform) go next tutorial to install it with Docker
# to cleanup ALL previously installed armhf pkgs on arm64 platform

  1. $ sudo apt --purge remove "*:armhf"
  1. $ sudo apt autoremove
  1. $ sudo reboot

Raspotify configuration - Click To Read More

# #################################################################################
# Edit Raspotify configuration:
# #################################################################################

  1. $ sudo nano /etc/default/raspotify
DEVICE_NAME="MusicLounge"
BITRATE="160"
OPTIONS="--device plughw:1,0"

# CTRL+O to save
# CTRL+X to exit

  1. $ sudo systemctl restart raspotify

# check the status

  1. $ sudo systemctl status raspotify

# Spotify Connect is now available!
# start a song, click the devices icon (bottom left) and choose MusicLounge.
# That’s it!