Make the ros2 daemon explicitly opt-in via user configuration
Maintainers usually reply within 1 day
@fujitatomoya is already working on this.
Since May 26, 2026.
Assessment
This issue has not been assessed yet.
Description
Description
i would like to open the discussion here 1st before moving in the implementation detail.
the ros2cli daemon is spawned implicitly the first time a user runs almost any ros2 introspection command (ros2 topic list, ros2 node list, ros2 service list, tab-completion, etc.). this implicit lifecycle is genuinely useful and it caches the discovery graph and gives the CLI low-latency answers. but the implicit-by-default behavior produces some classes of recurring user pain.
- inherits the first invoking shell's environment (ROS_DOMAIN_ID, RMW_IMPLEMENTATION, ROS_SECURITY_*, FASTRTPS_DEFAULT_PROFILES_FILE, etc.)
- continues serving subsequent ros2 invocations from possibly different shells/users with possibly different environments
- exposes no authentication on its XML-RPC methods (loopback-bound, but not user-scoped)
Motivation
the daemon snapshots the spawning shell's environment and then answers all subsequent CLI calls, a sequence like this silently produces wrong results. same failure mode happens with RMW_IMPLEMENTATION, ROS_LOCALHOST_ONLY, custom DDS profile XML, security enclave paths, and colcon-sourced workspace overlays.
security-enabled deployments are explicitly told to avoid the daemon. see https://docs.ros.org/en/rolling/Tutorials/Advanced/Security/Introducing-ros2-security.html
and there's no project-wide way to honor this guidance.
Avoid using ros2 daemon because it may not have security enclaves, and enough time duration should be given for the discovery in ROS 2 secured network.
XML-RPC surface has no authn/authz. daemon's XML-RPC server binds to loopback only, which limits the threat model to local processes, looks fair. but within that model there is no caller authentication: any local process (including other users on a shared machine, sidecar containers sharing the host's loopback, or a compromised unrelated service) can call system.listMethods and the discovery introspection methods, learning the full ROS graph topology, node names, and topic names. for users running ROS 2 in multi-tenant CI runners, classroom shared hosts, or container images with side processes, the implicit daemon means this surface is exposed without the user ever knowing it was started.
Design / Implementation Considerations
probably ros2 daemon should be spawned when it is explicitly started by user command. so that user can know what configuration can be applied to the ros2 daemon process.
--no-daemon flag already exists, and that can be default behavior. and we can always use ros2 daemon start to start/stop the ros2 daemon process explicitly.
Additional Information
related issues:
- https://github.com/ros2/sros2/issues/293
- https://github.com/ros2/sros2/issues/306
- https://github.com/ros2/ros2/issues/1429
could be more related to ros2daemon.
- Dominant language
- Python
- Stars
- 274
- Forks
- 246
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 12
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ros2/ros2cli
-
ros2 CLI prints BrokenPipeError traceback when output is piped to a command that exits early (e.g. head)May be free again @akshat-lakhera claimed this 38 days ago, and no pull request is open. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
ros2/ros2cli#1342 · 2 comments ·
Maintainers usually reply within 1 day
-
Add --timeout alias to ros2 topic pub and ros2 param listPossibly taken @1cbyc claimed this 63 days ago. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
ros2/ros2cli#1305 · 2 comments ·
Maintainers usually reply within 1 day
-
ros2doctor: UserWarning: Fail to call PackageReport/RosdistroReport class functions.Possibly taken @sujanchalla0510 claimed this 13 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 20/100
Maintainers usually reply within 1 day
-
Add --all alias to commands that include hidden nodes, topics, or servicesPossibly taken @Rajat-Arora claimed this 62 days ago. Opengood first issue
Difficulty 3/5 1-2 days Newbie friendliness 78/100
ros2/ros2cli#1302 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
ros2run python script without extension .py fails on windows + pixiMay be free again A pull request for this issue was closed without being merged. Openbug more-information-needed
Difficulty 3/5 1-2 days Newbie friendliness 68/100
ros2/ros2cli#1301 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gke-labs/kube-agents#7441 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-webui/open-webui#35142 · 1 comment ·
Maintainers usually reply within 1 day