User Tools

Site Tools


doc:appunti:hardware:mini_pc_with_das

Mini PC T9Plus with D4-300 TerraMaster DAS

Installing Debian GNU/Linux

It seems that Linux kernel 6.1.0 (as shipped with Debian 12 Bookworm) still does not support the WiFi adapter RTL8852BE.

The RGB rainbow LEDs

The T9Plus Mini PC has a strip of RGB LEDs all around the case; the default behaviour is to play a circular rainbow effect, rather nice the first time that you see it, but utterly annoing after a couple of hours!

You can program the LEDs with several visual effects, brigthness and speed by sending some specific commands to the USB serial adapter exposed to the operating system. The manufacturer provides a Windows program to configure the LEDs, but several users on the internet reported that the program (named LedControl.exe) is detected as a malware by several antivirus software. I never run MS-Windows on this PC because I booted and installed Debian GNU/Linux since the very first boot, so I cannot give any insight on it.

Fortunately enough, someone made the reverse engineering of the serial protocol required by the LEDs controller and published a working code. Then I wrote a Python program to make the programming: Mini PC T9Plus RGB LED Control Program.

In Debian GNU/Linux 12 it is possibile to run the script at bootstrap; just add a Systemd unit creating the file /etc/systemd/system/t9plus-leds.service with:

# /etc/systemd/system/t9plus-leds.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/t9plus-leds -m Off
[Install]
WantedBy=multi-user.target

Run and enable the service issuing the command:

systemctl daemon-reload
systemctl enable t9plus-leds.service --now

Reboot problem

Sometimes (randomly, about 50% of the time) the reboot command does not work. The shutdown process seems to proceed well and the PC seems to begin the reboot process, but the video signal does not switch-on and the host remains frozen.

The D4-300 USB attacched storage

Outpt of the lsusb command:

Bus 002 Device 004: ID 174c:55aa ASMedia Technology Inc.
  ASM1051E SATA 6Gb/s bridge,
  ASM1053E SATA 6Gb/s bridge,
  ASM1153 SATA 3Gb/s bridge,
  ASM1153E SATA 6Gb/s bridge
Bus 002 Device 003: ID 174c:55aa ASMedia Technology Inc.
  ASM1051E SATA 6Gb/s bridge,
  ASM1053E SATA 6Gb/s bridge,
  ASM1153 SATA 3Gb/s bridge,
  ASM1153E SATA 6Gb/s bridge
...

Outpt of the lsusb -t command:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=uas, 5000M
        |__ Port 4: Dev 4, If 0, Class=Mass Storage, Driver=uas, 5000M
...

Performance

Power management

Monitoring SMART with Nagios/Icinga

Unfortunately the check_ide_smart Nagios plugin provided by the Debian 12 package monitoring-plugins-basic 2.3.3-5+deb12u2, is unable to scan the SMART attributes of the SATA drives through the Terramaster Direct Attached Storage. As reported into the Nagios-plugins issue #16, the check_ide_smart plugin should be phased out in favor of check_scsi_smart.

We compiled the plugin binary from the sources (using the master branch 064a9fd) and now we can check the SMART attributes of each disk into the DAS:

check_scsi_smart -d /dev/sdb
OK: prdfail 0, advisory 0, critical 0, warning 0, logs 0 | 1_read_error_rate=0;;;; 3_spin_up_time=3883;;;; 4_start_stop_count=26;;;; 5_reallocated_sectors_count=0;;;; 7_seek_error_rate=0;;;; 9_power_on_hours=19301;;;; 10_spin_retry_count=0;;;; 11_recalibration_retries=0;;;; 12_power_cycle_count=17;;;; 192_power_off_retract_count=5;;;; 193_load_cycle_count=49;;;; 194_temperature=32;;;; 196_reallocation_event_count=0;;;; 197_current_pending_sector_count=0;;;; 198_uncorrectable_sector_count=0;;;; 199_ultradma_crc_error_count=0;;;; 200_multi_zone_error_rate=0;;;;

To integrate the SMART checks for all the devices into a single Nagios check and to have a more terse output, we created the following script check_scsi_smart_all:

#!/bin/sh
if [ "$#" -lt "1" ]; then
    echo "Usage: $(basename $0) sda [sdb ...]"
    exit 1
fi
OUTPUT=''
STATE=0
for DEV in $@; do
    OUT="$(/usr/local/sbin/check_scsi_smart -d /dev/$DEV)"
    RET=$?
    if [ $RET -gt $STATE ]; then
        STATE=$RET
    fi
    if [ "$RET" -eq "0" ]; then
        # Get only the short status, e.g. "OK".
        OUT="$(echo "$OUT" | cut -f1 -d':')"
    else
        # Get the summary, e.g. "OK: prdfail 0, advisory 0, critical 0, warning 0, logs 1 "
        OUT="$(echo "$OUT" | cut -f1 -d'|' | sed 's/[[:space:]]\+$//')"
    fi
    test -n "$OUTPUT" && OUTPUT="${OUTPUT}; "
    OUTPUT="${OUTPUT}${DEV}: ${OUT}"
done
 
OUTPUT="check_ide_smart[${OUTPUT}]"
case $STATE in
    0)
        OUTPUT="OK: $OUTPUT"
        ;;
    1)
        OUTPUT="WARNING: $OUTPUT"
        ;;
    2)
        OUTPUT="CRITICAL: $OUTPUT"
        ;;
    *)
        OUTPUT="UNKNOWN: $OUTPUT"
        ;;
esac
echo "$OUTPUT"
exit $STATE

Finally we defined the NRPE Nagios check with a line into /etc/nagios/nrpe_local.cfg:

command[check_scsi_smart]=/usr/bin/sudo /usr/local/sbin/check_scsi_smart_all sda sdb sdc

Web References

doc/appunti/hardware/mini_pc_with_das.txt · Last modified: 2024/04/17 11:03 by niccolo