Use Mikrotik Woobm with Raspberry Pi

Mikrotik Woobm (https://mikrotik.com/product/woobm) is a device providing out of band management to Mikrotik Routerboard having USB port. The device can also be used with any linux system to provide out of band management in the same manner.

In this article, a Raspberry Pi will be used as an example. The goal is to start a serial terminal server when the Woobm is plugged in and stop the service when Woobm is removed.

woobm 2020 package

Steps:

  1. Create udev rules for the device. Create file /etc/udev/rules.d/42-woobm.rules

    ACTION=="add", SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}="067b",ENV{ID_MODEL_ID}="2303", RUN+="/home/pi/woobm-add.sh $name", SYMLINK+="woobm"
    ACTION=="remove", SUBSYSTEM=="tty", ENV{ID_VENDOR_ID}="067b" ,ENV{ID_MODEL_ID}="2303", RUN+="/home/pi/woobm-rm.sh $name"

  2. Create scripts for add and remove actions. First /home/pi/woobm-add.sh.

    #!/bin/sh
    if [[ $# -ne 1 ]]; then
        echo "Illegal number of parameters"
        exit 2
    fi
    echo $1 > /tmp/woobm
    /bin/systemctl --no-block start serial-getty@woobm

    Then /home/pi/woobm-rm.sh.

    #!/bin/sh
    FILE=/tmp/woobm
    if [ -f "$FILE" ]; then
        /bin/rm $FILE
    fi
    /bin/systemctl stop serial-getty@woobm
  3. Reload udev rules with $ sudo udevadm control --reload

  4. Create custom serial-getty service for woobm, use the command and add 3 lines of service configuration.

        $ sudo systemctl edit serial-getty@woobm
        [Service]
        ExecStart=
        ExecStart=-/sbin/agetty ttyUSB0 115200

  5. Save and call systemctl to reload all daemons

    $ sudo systemctl daemon-reload

That’s it. Plug the woobm to Pi and it should be working now. Confirm the agetty is running on serial usb device by ps command.