Skip to content

Set Up a Node

Doug Snitker edited this page Dec 4, 2026 · 12 revisions

Set Up a Node

How to turn a Linux computer and a MeshCore radio into a node, and make yourself its first admin. It takes about 15 minutes. Everything is typed in a terminal as your normal account, not root.


What you need

  • A Linux computer that uses systemd, on all the time, with the internet. Debian, Ubuntu, Raspberry Pi OS, Fedora, Arch and their relatives all use systemd.
  • git and Python 3.11 or newer. The installer checks, and if one is missing it prints the command to install it.
  • The node's radio: a MeshCore radio with the companion firmware for USB, plugged into the computer, with the Public channel (every radio starts with it).
  • Your own radio, with the MeshCore app, to be the admin's radio. It stays separate from the node's.

1. Install it

curl -fsSL https://raw.githubusercontent.com/DJSnitker/mesh-contingency/main/install.sh | bash

To read the script before it runs, download it first: curl -fsSLO https://raw.githubusercontent.com/DJSnitker/mesh-contingency/main/install.sh, then less install.sh and bash install.sh.

It asks two questions first:

Counties for weather alerts, e.g. Taylor, TX; Jones, TX: Taylor, TX; Jones, TX
Your radio's public key, to be its admin (Enter to skip): a1b2c3...
  • Counties are a name and a state, split by ;. See Weather Alerts.
  • Your radio's public key is 64 hex digits. In the MeshCore app on your own radio, share your contact to see it. Press Enter to skip it and add it later (Admin Commands).

Then it puts the latest release in ~/mesh-contingency (the node folder), installs the bot into a .venv there, writes config.toml with your answers, and sets up a systemd service that starts the node at boot. It never uses sudo. It ends with a numbered list of what's left, like:

Done: mesh-contingency v1.4.1 in /home/sam/mesh-contingency
1. Let your user reach the radio's USB port, then log out and back in:
     sudo usermod -aG dialout "$USER"
2. Plug in the radio, then start and check the node:
     /home/sam/mesh-contingency/install.sh --check

Options go after bash -s --, e.g. curl -fsSL … | bash -s -- --dir ~/node:

Option Does
--counties "Taylor, TX; Jones, TX" Answers the counties question.
--admin-key KEY Answers the admin key question.
--dir DIR Installs into DIR instead of ~/mesh-contingency.
--ref main Follows the main branch instead of releases (for testing).
--no-service Skips the systemd service; run the bot by hand.

If it stops with Missing: …, run the install command it prints, then run the installer again.

2. Let your account use the radio

The radio is a serial device (/dev/ttyUSB0 or /dev/ttyACM0) that only one group may open: usually dialout (uucp on Arch). With the radio plugged in, the installer tries the port itself and says what's in the way:

The installer says What to do
Radio port /dev/ttyUSB0: you can use it. Nothing.
Let your user open /dev/ttyUSB0 (group dialout) Run the sudo usermod -aG <group> "$USER" it shows, then log out and back in.
You're in dialout, which can open /dev/ttyUSB0, but not yet in this login Log out and back in (or reboot).
Your user can't open /dev/ttyUSB0 (...), and no group can Something changed the port's permissions, usually a udev rule. A normal port looks like crw-rw---- root dialout in ls -l /dev/ttyUSB0.
Let your user reach the radio's USB port (no port named) No radio was plugged in, so it checked your groups only. Join the group, plug the radio in, and run the installer again to check.

The new group only applies to new logins, so log out and back in. id should then list it.

3. Check it

With the radio plugged in:

~/mesh-contingency/install.sh --check

It reads config.toml the way the bot does. Before starting anything, it stops on:

  • no radio, or a port you can't open;
  • a mistake in config.toml, with the bot's own message;
  • no counties.

No admins is only a note: alert, testalert, advert and status then answer no one (wx still answers anyone).

Then it starts the service (or restarts it) and waits up to 90 seconds for the bot to say Listening for direct messages. It also stops if the radio has no Public channel, or if the alert watcher didn't start. It ends with any Warning: the bot printed, or:

Running, with no warnings.
The node is listening. Next: send it help from an admin radio, and test a reboot.

4. Meet the node from your radio

Two radios can only message each other once each has heard the other's advert.

  1. Advert from your radio in the MeshCore app, so the node learns it.
  2. Check your app lists the node. The node sends a flood advert when it starts, so it usually does. If not, advert it again from its computer:
    systemctl --user kill --kill-whom=main -s USR1 mesh-contingency
    Once you're an admin it knows, the advert command does the same from your radio. To have it advert regularly too, set [advert] every_hours = 12 in config.toml (then restart).
  3. Send the node help as a direct message:
    help
    → commands: help, alert, testalert, advert, status, wx. Send help <command> for usage
    
    unrecognized user or function instead means the node doesn't see your key as an admin's: see Admin Commands.
  4. Send testalert. The test message, then the counties watched, should show on the Public channel.

5. Test a reboot

  1. Reboot the computer (sudo reboot) and don't log in.
  2. After a minute, send help from your radio. It should answer.
  3. Log in and look at this boot's log: journalctl --user -u mesh-contingency -b. A first Could not connect to MeshCore device is normal: the radio is still starting, and the bot tries again 30 seconds later. If the network is slow to come up, Auto alerts: no network yet; waiting... comes before the first check.

If it didn't come back, see Troubleshooting.

Running it day to day

The node runs as a systemd user service: it starts at boot (logged in or not), restarts after a crash, and keeps its output in the journal.

To Run
See if it's running systemctl --user status mesh-contingency
Restart it (after changing config.toml) systemctl --user restart mesh-contingency
Stop it systemctl --user stop mesh-contingency
Start it systemctl --user start mesh-contingency
Watch the log journalctl --user -u mesh-contingency -f
See this boot's log journalctl --user -u mesh-contingency -b
Send a flood advert advert from an admin radio, Advert in the console, or systemctl --user kill --kill-whom=main -s USR1 mesh-contingency
Read and send the radio's messages, change its settings, see check-ins ~/mesh-contingency/.venv/bin/mesh-contingency-console, once the Console is on
Stop it starting at boot systemctl --user disable mesh-contingency
Start at boot again systemctl --user enable mesh-contingency

stop lasts until the next start or reboot; disable it too to keep it off. The alerts already posted are kept in alerts.json in the node folder, so a restart doesn't post anything twice.

The log shows what happened, never what anyone wrote: who sent a command, its name, and how the reply went.

[a1b2c3d4e5f6 Sam T-Deck] testalert
  -> running testalert
  (reply to a1b2c3d4e5f6 delivered)
  -> replied (52 chars)

To run the bot by hand instead (for testing), stop the service first, then ~/mesh-contingency/.venv/bin/mesh-contingency from the node folder. It finds the radio itself; -p /dev/ttyUSB0 and --debug are there if you need them. Two programs on one radio interfere, so never run both.

Updating

Run the install command again:

curl -fsSL https://raw.githubusercontent.com/DJSnitker/mesh-contingency/main/install.sh | bash

It moves to the newest release, reinstalls, and restarts the service if it's running. It asks nothing and never touches config.toml or alerts.json. Read the changelog first. Then run install.sh --check.

From 0.12.0 or earlier: the node keeps running on your old config. What 1.0 no longer has is ignored, with one Warning: naming it. To tidy up:

  • Move your admin keys from users.toml ([admin] keys) into config.toml as [admins] keys = [...], then delete users.toml.
  • Delete the sections the warning names, and any channel = in [alerts]: alerts now go to Public.
  • Delete the #contingency-wx and #contingency-comm channels from the radio in the MeshCore app, if nobody else uses them.

Removing it

systemctl --user disable --now mesh-contingency
rm ~/.config/systemd/user/mesh-contingency.service
systemctl --user daemon-reload
rm -rf ~/mesh-contingency     # copy config.toml somewhere first if you want it

If nothing else of yours needs to run without you logged in: loginctl disable-linger "$USER". The radio keeps its own settings.