A lightweight daemon for managing Mender updates on embedded Linux systems via Redis.
SMUT runs on embedded Linux systems (MDB and DBC) and triggers Mender updates via Redis. It handles resumable downloads, checksum verification, and interacts with Mender.
- Redis BLPOP for update requests
- Resumable downloads with retry
- Checksum verification (SHA256)
- Automatic Mender update install and commit
- Error reporting via Redis
- Cross-compilation for armv7l
- No CGO
- Go 1.16+ (for building)
- Redis server
- Mender update client (
mender-update
in PATH) - Linux (armv7l target)
make
make build-arm
make clean build
The project includes an installer script that handles deployment to both MDB and DBC systems.
- Build the ARM binary:
make build-arm
- Run the installer:
./install.sh <target-host> <target>
Where:
target-host
: The hostname/IP of the MDB systemtarget
: One of:mdb
: Install only on MDBdbc
: Install only on DBCboth
: Install on both MDB and DBC
The installer handles:
- Copying files to target systems
- Service installation and configuration
- GPIO management for DBC communication
- Service startup and verification
--redis-addr
: Redis server address (default: "localhost:6379")--update-key
: Redis key for update URLs (default: "mender/update/url")--checksum-key
: Redis key for checksums (default: "mender/update/checksum")--failure-key
: Redis key to set on failure (default: "mender/update/last-failure")--download-dir
: Directory to store downloaded update files (default: "/tmp")--update-type
: Type of update ('blocking' for DBC, 'non-blocking' for MDB) (default: "non-blocking")
SMUT uses the ota
Redis hash to report status and update type. The status
field indicates the current state, and the update-type
field indicates if the update is blocking or non-blocking.
To trigger an update, push the URL to the update key using LPUSH:
# For MDB system
redis-cli LPUSH mender/update/mdb/url "http://example.com/path/to/update.mender"
# For DBC system
redis-cli LPUSH mender/update/dbc/url "http://example.com/path/to/update.mender"
To set a checksum (optional):
# For MDB system
redis-cli SET mender/update/mdb/checksum "sha256:abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
# For DBC system
redis-cli SET mender/update/dbc/checksum "sha256:abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
The checksum
is optional. If provided, it should be in the format algorithm:hash
. Currently, only SHA256 is supported.
Errors are reported by setting the configured failure key in Redis with the error message as a string. The status
field in the ota
hash will also be updated to reflect the error state.
When running as a systemd service, logs can be viewed with:
journalctl -u smut@<system> -f
Replace <system>
with mdb
or dbc
.
Check the service status with:
systemctl status smut@<system>
Replace <system>
with mdb
or dbc
.