RPi + HAT or....

Ha, this is what I was looking for. I think you had pointed this out earlier too and I did it before the downgrade but I could not remember what I did. Thank you :) .

Will try in the evening.
Earlier it was for granting permission and it was in the security & privacy settings. But the screen looks exactly the same for adding startup items
 
@Subbu68 Since you are using mojave, you can use apple's own software, itunes to play the music and install the android app retune to control everything from the phone. I tried this today and it works flawlessly, unlike squeezelite on mac which fails to get control of the audio device.

You have to pair retune to your mac mini once
 
Last edited:
There is no way to convert. You will need another spare disk to copy. But on any linux system, avoid ntfs. The driver written on linux was actually reverse engineered and has extremely poor performance because it runs in user space. There is a newer driver written by paragon, but I think it is still not there in mainline.

Also an official driver for exfat might make it into the linux kernel. But the current driver also works fine and is quite fast.
At last converted all partition to Exfat, using exfat-fuse drivers and added the following line for fstab.
exfat defaults,rw,noatime,nofail,uid=1000,gid=1000,umask=0000 0 2
After every reboot mount these filesystem takes a bit longer due to filesystem checking and this was causing mpd to die, I have added the following line to mpd.service file

After=network.target sound.target Music-ENGLISH.mount Music-HINDI.mount Music-REGIONAL.mount

[Service]
Type=notify
EnvironmentFile=/etc/default/mpd
#ExecStart=/usr/bin/mpd --no-daemon $MPDCONF
ExecStart=/usr/bin/chrt 99 /usr/bin/mpd --no-daemon $MPDCONF
SupplementaryGroups=audio
TimeoutStartSec=600

# Enable this setting to ask systemd to watch over MPD, see
# systemd.service(5). This is disabled by default because it causes
# periodic wakeups which are unnecessary if MPD is not playing.
#WatchdogSec=120

# allow MPD to use real-time priority 40
LimitRTPRIO=50
LimitRTTIME=infinity

However mpd gives a timeout sometimes..
By the way I got the PREEMP_RT kernel up and running in both pi2aes and usbridge with debain bullseye
 
At last converted all partition to Exfat, using exfat-fuse drivers and added the following line for fstab.
exfat defaults,rw,noatime,nofail,uid=1000,gid=1000,umask=0000 0 2
After every reboot mount these filesystem takes a bit longer due to filesystem checking and this was causing mpd to die, I have added the following line to mpd.service file
I'm surprised by this. I don't use exfat, but I thought exfat is so simple, without much recovery capability, no journaling and hence filesystem check should be fast. Let me check this out
After=network.target sound.target Music-ENGLISH.mount Music-HINDI.mount Music-REGIONAL.mount
This doesn't mean that mpd will get started after the disks get mounted. It just means that the command to start mpd service will be issued after command to mount the disks.

It is for this reason, I start mpd using my own software, using daemontools and start mpd using daemontools instead of systemd.

What you can do is write a script, something like this (i'm assuming that there is a file named some_file in the mounted disk
Name this script as /usr/bin/mpd_script and call this script in mpd.service. i.e. replace
ExecStart=/usr/bin/chrt 99 /usr/bin/mpd --no-daemon $MPDCONF
with
ExecStart=/usr/bin/chrt 99 /usr/bin/mpd_script --no-daemon $MPDCONF
chmod +x /usr/bin/mpd_script

and /usr/bin/mpd_script will be something like this. It will break out of the loop only when the 2 disks get mounted and only then mpd will be started. And mpd will not timeout because the disks would be already mounted

#!/bin/sh
while true
do
flag=0
ls -ld /mnt/Music-English/some_file > /dev/null 2>&1
if [ $? -ne 0 ] ; then
flag=1
fi
ls -ld /mnt/Music-Hindi/some_file > /dev/null 2>&1
if [ $? -ne 0 ] ; then
flag=1
fi
if [ $flag -eq 0 ] ; then
break
fi
sleep 5
done
exec /usr/bin/mpd $*
 
Last edited:
Instead of using mount.target use local-fs.target and RequiresMountsFor=disk1. You can give multiple RequireMountsFor. I think that should work. This is my /lib/systemd/system/mpd.service.d/override.conf
on one of my PIs
1656346336895.png
 
Instead of using mount.target use local-fs.target and RequiresMountsFor=disk1. You can give multiple RequireMountsFor. I think that should work. This is my /lib/systemd/system/mpd.service.d/override.conf
on one of my PIs
View attachment 70329
Let me try both the options.. the following are from syslog during exfat mounting..
Jun 27 20:33:34 pi2aes systemd-fsck[760]: exfatfsck 1.3.0
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Checking file system on /dev/sda2.
Jun 27 20:33:34 pi2aes systemd-fsck[760]: File system version 1.0
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Sector size 512 bytes
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Cluster size 512 KB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Volume size 1773 GB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Used space 844 GB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Available space 929 GB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Totally 2832 directories and 26702 files.
Jun 27 20:33:34 pi2aes systemd-fsck[760]: File system checking finished. No errors found.
Jun 27 20:33:34 pi2aes systemd[1]: Finished File System Check on /dev/sda2.
Jun 27 20:33:34 pi2aes systemd[1]: Mounting /Music/HINDI...
Jun 27 20:33:35 pi2aes systemd[1]: Mounted /Music/HINDI.
 
Let me try both the options.. the following are from syslog during exfat mounting..
Jun 27 20:33:34 pi2aes systemd-fsck[760]: exfatfsck 1.3.0
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Checking file system on /dev/sda2.
Jun 27 20:33:34 pi2aes systemd-fsck[760]: File system version 1.0
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Sector size 512 bytes
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Cluster size 512 KB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Volume size 1773 GB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Used space 844 GB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Available space 929 GB
Jun 27 20:33:34 pi2aes systemd-fsck[760]: Totally 2832 directories and 26702 files.
Jun 27 20:33:34 pi2aes systemd-fsck[760]: File system checking finished. No errors found.
Jun 27 20:33:34 pi2aes systemd[1]: Finished File System Check on /dev/sda2.
Jun 27 20:33:34 pi2aes systemd[1]: Mounting /Music/HINDI...
Jun 27 20:33:35 pi2aes systemd[1]: Mounted /Music/HINDI.
It has completed less than a second. What is happening is that mpd is starting faster than the fsck, even though the mount command was given before the command to start mpd.
Just use
RequiresMountsFor=/Music/HINDI
RequiresMountsFor=/Music/ENGLISH
RequiresMountsFor=/Music/REGIONAL
and any other mounts
 
It has completed less than a second. What is happening is that mpd is starting faster than the fsck, even though the mount command was given before the command to start mpd.
Just use
RequiresMountsFor=/Music/HINDI
RequiresMountsFor=/Music/ENGLISH
RequiresMountsFor=/Music/REGIONAL
and any other mounts
Did that yet to reboot..
 
Did that yet to reboot..
There is a command that you can run which shows how much time a service took to startup
# systemd-analyze blame
2min 8.092s dkms.service
7.272s plymouth-quit-wait.service
5.570s NetworkManager-wait-online.service
5.309s akmods.service
5.027s [email protected]
4.796s [email protected]
4.016s initrd-switch-root.service
3.943s smartd.service
3.845s udisks2.service
3.465s php-fpm.service
3.071s dracut-initqueue.service
3.066s polkit.service
3.064s power-profiles-daemon.service
2.898s cups.service
2.108s firewalld.service
2.046s lvm2-monitor.service
2.022s systemd-udev-settle.service
1.796s systemd-tmpfiles-setup.service
 
There is a command that you can run which shows how much time a service took to startup
# systemd-analyze blame
Ok, also exfat not working with nfs now with samba but that seems to have some slowness while playing from mpd client
 
Ok, also exfat not working with nfs now with samba but that seems to have some slowness while playing from mpd client
Are you having RT kernel on the nfs and the samba server?
The Linux kernel provides a high-performance networking subsystem by processing packets in softIRQ contexts. The network drivers use the so called “New API” (NAPI), according to which a hard-IRQ handler just disables the NIC interrupts and triggers a NET RX soft-IRQ, which will receive the packets from the NIC and process them. If the number of network packets on the NIC is less than a specified threshold, the NIC interrupts are re-enabled, otherwise they are kept disabled and the soft-IRQ is armed again. This implements an interrupt mitigation mechanism that improves the throughput in presence of high packet rates. The Preempt-RT patch transforms hard-IRQ handlers in kernel threads, in order to improve the system’s determinism and reduce the kernel latencies. However, as usual there is a duality between high throughput and low latencies, and the threaded IRQ architecture risks to decrease the network performance.
 
Are you having RT kernel on the nfs and the samba server?
Yes

pi@usbridge:/Music/REGIONAL $ uname -a
Linux usbridge 5.15.40-rt43-v8+ #1 SMP PREEMPT_RT Sat May 21 09:35:30 BST 2022 aarch64 GNU/Linux
pi@usbridge:/Music/REGIONAL $
 
Yes

pi@usbridge:/Music/REGIONAL $ uname -a
Linux usbridge 5.15.40-rt43-v8+ #1 SMP PREEMPT_RT Sat May 21 09:35:30 BST 2022 aarch64 GNU/Linux
pi@usbridge:/Music/REGIONAL $
What is the load on the usbridge. These arm devices are low powered and RPI3 is much worse than RPI4 and you are running RT kernel.
What is the load on the usbridge when you are playing music? You can either use top or the uptime command
 
What is the load on the usbridge. These arm devices are low powered and RPI3 is much worse than RPI4 and you are running RT kernel.
What is the load on the usbridge when you are playing music? You can either use top or the uptime command
pi@usbridge:/Music/REGIONAL $ uptime
00:17:28 up 11 min, 2 users, load average: 0.39, 0.32, 0.21
pi@usbridge:/Music/REGIONAL $


top - 00:16:55 up 11 min, 2 users, load average: 0.20, 0.27, 0.20
Tasks: 154 total, 3 running, 151 sleeping, 0 stopped, 0 zombie
%Cpu(s): 27.6 us, 7.9 sy, 0.0 ni, 64.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 910.3 total, 541.7 free, 94.4 used, 274.2 buff/cache
MiB Swap: 100.0 total, 100.0 free, 0.0 used. 760.9 avail Mem
 
pi@usbridge:/Music/REGIONAL $ uptime
00:17:28 up 11 min, 2 users, load average: 0.39, 0.32, 0.21
pi@usbridge:/Music/REGIONAL $


top - 00:16:55 up 11 min, 2 users, load average: 0.20, 0.27, 0.20
Tasks: 154 total, 3 running, 151 sleeping, 0 stopped, 0 zombie
%Cpu(s): 27.6 us, 7.9 sy, 0.0 ni, 64.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 910.3 total, 541.7 free, 94.4 used, 274.2 buff/cache
MiB Swap: 100.0 total, 100.0 free, 0.0 used. 760.9 avail Mem
The usbridge isn't starved. That's sure because it is just 0.0 wa so problem is somewhere else. See if running mpd with normal priority helps
 
@jmascreen You. can do 2 things on the RPI4 which has the pi2aes
1. Run mpd without rt priority. This will improve the network performance
2. Run mpd with RT priority but connect the hard disk directly
 
Order your Rega Turntables & Amplifiers from HiFiMART.com - India's reputed online dealer.
Back
Top