Replace disk in failed RAID

Failed disk is /dev/sde and new one is /dev/sdh

First copy the partition data from another disk

# sgdisk /dev/sda -R /dev/sdh
#sgdisk -G /dev/sdh

Reread the partition table

# partprobe /dev/sdh

Remove the failed disk

mdadm --manage /dev/md2 --fail /dev/sde1
mdadm --manage /dev/md2 --remove /dev/sde1

Add new disk

mdadm --manage /dev/md2 --add /dev/sdh1

and wait for rebuild

Run ffmpeg on every in a directory

To transcode every file in a directory to h265 (for example):

#!/bin/bash

find . -type f -name '*.mkv' -exec sh -c '
i="$0"
nice /opt/ffmpeg/bin/ffmpeg -i "$i" -map 0 -scodec copy -acodec copy -vf yadif -vcodec libx265 "$i.mkv"
mv "$i.mkv" "$i"
' {} ';'

libreelec wifi connect via command line

To connect libreelec to wifi via the command line

# connmanctl enable wifi
# connmanctl scan wifi
# connmanctl services

Will list known wifi services.


*AO Wired ethernet_001e06365853_cable
*A davids.net.IOT wifi_000f55b13b7e_6461766964732e6e65742e494f54_managed_psk
davids.net wifi_000f55b13b7e_6461766964732e6e6574_managed_psk
davids.net Guest wifi_000f55b13b7e_6461766964732e6e6574204775657374_managed_none

Create an access file in /storage/.cache/connman
eg /storage/.cache/connman/davids.net.IOT.config

[global]
Name = IOT
Description = IOT Wifi service config file

[service_wifi_IOT]
Type = wifi
Name = davids.net.IOT
Passphrase = XXXXXX

or use
SSID =
instead of
Name =
giving the hex code instead of ASCII

Turn off odroid C2 LED at boot

Create a file /storage/.config/system.d/led.service

containing

[Unit]
Description=LED control

[Service]
User=root
Type=forking
ExecStart=bash -c “echo sd > /sys/class/leds/blue\:heartbeat/trigger”
TimeoutSec=0
RemainAfterExit=yes

[Install]
WantedBy=kodi.target

To flash blue led only when sd accessed.

then

# systemctl daemon-reload
# systemctl enable led.service
# systemctl start led.service

Squeezelite and kodi

Install the multimedia-tools in Program add-ons.

Create the following file:


[Unit]
Description=Squeezelite
Requires=network-online.service
After=network-online.service

[Service]
User=root
ExecStart=/storage/.kodi/addons/virtual.multimedia-tools/bin/squeezelite -n LivingRoom -o iec958:CARD=MicroII,DEV=0 -s 10.113.17.28
StartLimitBurst=10
StartLimitInterval=10m
Restart=always
RestartSec=5

[Install]
WantedBy=kodi.target

 

Adding appropriate options for squeezelite

Lirc and Mythtv with Debian buster

Configuring MCE remote with Debian buster using lirc 0.10.

General configuration from http://lirc.sourceforge.net/lirc.org/html/index.html.

Install and enable lirc

apt-get install lirc
systemctl enable lirc

/etc/lirc/lirc_options.conf should have

driver = default

Copy the mse remote control definition over

cp /usr/share/lirc/remotes/mceusb/lircd.conf.mceusb /etc/lirc/lircd.conf.d/mceusb.lircd.conf

restart lirc

systemctl restart lirc

$ mode2 --driver default --device /dev/lirc0
Using driver default on device /dev/lirc0
Trying device: /dev/lirc0
Using device: /dev/lirc0

And test with remove keypresses to see if anything is output.

Run irw and test (pressing OK should give):

$ irw
000000037ff07bdd 00 KEY_OK mceusb

Then create mythtv file for keymappings as in http://git.netscum.org.uk/stefan/mythtv_remote/src/master/mythtv in ~/.lircrc

Pressing OK on the remote while running ircat should now give:

$ ircat mythtv
Space

And it should work with mythtv