TROUBLESHOOTING: Boot Fall Into BusyBox (initramfs)

# after downloading and install (clone) the image disk onto your hard drive (/dev/sda),
# falling into BusyBox (initramfs) during boot is easy to fix
# boot using gparted live and open terminal with sudo permission

# create mount directory

  1. root@debian:~# mkdir /mnt/temp

# sudo fdsik -l /dev/sda may help your to identify root and boot partition
# mount root partition

  1. root@debian:~# mount /dev/sda3 /mnt/temp

# mount boot partition

  1. root@debian:~# mount /dev/sda4 /mnt/temp/boot

# bind all others

  1. root@debian:~# mount --bind /dev /mnt/temp/dev
  1. root@debian:~# mount --bind /dev/pts /mnt/temp/dev/pts
  1. root@debian:~# mount --bind /proc /mnt/temp/proc
  1. root@debian:~# mount --bind /sys /mnt/temp/sys

# chroot mounted partition

  1. root@debian:~# chroot /mnt/temp

# update initramfs

  1. root@debian:/# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-6.1.0-7-amd64
W: No zstd in /usr/bin:/sbin:/bin, using gzip

# update grub

  1. root@debian:/# update-grub
Generating grub configuration file ...
Found background image: mdl_splash.png
Found linux image: /boot/vmlinuz-6.1.0-7-amd64
Found initrd image: /boot/initrd.img-6.1.0-7-amd64
Found linux image: /boot/vmlinuz-6.1.0-3-amd64
Found initrd image: /boot/initrd.img-6.1.0-3-amd64
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done
  1. root@debian:/# exit
  1. root@debian:/# sudo reboot

# optional: as soon as you boot normally repeat the last 2 commands to update initramfs and grub

# also, if cannot boot, use the gparted live option to boot local system and reinstall grub

  1. root@debian:/# sudo grub-install /dev/sda

# that’s it!

TROUBLESHOOTING: Network Interface

# on first boot your network interface is down, no IP address found, ping your gateway (router IP) failed
# login the server
# type the following to identify the name of your interface (i.e. enpXsX)

  1. $ sudo dmesg

# or

  1. $ sudo dmesg | grep "enp"
[    2.446277] forcedeth 0000:00:0a.0 enp0s10: renamed from eth0

# then rename interface in /etc/network/interfaces

  1. $ sudo nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s10
allow-hotplug enp0s10
iface enp0s10 inet dhcp

# CTRL X + Y to save and reboot

  1. $ sudo reboot

TROUBLESHOOTING: Static IP


# TS7

# Static IP not working
# assign IP to eth0 interface

# configure a static IP address by adding the following to /etc/dhcpcd.conf:

  1. $  ip link show

# ON RASPBERRY PI

  1. 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
  2. 2: eth0:  mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
  3. 3: wlan0:  mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000

# eth0 is your default interface (Ethernet connection), do not use wifi for your audio server

# ON AMD64 PC

  1. 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
  2. 2: enp3s0:  mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
  3. 3: wlp2s0:  mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000

# enp3s0 is your default interface (Ethernet connection), do not use wifi for your audio server

# type:

  1. $ sudo nano /etc/network/interfaces

# add those lines at end:

  1. auto lo eth0
  2. iface lo inet loopback
  3.  
  4. iface eth0 inet static
  5.     address 192.168.x.x
  6.     netmask 255.255.255.0
  7.     network 192.168.x.x
  8.     gateway 192.168.x.x

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

  1. $ sudo nano /etc/resolv.conf

# add one or 2 lines (change IP to your DNS address or your router)

  1. nameserver 192.168.x.x
  2. nameserver x.x.x.x

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

  1. $ sudo reboot

# OPTIONAL AND NOT RECOMMENDED
# stop dhcpcd service when the static ip is valid and reachable only

  1. $ sudo systemctl stop dhcpcd

# restart network

  1. $ sudo systemctl restart networking

# get the status (you may lose your ssh session see below)

  1. $ sudo systemctl status networking

# if everything okay reboot your system

  1. $ sudo reboot

# or type this cmd below with interface name (eth0 or enp3s0 ) and reboot manually

  1. $ sudo ifdown enp3s0

# here you’re loosing your SSH session obviously
# see troubbleshooting if static IP not working
# reboot system
# and start the NEW SSH SESSION WITH YOUR NEW STATIC IP! đŸ˜‰

TROUBLESHOOTING: GENERAL


# TS6

# if MPD doesn’t start type this to get its status

  1. $ sudo systemctl status mpd

# if the error is related to /libavcodec.so.58: undefined symbol: bcm_host_is_fkms_active
# reinstall libraspberrypi0 pkg

  1. $ sudo apt install --reinstall libraspberrypi0
  1. $ sudo reboot

# NANO return this error (on Armbian / Debian):

Unable to create directory /root/.local/share/nano/: No such file or directory It is required for saving/loading search history or cursor positions.

# check if nano cmd is available using:

  1. sudo /bin/nano .bashrc

# if nano opens the file then you simply need to create the /root/.local/share/nano/ directories
# you can confirm the issue by using:

  1. sudo ls -l /root/.local/

# UPGRADE or DOWNGRADE YOUR KERNEL


# IMPORTANT:
# All information below is for Raspberry PI platform only, does not apply to other devices


# go to
https://github.com/Hexxeh/rpi-firmware/commits/master

# get the sha1 of the kernel
# for example: 4.19.118-v7 e1050e94821a70b2e4c72b318d6c6c968552e9a2

# then to install this old kernel 4.19.118-v7+ enter:

  1. $ sudo rpi-install e1050e94821a70b2e4c72b318d6c6c968552e9a2
  1. $ sudo reboot

# install pkg ends with error:
# “Failed to start The PHP 7.3 FastCGI Process Manager”
# type the cmd below to create the missing directory:

  1. $ sudo mkdir /var/run/php

TROUBLESHOOTING: Raspberry PI 3B+


# IMPORTANT FOR RASPBERRY PI OWNERS:
# It’s strongly recommended to create your audio server on Raspberry PI 4 2Go
# The raspberry pi 3 share the same controller with USB and Ethernet which is not good for an audiophile server
# do not expect to use native DSD with RPI 3 using an usb dac…


# ALL INFORMATION BELOW ARE FOR RPI 3B + ONLY, does not apply to other devices


# Apply patch one by one in this order, reboot and check before


# TS1

# APPLY IF NEEDED ONLY (sound drop/loss)

# Ethernet drops Fix (Recommended for Raspberry PI 3B+ only do not apply to RPI 4)
# identify the name of your Ethernet connection (usually eth0 or enp3s0)

  1. $ ip a

# edit rc.local to run a cmd at startup

  1. $ sudo nano /etc/rc.local

# enter this cmd below to optimize your ethernet connection
# see the Tips & Tricks section to install ethtool (sudo apt-get install ethtool) if needed
# add this line at end of rc.local

  1. $ sudo ethtool -s eth0 speed 100 duplex full

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

  1. $ sudo reboot

# TS2

# APPLY IF NEEDED ONLY

# optimize perf for Raspberry PI 3B+ – cpu gouvernor (not recommended for PI4)

# check cpu governor

  1. $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# set to “performance” at startup

  1. $ sudo mv /etc/init.d/raspi-config /etc/init.d/raspi-config.bak
  1. $ sudo nano /etc/init.d/raspi-config

# copy/paste this script

#!/bin/sh
### BEGIN INIT INFO
# Provides: raspi-config
# Required-Start: udev mountkernfs $remote_fs
# Required-Stop:
# Default-Start: S 2 3 4 5
# Default-Stop:
# Short-Description: Switch to performance/ondemand cpu governor based on shift key pressed.
# Description:
### END INIT INFO
 
# . /lib/lsb/init-functions
 
case "$1" in
start)
log_daemon_msg "Checking if shift key is held down..."
SYS_CPUFREQ_GOVERNOR=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
if [ -x /usr/sbin/thd ] && timeout 1 thd --dump /dev/input/event* | grep -q "LEFTSHIFT\|RIGHTSHIFT"; then
printf "Yes. Switching to ondemand scaling governor."
if [ -e $SYS_CPUFREQ_GOVERNOR ]; then
echo "ondemand" > $SYS_CPUFREQ_GOVERNOR
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
fi
log_end_msg 0
else
printf "No. Switching to performance scaling governor."
if [ -e $SYS_CPUFREQ_GOVERNOR ]; then
echo "performance" > $SYS_CPUFREQ_GOVERNOR
fi
log_end_msg 0
fi
;;
stop)
;;
restart)
;;
force-reload)
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac

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

# set permission to exec

  1. $ sudo chmod 755 /etc/init.d/raspi-config
  1. $ sudo reboot

# type to check:

  1. $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# result must be:

# performance


# TS3

# APPLY IF NEEDED ONLY

# USB dropped frames Fix (not recommended for PI 4)

  1. $ sudo nano /etc/rc.local

# # USB fix

  1. $ sudo sed -i "s/console=serial0,115200/net.ifnames=0 dwc_otg.fiq_enable=1 dwc_otg.fiq_fsm_enable=1 dwc_otg.fiq_fsm_mask=0xF dwc_otg.nak_holdoff=1 console=serial0,115200/" /boot/cmdline.txt

# # revert value

  1. $ sudo sed -i "s/net.ifnames=0 dwc_otg.fiq_enable=1 dwc_otg.fiq_fsm_enable=1 dwc_otg.fiq_fsm_mask=0xF dwc_otg.nak_holdoff=1 //" /boot/cmdline.txt

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

  1. $ sudo reboot

Install Kodi 20.x On Debian 11/12 (Bullseye/Bookworm)

# KODI Installation version 20.x Nexus on Debian 11/12 (Bullseye/Bookworm)

# Kodi is a multi-platform home-theater PC (HTPC) application.
# official repository: https://github.com/xbmc/xbmc
# website: http://kodi.tv/

# update all pkgs

  1. $ sudo apt update

# if need run upgrade

  1. $ sudo apt upgrade

# all pkgs must be up to date before going further


# for Debian bulleyes edit source list to add testing repo, not needed for bookworm

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

# add the line below at end

deb http://deb.debian.org/debian testing main non-free contrib

# CTRL+X and Y to SAVE
# get testing packages list

  1. $ sudo apt update

for Debian 11 bulleyes: DO NOT UPGRADE

# install kodi 20.x

  1. cd ~/Downloads

# AMD64

  1. $ sudo apt install kodi

# or
# download/install Kodi 20.x manually (not recommended)

  1. $ wget -O  kodi_20.1+dfsg-1_amd64.deb http://ftp.us.debian.org/debian/pool/main/k/kodi/kodi_20.1+dfsg-1_amd64.deb

# in case of dependencies error, download and install all pkgs

  1. $ for x in {'kodi-repository-kodi_20.1+dfsg-1_all.deb','kodi-data_20.1+dfsg-1_all.deb','kodi-bin_20.1+dfsg-1_amd64.deb','kodi_20.1+dfsg-1_amd64.deb'}; do wget $x http://ftp.us.debian.org/debian/pool/main/k/kodi/$x; done

# install Kodi 20.1 manually

  1. $ sudo apt install ./kodi-data_20.1+dfsg-1_all.deb ./kodi-bin_20.1+dfsg-1_amd64.deb ./kodi_20.1+dfsg-1_amd64.deb ./kodi-repository-kodi_20.1+dfsg-1_all.deb

# ARM64 Raspberry PI 5/PI 4

  1. $ sudo apt install kodi

# or
# download/install Kodi 20.x manually (not recommended)

  1. $ for x in {'kodi-repository-kodi_20.1+dfsg-1_all.deb','kodi-data_20.1+dfsg-1_all.deb','kodi-bin_20.1+dfsg-1_arm64.deb','kodi_20.1+dfsg-1_arm64.deb'}; do wget $x http://ftp.us.debian.org/debian/pool/main/k/kodi/$x; done
  1. $ sudo apt install ./kodi-data_20.1+dfsg-1_all.deb ./kodi-bin_20.1+dfsg-1_arm64.deb ./kodi_20.1+dfsg-1_arm64.deb ./kodi-repository-kodi_20.1+dfsg-1_all.deb

# official repo should be automatically installed but if you want to install it manually

  1. $ $ sudo apt install kodi-repository-kodi

# add current user to all needed groups

  1. $ sudo usermod -aG adm,dialout,cdrom,sudo,audio,www-data,render,video,plugdev,games,users,dip,input $USER

# for Raspberry PI add gpio i2c spi

  1. $  sudo usermod -aG  adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,render,netdev,gpio,i2c,spi pi

# OPTIONAL: edit source list to comment testing repo

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

# comment testing repo

#deb http://deb.debian.org/debian testing main non-free contrib

# CTRL+X and Y to SAVE
# get main packages list

  1. $ sudo apt update

# Kodi Power Menu

# SUSPEND/RESUME (amd64 platform)
# enable suspend services

  1. $ sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

# 2 way to enable power policy for pi user
# 1. if /etc/polkit-1/localauthority exists

  1. $ sudo nano /etc/polkit-1/localauthority/50-local.d/50-kodi.pkla
[Allow consolekit]
Identity=unix-group:plugdev
Action=org.freedesktop.upower.suspend;org.freedesktop.consolekit.system.*
#Action=org.freedesktop.consolekit*
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Allow login1]
Identity=unix-group:plugdev
Action=org.freedesktop.login1*
ResultAny=yes
ResultInactive=no
ResultActive=yes
[Allow Upower]
Identity=unix-group:plugdev
Action=org.freedesktop.upower.suspend
ResultAny=yes
ResultInactive=no
ResultActive=yes

# CTRL + X the Y to SAVE

# 2. alternative
# or create rules in /usr/share/polkit-1/rules.d/

  1. $ sudo nano /usr/share/polkit-1/rules.d/10-kodi.rules
polkit.addRule(function(action, subject) {
    polkit.log("action=" + action);
    polkit.log("subject=" + subject);
    if (action.id.indexOf("org.freedesktop.login1.") == 0) {
        return polkit.Result.YES;
    }
    if (action.id.indexOf("org.freedesktop.udisks.") == 0) {
        return polkit.Result.YES;
    }
    if (action.id.indexOf("org.freedesktop.upower.") == 0) {
        return polkit.Result.YES;
    }
});

# CTRL + X the Y to SAVE


# On Raspberry PI 5 / PI 4 check config.txt if HDMI (vc4 kms driver) is enabled

  1. $ sudo nano /boot/firmware/config.txt
# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Additional overlays and parameters are documented
# /boot/firmware/overlays/README

# Automatically load overlays for detected cameras camera_auto_detect=1

# Automatically load overlays for detected DSI displays
display_auto_detect=0

# Automatically load initramfs files, if found
auto_initramfs=1

# Enable DRM VC4 V3D driver 
dtoverlay=vc4-kms-v3d 
max_framebuffers=2

# For MPD users you need to reboot and check with aplay -l if your USB DAC have the same card id number and edit your audio_output configuration accordingly (see the MPD Configuration for more info).


# create kodi service

  1. $ sudo nano /lib/systemd/system/kodi.service
[Unit]
Description = Kodi Media Center
After = remote-fs.target network-online.target
Wants = network-online.target
[Service]
User = pi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = on-abort
RestartSec = 5
[Install]
WantedBy = multi-user.target

# CTRL + X the Y to SAVE

  1. $ sudo systemctl daemon-reload
  1. $ sudo systemctl enable kodi
  1. $ sudo systemctl start kodi
  1. $ sudo systemctl status kodi

# add kodi smb share points (SAMBA must be installed)

# insert lines at the end of conf

  1. $ sudo nano /etc/samba/smb.conf
[kodi]
path = /home/pi/.kodi
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = pi

[userdata]
path = /home/pi/.kodi/userdata
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = pi

# CTRL + X the Y to SAVE

  1. $ sudo systemctl restart smbd
  1. $ sudo reboot

# Adding media source to Kodi


# IMPORTANT NOTICE for Windows network SMB share in Kodi 20
# make sure to configure your NAS with shared folders using SMB v2 or v3 and with
# access to everyone (no user/pass)
# setup KODI SMB service with minimum version SMBv2 and maximum SMBv3
# browse the network from a PC and check if you have a full access to shared
# folders without needing to enter your credential
# then in Kodi create your movies, TV shows, etc. source points (i.e. //MYSERVER/Video ) with
# a dummy username and password (like username: srcmedia and paswd: srckodi)


# OPTIONAL: create Video and TV Shows folders if you store the media on the server (not recommended)

  1. $ cd ~/
  1. $ mkdir Video
  1. $ mkdir "TV Shows"

# setup HDMI CEC

# on raspberry PI HDMI CEC is already managed,
# however some keys of remote control must be adjusted like the back and contextual menu key.
# use the Keymap Editor addon (install it from Kodi repository if it is not already installed) to make your changes in >global>navigation.

# on amd64 platform

# do not forget to add the Pulse Heigh CEC adapter ( https://www.pulse-eight.com ) to be able to use the TV remote control even with the Intel NUC which have a poor CEC implementation.
you may need to deactivate internal IR Receiver and HDMI CEC in Intel NUC Bios.


# install rc6 mce IR remote control with Kodi 20

# by default Kodi manages the RC6 MCE remote control if your usb dongle is installed or the built in extended IR receiver is set in your bios
# you may need to activate internal IR Receiver in Intel NUC Bios.
# unfortunately some essential buttons of the remote control do not work like BACK (KEY_BACK) and OK (KEY_OK) for example. Read the instructions below to fix it.
# open SSH session
# install ir-keytable

  1. $ sudo apt install ir-keytable

# check if remote control is recognized

  1. $ sudo ir-keytable

# result for usb dongle (mceusb)

Found /sys/class/rc/rc0/ with:
        Name: Media Center Ed. eHome Infrared Remote Transceiver (147a:e03e)
        Driver: mceusb
        Default keymap: rc-rc6-mce
        Input device: /dev/input/event6
        LIRC device: /dev/lirc0
        Attached BPF protocols: Operation not supported
        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
        Enabled kernel protocols: lirc rc-6
        bus: 3, vendor/product: 147a:e03e, version: 0x1201
        Repeat delay = 500 ms, repeat period = 125 ms

# example with build IR (cir)

Found /sys/class/rc/rc0/ with:
        Name: ITE8708 CIR transceiver
        Driver: ite-cir
        Default keymap: rc-rc6-mce
        Input device: /dev/input/event4
        LIRC device: /dev/lirc0
        Attached BPF protocols: Operation not supported
        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
        Enabled kernel protocols: lirc rc-6
        bus: 25, vendor/product: 1283:0000, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms

# Important Info are:

 system device: rc0 (Found /sys/class/rc/rc0/)
driver: mceusb or ite-cir
protocol: rc-6

# copy the rc6 mce keymap rc6_mce.toml from /lib/udev/rc_keymaps/ to /etc/rc_keymaps/

  1. $ sudo cp /lib/udev/rc_keymaps/rc6_mce.toml /etc/rc_keymaps/

# edit the keymap to fix it

  1. $ sudo nano /etc/rc_keymaps/rc6_mce.toml

# replace entries 0x800f0412, 0x800f0413, 0x800f0418, 0x800f0422 and 0x800f0423 with:

.
.
0x800f0412 = "KEY_PAGEUP"
0x800f0413 = "KEY_PAGEDOWN"
.
0x800f0418 = "KEY_PLAY"
.
.
0x800f0422 = "KEY_ENTER"
0x800f0423 = "KEY_BACK"

# CTRL+X then Y to save
# edit /etc/rc_maps.cfg to add our custom keymap for mceusb and ite-cir driver

  1. $ sudo nano /etc/rc_maps.cfg

# add these lines at end

mceusb	*			/etc/rc_keymaps/rc6_mce.toml
ite-cir	*			/etc/rc_keymaps/rc6_mce.toml

# CTRL+X then Y to save
# now we are going to create a service to load our keymap at startup

  1. $ sudo nano /etc/systemd/system/rc6mce-ir-keytable.service

# rc-6 protocol and sys/class/rc rc0 is reported and obviously the path to our keymap

[Unit]
Description=RC6 MCE Keymap Fix
After=network.service kodi.service
[Service]
Type=oneshot
ExecStart=/usr/bin/ir-keytable -c -p rc-6 --write=/etc/rc_keymaps/rc6_mce.toml --sysdev=rc0
[Install]
WantedBy=default.target

# CTRL+X then Y to save
# activate the service

  1. $ sudo systemctl enable rc6mce-ir-keytable.service

# start service

  1. $ sudo systemctl start rc6mce-ir-keytable.service

# now the pause, back and OK buttons work and to get info select the item on Kodi and do a long press on OK
# reboot

  1. $ sudo reboot

# to test your remote control or get the correct scancode

  1. $ sudo ir-keytable -t

# Backup / Restore Kodi Data

# backup

  1. $ cd ~/
  2. $ tar cvzf ~/Downloads/"kodi_backup-$(date +'%m-%d-%y').tar.gz" --exclude=.kodi/temp .kodi

# restore

  1. $ cd ~/
  2. $ sudo systemctl stop kodi
  3. $ tar xzvf kodi_backup-xx-xx-xx.tar.gz
  4. $ sudo systemctl start kodi

# UNINSTALL KODI SERVICES

# if for some reason you no longer need the Home Theater service and want to keep the server for the audio system only (in short using it as the MusicLounge server) do the following

  1. $ sudo systemctl stop kodi
  1. $ sudo systemctl disable kodi

# edit /etc/samba/smb.conf to remove or comment SMB Share kodi

  1. $ sudo nano /etc/samba/smb.conf
#[kodi]
#path = /home/pi/.kodi
#read only = no
#public = yes
#writable = yes
#browseable = yes
#guest ok = yes
#create mask = 0777
#directory mask = 0755
#force user = pi

#[userdata]
#path = /home/pi/.kodi/userdata
#read only = no
#public = yes
#writable = yes
#browseable = yes
#guest ok = yes
#create mask = 0777
#directory mask = 0755
#force user = pi

# CTRL + X and Y to save

  1. $ sudo reboot

# you can remove kodi user data and configuration files if needed

  1. $ cd ~/
  2. $ sudo rm -r .kodi

# Congrats! The audiophile server and the Kodi Home Theater are ready

# setup the Kodi SYSTEM > AUDIO > and choose the correct number of speakers
# activate the passthrough to take benefit of Dolby, DTS, trueHD, etc.

TIDAL Connect Installation

For Raspberry PI 5 and PI 4 with bookworm OS and amd64 and odroid platform use an upnp client with Tidal plugin (see upnp renderer tutorial for more info)

# OPTIONAL: install Tidal Connect For Raspberry PI 4 with 32 Bit OS only,

# using your DAC to listen music from Tidal

Tidal Connect is a service similar to Spotify Connect. Using the Tidal app to play a song you can easily click the device selector icon (top right) to select the Musiclounge Streamer audio server.

We are going to install it on MusicLounge Audio Server for Raspberry PI 4 as Tidal connect linux binary seems to be only available on arm 32bit (Raspberry PI). This installation is based on https://github.com/shawa github repo.


# if install pkg ends with error:
# “Failed to start The PHP 7.3 FastCGI Process Manager”
# type the cmd below to create the missing directory:

  1. $ sudo mkdir /var/run/php

# add stretch repo to sources list
# we need to temporary add it to install old libavformat.so.57

# add line:

deb http://archive.raspbian.org/raspbian stretch main
  1. $ sudo nano /etc/apt/sources.list

CTRL+X and y to save

# update pkgs list

  1. $ sudo apt update

# install dependencies

  1. $ sudo apt install -y libavformat57 libportaudio2* libflac++6v5*

# edit again /etc/apt/sources.list to disable (place # to comment) debian stretch repo after the installation of the libs

  1. $ sudo nano /etc/apt/sources.list
#deb http://archive.raspbian.org/raspbian stretch main

# CTRL+X and Y to Save


# install other dependencies

  1. $ sudo curl -k -O -L http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb
  1. $ sudo apt install -y ./libssl1.0.0_1.0.1t-1+deb8u12_armhf.deb
  1. $ sudo curl -k -O -L http://security.debian.org/debian-security/pool/updates/main/c/curl/libcurl3_7.38.0-4+deb8u16_armhf.deb
  1. $ sudo apt install -y ./libcurl3_7.38.0-4+deb8u16_armhf.deb

# create working folder

  1. $ sudo mkdir /usr/ifi

# enter directory

  1. $ cd /usr/ifi

# clone git repo inside the directory

  1. $ sudo git clone https://github.com/shawaj/ifi-tidal-release

# fix file permissions

  1. $ sudo chmod +x /usr/ifi/ifi-tidal-release/play
  1. $ sudo chmod +x /usr/ifi/ifi-tidal-release/bin/tidal_connect_application
  1. $ sudo chmod +x /usr/ifi/ifi-tidal-release/pa_devs/run.sh

# deploy tidal service

  1. $ sudo ./ifi-tidal-release/file-deploy.sh

# get your device name

  1. $ aplay -l

# in this example the USB DAC detected is a Topping D90 MQA on card 1

card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
 ...
card 1: MQA [D90 MQA], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# edit the tidal connect service to update your device name

# change parameter -f and –model-name with Musiclounge Streamer
# if your DAC supports MQA set parameter –codec-mqa and –enable-mqa-passthrough to true
# and change (or add) parameter –playback-device with your USB DAC name followed by “: USB Audio (hw:x,0)”
# x corresponding to the card number: (hw:1,0) for card 1

  1. $ sudo nano /lib/systemd/system/ifi-streamer-tidal-connect.service
[Unit]
Description=RasPi Streamer Tidal Connect Service
[Service]
Restart=on-failure
ExecStart=/usr/ifi/ifi-tidal-release/bin/tidal_connect_application \
                                --tc-certificate-path "/usr/ifi/ifi-tidal-release/id_certificate/IfiAudio_ZenStream.dat" \
                                -f "Musiclounge Streamer" \
                                --codec-mpegh true \
                                --codec-mqa true \
                                --model-name "Musiclounge Streamer" \
                                --disable-app-security false \
                                --disable-web-security false \
                                --enable-mqa-passthrough true \
                                --log-level 3 \
                                --enable-websocket-log "0"
                                --playback-device "D90 MQA: USB Audio (hw:1,0)"

User=root
Group=root
RestartSec=1
KillMode=control-group
[Install]
WantedBy=multi-user.target

# CTRL+X and Y to Save


# start service and check on status

  1. $ sudo systemctl daemon-reload

# enable service at startup

  1. $ sudo systemctl enable ifi-streamer-tidal-connect.service

# start service

  1. $ sudo systemctl start ifi-streamer-tidal-connect.service

# Check the status

# the status is very important to check if the service is enabled and run correctly

# also useful to get the correct name of valid device(s)
# see the instructions above to change the –playback-device parameter

  1. $ sudo systemctl status ifi-streamer-tidal-connect.service

ROON Brigde / Server


# install official ROON brigde/server

  1. $ sudo apt-get update

# make sure curl is installed

  1. $ sudo apt install curl

# install dependency (ffmpeg lib)

  1. $ sudo apt-get install ffmpeg

# setup directory for installation

  1. $ sudo mkdir ~/Downloads/roon_server
  1. $ cd ~/Downloads/roon_server/

# Roon Server x86_64
# all instructions are available here:
# https://help.roonlabs.com/portal/en/kb/articles/linux-install#Easy_Installer
# download script from the website (see above link) or fetch it with curl

  1. $ sudo curl -LO https://download.roonlabs.com/builds/roonserver-installer-linuxx64.sh

# check the script before going further

  1. $ cat roonserver-installer-linuxx64.sh

# change permission

  1. $ sudo chmod +x roonserver-installer-linuxx64.sh

# install

  1. $ sudo ./roonserver-installer-linuxx64.sh

# Roon Bridge x86_64

  1. $ sudo curl -LO http://download.roonlabs.com/builds/roonbridge-installer-linuxx64.sh
  1. $ sudo chmod +x roonbridge-installer-linuxx64.sh
  1. $ sudo ./roonbridge-installer-linuxx64.sh

# Roon Bridge armv7hf (32 bit)

  1. $ sudo curl -LO http://download.roonlabs.com/builds/roonbridge-installer-linuxarmv7hf.sh
  1. $ sudo chmod +x roonbridge-installer-linuxarmv7hf.sh
  1. $ sudo ./roonbridge-installer-linuxarmv7hf.sh

# Roon Bridge armv8 (64 Bit)

  1. $ sudo curl -LO http://download.roonlabs.com/builds/roonbridge-installer-linuxarmv8.sh
  1. $ sudo chmod +x roonbridge-installer-linuxarmv8.sh
  1. $ sudo ./roonbridge-installer-linuxarmv8.sh

# roon is now activated, get the status
# roon server

  1. $ sudo systemctl status roonserver

# roon bridge

  1. $ sudo systemctl status roonbridge

# Log File Location
# If you used the easy installer, log files can be found in `/var/roon/RoonServer/Logs`, `/var/roon/RAATServer/Logs`, and `/var/roon/RoonBridge/Logs`.

# activate or deactivate service
# roon server

  1. $ sudo systemctl enable roonserver
  1. $ sudo systemctl disable roonserver

# roon bridge

  1. $ sudo systemctl enable roonbridge
  1. $ sudo systemctl disable roonbridge

# start, stop, status or restart service
# roon server

  1. $ sudo systemctl start roonserver
  1. $ sudo systemctl stop roonserver
  1. $ sudo systemctl restart roonserver
  1. $ sudo systemctl status roonserver

# roon bridge

  1. $ sudo systemctl start roonbridge
  1. $ sudo systemctl stop roonbridge
  1. $ sudo systemctl restart roonbridge
  1. $ sudo systemctl status roonbridge

# Uninstalling
# You can reverse the steps of the easy installer by running it with ‘uninstall’ as a command line parameter. For example:
# Roon Server x86_64

  1. $ sudo ~/Downloads/roonserver/roonserver-installer-linuxx64.sh uninstall

# Roon Bridge x86_64

  1. $ sudo ~/Downloads/roonserver/roonbridge-installer-linuxx64.sh uninstall

# Roon Bridge armv7hf (32 bit)

  1. $ sudo ~/Downloads/roonserver/roonbridge-installer-linuxarmv7hf.sh uninstall

# Roon Bridge armv8 (64 Bit)

  1. $ sudo ~/Downloads/roonserver/roonbridge-installer-linuxarmv8.sh uninstall

Squeezelite Player


# STEP21

# Add Squeezelite player (outdated emulation of squeezelitebox for using with LMS player)

# using your DAC to listen music from Logitech Media Server or any LMS media player

  1. $ sudo apt-get install squeezelite


# Edit conf. with 2 change only:

# type:

  1. $ sudo nano /etc/default/squeezelite


# SL_NAME="MusicLounge";

# SB_EXTRA_ARGS="-o plughw:1,0"

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

# Activate:

  1. $ sudo systemctl restart squeezelite


# That's it!

# enable/disable service:

  1. $ sudo systemctl enable squeezelite-service



# or

  1. $ sudo systemctl disable squeezelite-service


  1. $ sudo reboot


# More info:
https://github.com/ralph-irving/squeezelite

https://www.mysqueezebox.com/

AirPlay Server


# STEP20

# Add Airplay server (16 bit 44.1 audio only)

# using your DAC to listen music from Apple devices

# We’re going to build the latest ShairportSync project which is the best implementation of airplay today

# building ShairportSync type these cmds:

# get dependencies:

  1. $ sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltoman


# get source:

  1. $ cd ~/Downloads/
  1. $ git clone https://github.com/mikebrady/shairport-sync.git


# build (with alsa):

  1. $ cd shairport-sync


  1. $ autoreconf -i -f


  1. $ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata


# Make and install:

# make

  1. $ sudo make install


# Activate:

  1. $ sudo systemctl enable shairport-sync


# Edit conf. with 2 change only:

# type:

  1. $ sudo nano /etc/shairport-sync.conf


# in general section:

name = "MusicLounge";

# in alsa section:

output_device = "plughw:1,0"

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

# Start:

  1. $ sudo service shairport-sync start

# That's it!


# on AMD64 (Debian 10 buster 64 Bit) if airplay service failed to start with error Failed to start Avahi mDNS/DNS-SD Stack
# then do the following

  1. $ sudo systemctl stop docker
  2. $ sudo systemctl stop docker.socket

# reinstall corrupted lib

  1. $ cd ~/Downloads

# download

  1. $ sudo wget http://ftp.de.debian.org/debian/pool/main/a/avahi/libavahi-core7_0.7-4+deb10u1_amd64.deb

# install:

  1. $ dpkg -i libavahi-core7_0.7-4+deb10u1_amd64.deb
  1. $ sudo apt reinstall avahi-daemon
  1. $ sudo reboot

# Mode info on shairport sync:
https://github.com/mikebrady/shairport-sync-for-openwrt