Mittwoch, 2. Februar 2022

Debian on WD My Cloud Home single-bay (MCH) - part 4 (wrapping things up)

The recent GPL source release by WD brought some improvement to the RTC and Watchdog driver. (The updated part 2 shows how to compile and install the new kernel.)

Initially I was hoping for the RTC to be able to wakeup the device from suspend to RAM. But after looking at the board more closely, there's no backup battery to be found. So even if the device sports a RTC it's useless if it doesn't keep counting when there is no power.

In fact it turns out that the RTC driver is simply writing the current time to some flash, very similar to the FakeHWclock package in most Linux distros.

Together with the "working" RTC driver there comes a now fixed watchdog kernel driver. It turns out, once RTC is working the watchdog loads automatically (even if compiled as module) and starts doing what it's supposed to do. In this case it reboots the box after 120 seconds :D

From reading the source code this is what I came to understand how the watchdog works:

  • Instead of creating a /dev/watchdog device a /proc/watchdog entry is created.
  • As soon as the module loads the initial timer of 120s starts.
 You can issue the following commands to control the watchdog
  • echo disable > /proc/watchdog # disable watchdog
  • echo enable > /proc/watchdog # enable watchdog
  • echo kick > /proc/watchdog # keep watchdog alive - trigger time will be set to 20s!!!
  • echo <msec number> > /proc/watchdog # keep watchdog alive and set trigger time to <msec number>

Obviously this does not conform to any existing watchdog daemons. So one would have to write a script like:

while [ true ] ; do
    echo kick > /proc/watchdog
    sleep 10

If  you really want to use a watchdog enabled kernel you can use this .config file.

Apart from the watchdog oddities RAH-66 mentioned an important sysctl setting to mute all syscalls not implemented in the kernel. You would be getting a lagging system otherwise. (the C-library takes care of the syscalls and redirects them appropriately. Especially systemd tries to use the latest kernel syscalls :D )

echo "debug.exception-trace=0" > /etc/sysctl.d/99-disable-syscall-traces.conf

I also finally found out how to access the uBoot arguments. They are written as a tar directly onto the mtd0 partition.

cd /
dd if=/dev/mtd0 bs=1 count=9216 skip=98304 | tar x
cat /tmp/factory/env.txt

In theory we might be able to dd a modified env.txt back onto mtd0 - great potential to mess up the boot ;)

3 Kommentare:

  1. Would it be possible to run Debian Bullseye with kernel 5 and OMV6?

    1. This blog wouldn't exist if any kernel would be available to be installed ;)
      I am running bullseye on it with the custom kernel. Don't know about OMV though...

  2. Hello i've just seen taht from that new upgrade embeed kernel ('Updated Linux Kernel to 4.9.266') arch seem to be splitted in 2 versions pelican & monarch (duo & single ?) just donwloaded it will update if success