Docs

added scheduling policy on raspocii and on odroid-darkice

documentation is hard to find: on linux debian derivates like ubuntu and raspbian one should create a conf file in /etc/systemd/system in a new directory named user@.service.d. name the .conf file anything you want like local.conf.

content :

[service]

AmbientCapabilties=CAP_SYS_NICE

now CPUSchedulingPolicy=fifo and CPUSchedulingPriority=4 can be used in user service files.

see also  linux stack exchange

 

problems (of course)

solved a recurring openvpn problem :

So the VPN in general is working fine (routing is fine, because I can reach my local openvpnserver, resolving public domains is working fine as well (e.g. google.com), but it seems systemd-resolved (or maybe something else?) does not take into account the address I set  as DNS service.

Mark “Use this connection only for resources on its network” (IPv4 and IPv6 tabs).

Disable Automatic DNS and set 10.10.10.10 as DNS in IPv4 tab.

Run nmcli connection modify <VPN-connection-name> ipv4.dns-search ~.

Verify resolvectl shows correct DNS server and domain for tun0 (or similar) link:

$ resolvectl
[...]
Link 21 (tun0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 10.10.10.10
       DNS Servers: 10.10.10.10
        DNS Domain: ~.

modules could not be loaded due to mismatch between kernel version and modules version. 

solved by reinstalling  using find and replace in /lib/mdules/kernel-version 

apt-get -d –reinstall install $(dpkg -S /lib/modules/5.4.241-417 | tr ‘,:’ ‘\n\n’ | head -n -1)

 

Darkice runs on an odroid xu4

Device: Odroid XU4
Chip: Samsung Exynos 5422
CPU: 4x Cortex A7 1.4 GHz
4x Cortex A15 2.0 GHz
GPU: Mali-T628 MP6

+—+———+———+———+———+
A7 | 0.8 GHz | 0.8 GHz | 0.7 GHz | 0.5 GHz |
+—+———+———+———x———+
A15 | 1.1 GHz | 1.1 GHz | 0.6 GHz | 0.8 GHz |
| | 45 ℃ | 46 ℃ | 49 ℃ | 47 ℃ |
+—+———+———+———x———+
GPU | 41 ℃ |
+—+—————————————+

odroid@odroid-darkice:~$ hostnamectl
Static hostname: odroid-darkice
Icon name: xu4
Machine ID 
Boot ID
Operating System: Ubuntu 22.04.2 LTS
Kernel: Linux 5.4.236-414
Architecture: arm

also changed the hard disk that was attached to a somewhat bigger ssd: 2Tb instead of 1.5 Tb.

oidroid xu4 has two usb 3.0 ports, one usb 2.0 port  and an 1 G.b Ethernet port. The system running is ubuntu 222.04, consuming nothing much on the  eight cores  of the odroid which really is overkill but guarantees a much better throughput to the icecast server. . It uses even less energy than the pi 3 b+ we used before. Disabled ipv6. Governor set to ondemand.

the odroid xu4 boots from its sd-card and then loads roots on sda2 . 

 


playlist patapoe

Has a new ssd , 500 GB , so twice as much as before.

we also changed from pi os bullseye 32 bits to bullseye 64 bits..

Had to modify the user’s crontab.

export “$(strings /proc/”$(pidof audacious)”/environ | grep DBUS_SESSION_BUS_ADDRESS)”; export XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0

Notice that XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0 had to be added!

A  backup is made weekly to /media/nfsbackup. That disk is located on a disk connected to the darkice odroid (no offsite backup)… Beware: we backup only essential files,  see /home/patapoe/exlude-from-backup.txt


server radiopatapoe.nl

radiopatapoe.nl and newly added alias www.radiopatapoe.nl now use  hsts

Darkice now uses pulse 

to be able to control input level and uses systemd as user. To accomplish the connection to pulseaudio I used a darkice.timer that waits 1 minute and then starts the disabled (!) darkice.service. Both are located in the .config/user/systemd directory.

darkice pi now Runs on a pi 3b+ and is upgraded to bullseye 32 bits

in cmdline.txt added  dwc_otg.speed=1 to circumvent bug in usb 2.0

live stream via mobile

For androids cool mic is available in google’s AppStore. You need to enter following in settings:
Server: cast.radiopatapoe.nl:80
Username (ask 0d0a at itent.nl
Password idem
Mountpoint idem

The stream is in ogg format so on the server it will be converted with ffmpeg to cast.radiopatapoe.nl/transit.
Beware: as the live stream is not in the cascade the stream will interrupt the running cast !

migrated streams 

Streams are now available over port 80 and 443 at http(s) cast.radiopatapoe.nl

added a new ipv4 and a new ipv6 adress on the server to have webserver and icecast both on either http or https. LInks on the webpage are now working

php updated to 7.4

 

Certificates for both icecast and apache2 are updated automagically every two months

 

problems with podcastgenerator 2.6

were due to getid3 throwing php errors. Needed to upgrade getid3 too. Thanks to igorzharii who posted the solution on his blog

Icecast, Darkice, Mountpoints, backup

Mountpoints

Mountpoints patapoe.mp3 en patapoe.aac zijn op een raspberrypi 3 in de Patapoe studio gedefinieerd. met ivm USB-problemen in de /boot/cmdline.txt opgenomen fiq_fsm_mask=0x5

Darkice updated to version 1.4 on february 21 2020

note: no comments after password in /etc/darkice.cfg!!!!

usb wordt met de nieuwe raspberry pi 3b plus niet meer gebruikt voor de audio.

In plaats daarvan is  de raspberry pi van een  audioinjector hat voorzien .

Darkice is op Zat, 04 Jan 2020 om 09:38:33 +0100 opnieuw gestart.

Darkice Server rebooted at monday, 06 Jan 2020 07:22:42 +0100

Darkice os updated from stretch to buster on 09 jan 2020 13:42 using dist-upgrade

server rebooted at friday jan-17-2020 at about 17:05 (changed nfs-server config on raspberrypi4 to have the tar backups on an 1 terabyte hdd (only accessable for root at /mnt/extern-usb3/backup which for the server at contabo is an nfs share at /var/bakups…)

foutje in client.conf openvpn opgelost.. darkice rebooted zaterdag 18 januari 2020 rond 10:30… sshd op de server radiopatapoe.nl luistert alleen nog op de vpn verbinding. Ivm hiermee  mbv /etc/rc.local de service ssh bij booten laten herstarten na 20 seconden slaap.

 patapoe.mp3 is het eindpunt van een zogenaamde cascade. De cascade is gedefineerd als de volgorde waarin bepaald wordt met welke stream de luisteraars verbonden zijn als die luisteraars verbinden met https://radiopatapoe.nl:80/transit . Transit is het beginpunt van de cascade. Als dit mountpoint actief is, luistert men naar deze stream, ook als er andere streams actief zijn.

patapoe.mp3 heeft, als de raspberry pi 3 waarop Darkice draait niet functioneert, een fallback naar /backup, een localmount van een Relay naar dfm.

in de studio van radio Patapoe draait behalve de raspberry pi 3 met Darkice ook de playlist pc.

de playlist op deze pc wordt middels twee crontab entries gestopt om 15:30H en weer gestart om 16:00H. Tijdens dit half uur draait mplayer de maandelijks door vittek aangeleverde mp3’s.

op de playlist pc draait ook een Shell script (songchange.sh) dat de output van de audacious plug-in Song Change verwerkt en doorgeeft aan title.php dat de verwerkte gegevens (/tmp/output.txt) doorgeeft aan de icecast server gehost door contabo (dld).

Incrontab

Gebruikt inotify om de weergave van veranderingen in /tmp/output.txt door te geven. (tmp/output.txt IN_MODIFY /usr/local/bin/songchange.sh 2>&1)

in songchange.sh toegevoegd killall tail. Proces tail wordt niet gekilled. Bekende bug van incron… nog een bug verholpen: incron startte niet na een reboot ondanks een entry in /etc/rc.local die de service had moeten restarten.. entry verplaatst naar crontab van Root (@reboot sleep 60; /etc/init.d/incron restart ..l

aanpassing in crontab bij live uitzendingen

sommige live uitzendingen vanuit de studio maken ook gebruik van de playlist pc.

Om ervoor te zorgen dat de titel van de uitzending hierdoor NIET verandert,  wordt vlak voor de uitzending de titel van het programma in /tmp/output.txt gezet en wordt /tmp/output.txt op read only gezet.

 

op de contabo server draait behalve icecast ook de webserver van radiopatapoe:https://radiopatapoe.nl

Mounts via handheld devices (iPhones, Android )

worden als .ogg gemount (oudere handhelds (ipad2 o.a.) ondersteunen geen mp3) en via local mount /iPad.ogg naar mp3 getranscodeerd door Ffmpeg. Dit programma wordt in starttrans.sh aangeroepen. In StreamTranscoder-0.cfg wordt /iPad.ogg gedefinieerd als bron en /transit als doel.

occii events live streamed

technische setup

(je kunt ook gewoon naar https://cast.radiopatapoe.nl:80/transit gaan, draait daar een ander live programma dan ga je voor de occii stream naar http://cast.radiopatapoe.nl:80/silent

 

Na aanschaf raspberrypi3 en een Behringer 202 de apparaten op de mixer in occii aangesloten.

Een aantal software aanpassingen op raspoccii (de combinatie raspberrypi3 + Behringer 202) gedaan:

Tweedelig node.js programmaatjes geschreven om stilte op de stream te detecteren: occiidown.js en occiiup.js. occiidown luistert naar stream occii en roept occiidown.sh aan. occiidown.sh stopt het lopende darkice proces en mount mountpoint silent. Occiiup.js luistert naar dit mountpoint en stopt het lopende darkice proces en mount occii als er geluid gedetecteerd wordt door het aanroepen van occii.sh. Met dank aan Steve Barbera voor zijn volume detection programma.

Pm2 draait bovenstaande processen (ook na een reboot)…
om ervoor te zorgen dat mountpoint NIET meedraait in de icecast cascade (er zou dan altijd geluid gedetecteerd worden op de stream, ook als occii zelf niet actief is), een icecastmetocciiincascade.xml en een icecastzonderoccii.xml gemaakt. icecastzonderoccii.xml wordt in het occiistpml shell script op de icecast server (artikel-140.nl) bij het stoppen van de occii stream gekopieerd naar icecast.xml en het icecastmetocciiincascade.xml bij het starten van de occii stream ..Uiteraard dient de icecast.xml dan opnieuw geladen worden. Ook dit gebeurt in de shell scripts.

finetuning

aanpassing van gebruiker icecast2:

icecast2 ALL=NOPASSWD:/etc/init.d/icecast2 force-reload

Kopiëren vanuit willekeurige directory:

(cd /etc/icecast2 && cp icecastzonderoccii.xml icecast.xml) cq (cd /etc/icecast2 && cp icecastmetocciiincascade.xml icecast.xml)

en tot slot icecast2 een wachtwoord gegeven.

crontab voor gebruiker pi op raspoccii aangepast met start en stop regels voor de tijden waarop live uitgezonden wordt (pm2 stop all en pm2 update); ook in deze crontab een @reboot regel waarin Shell script occiidown wordt gestart. In dit script wordt darkice met silent.cfg aangezet

03-12-2023

operating system upgraded van buster naar bullseye

systemctl —user gebruikt dbus dus shell script pm2stop.sh aangepast:

XDG_RUNTIME_DIR=/run/user/$(id -u)
DBUS_SESSION_BUS_ADDRESS=unix:path=${XDG_RUNTIME_DIR}/bus
export DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR

21-10-2018

crontab op raspoccii aangepast zodat mountpoint liveoccii gemount wordt als er  live uitzendingen vanuit radio Patapoe zelf geprogrammeerd zijn. Op de Schedule pagina een link naar dit mountpoint gemaakt zodat luisteraars kunnen kiezen.

16-10-2018

In het kader van bezuiniging op stroom is de volgende wijziging doorgevoerd.

De mixer staat uit als er geen live-uitzending vanuit de studio is. Bezuinging van ongeveer 400 Watt/uur!

Om de playlist buiten de mixer om te streamen is er nu een nieuwe verbinding line-out van de playlist pc naar de Behringer 202 via een audioswitch.

Achterop de playlist pc zit een Y-plug op de lineout. Vanaf deze Y-plug lopen twee kabeltjes naar een 2 ports tulp in 1port tulp out audioswitch.

Een input port is verbonden met de playlist pc, de andere input port is verbonden met de output van de mixer. (De playlist is normalerwijze een input op de mixer)

De output van de audioswitch gaat naar de Behringer 202 usb audio kaart die de stream met audio verzorgt.

Er zijn twee situaties denkbaar:

1 Je gebruikt de playlist pc niet tijdens je cast.

Dan zet je de mixer aan en schakel je de audioswitch op 1.

Ben je klaar met casten schakel je de audioswitch op 2 en zet je de mixer uit!

2 Je gebruikt de playlist tijdens de cast.

Dan zet je de mixer aan en laat je de audioswitch op 2.

Ben je klaar met casten zet je de mixer uit!

De schakelaar van de mixer zit op de voeding die links naast de mixer ligt.

Happy casting!

Backup

  • Op de server schrijft  rsnapshot gescheduled naar /var/cache/rsnapshot  de directories /etc, /var/www/html en /usr/local/bin. Schema is alpha, beta,  gamma delta. Retain alpha 6,
    retain beta 7 , retain gamma 4 retain delta 3. Dus  zes backups per dag met een  vier uur interval [alpha], zeven dagelijkse  backups [beta], en vier  wekelijkse backups [gamma] en drie maandelijkse backups [delta].  Uitgesloten zijn 20*-*.mp3 en 20**-*.xml (dat zijn podcasts die sowieso om de 14 dagen gewist worden).

rsnaptar schrijft de delta.0  maandelijks naar /var/bakups, een nfs verbinding naar een off-site locatie bekend bij 0d0a d.m.v.  shellscript rsnaptar in /etc/cron.monthly.

mysql database backup wordt om de paar dagen per mail (adres bekend bij 0d0a) in zipvorm door wpsecurity gestuurd. 
P.S. op een harde schijf gemount op odroid-Ubuntu staat een qemu image van radiopatapoe van voor de overgang van stichting artikel-140 naar de huidige provider..

darkice

draait nu met een systemd script ipv opnde oude /etc/init.d manier

[Unit]
Description=DarkIce live audio streamer
After=icecast.service
Wants=icecast.service

[Service]
Restart=always
RestartSec=3
ExecStart=/usr/local/bin/darkice -c /etc/darkice.cfg
ExecStop=/usr/bin/pkill darkice

CPUSchedulingPolicy=fifo
CPUSchedulingPriority=4

[Install]

WantedBy=multi-user.target

Stream backup

Mochten streams niet werken, dan luistert men naar een backup stream die extern draait op tent.xs4all.nl.  Programmering van deze stream is een link naar een 24 uurs backup op een nfs-schijf van de playlist pc in de studio.

 

 

 

Leave a Reply

Your email address will not be published.