Skip to content

Conversation

@tedwardd
Copy link

Add a wrapper script to be used in portduino when launching meshtasticd with systemd.

Rationale
Currently, to run multiple instances of meshtasticd you need to manually create multiple systemd unit files, one per instance. I would like to add support for Instantiated Services. Meshtasticd, however, is not yet able to leverage this due to various runtime-only options that are currently required in a multi-instance environment. These options are --port and --fsdir.

My currently open PR #8435 fixes one of these by adding support for an option [General][APIPort] in the meshtasticd config. Unfortunately, fixing the second, --fsdir has proven much more difficult due to how the option is used and that portion of the code not be aware of the meshtasticd config file. As a (temporary) solution to this issue that still provides support for instantiated services, I am proposing the use of a wrapper script to startup meshtasticd from systemd.

when calling a service using the following convention, systemd passes the value between @ and .service to the unit file as an instance ID which can be referred to using %i and %I within the unit file itself:

systemctl start meshtasticd@my_instance.service

By passing the instance ID to the wrapper script and establishing a standard format for configuration files and VFS paths, we can "fake" support for instantiated instances for now until a way forward with support for --fsdir in the config file is found.

Launching a meshtasticd daemon using the new script would utilize /etc/meshtasticd/config.d/<instance>-config.yaml and /var/lib/meshtasticd-<instance> for the config and vfs respectively.

@vidplace7 vidplace7 self-assigned this Nov 18, 2025
@thebentern thebentern added the enhancement New feature or request label Nov 19, 2025
Copilot finished reviewing on behalf of thebentern November 19, 2025 11:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for systemd instantiated services to enable running multiple instances of meshtasticd without manually creating multiple systemd unit files. The implementation uses a wrapper script that leverages systemd's instance ID mechanism to manage per-instance configuration and virtual filesystem directories.

  • Adds a wrapper script (meshtasticd-start.sh) that handles both single and multi-instance deployments
  • Updates the systemd service file to use the wrapper script and support instance templating
  • Integrates the wrapper script into all packaging methods (RPM, Debian, and native install)

Reviewed Changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bin/meshtasticd-start.sh New wrapper script that manages instance-specific config and VFS paths for instantiated services
bin/meshtasticd.service Updated to invoke the wrapper script with instance ID parameter and use templated description
meshtasticd.spec.rpkg Adds installation of the wrapper script to RPM packaging
debian/meshtasticd.install Adds installation of the wrapper script to Debian packaging
bin/native-install.sh Adds installation of the wrapper script to native install process

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants