Unable to communicate with the ROS 2 nodes that have been set up as daemons

Hello. I am conducting research on product development using ROS 2. After successfully snapping the talker-listener example, I followed the documentation to set it up as a daemon in order to have it start automatically. Here is a snapcraft.yaml:

name: ros2-talker-listener
version: '0.1'
summary: ROS 2 Talker/Listener Example
description: |
 This example launches a ROS 2 talker and listener.

confinement: devmode
base: core22

parts:
 ros-demos:
   plugin: colcon
   source: https://github.com/ros2/demos.git
   source-branch: humble
   source-subdir: demo_nodes_cpp
   stage-packages: [ros-humble-ros2launch]

apps:
 ros2-talker-listener:
   command: opt/ros/humble/bin/ros2 launch demo_nodes_cpp talker_listener.launch.py
   extensions: [ros2-humble]
   daemon: simple

After installing the package with snap, I confirmed that the service is active.

$ snap services
...
ros2-talker-listener.ros2-talker-listener  enabled   active    -
...

Additionally, when checking with snap logs, the talker and listener are communicating correctly.

$ snap logs ros2-talker-listener -f
2024-10-02T15:49:55+09:00 ros2-talker-listener.ros2-talker-listener[13825]: [talker-1] [INFO] [1727851795.320542421] [talker]: Publishing: 'Hello World: 562'
2024-10-02T15:49:55+09:00 ros2-talker-listener.ros2-talker-listener[13825]: [listener-2] [INFO] [1727851795.320901545] [listener]: I heard: [Hello World: 562]

However, when I try to check the ROS 2 nodes from the command line, neither /talker nor /listener appear in the list. The topic /chatter does show up in the list, but it remains unresponsive when I try to echo it.

$ ros2 node list 
$
$ ros2 topic list
/chatter
/parameter_events
/rosout
$ ros2 topic echo /chatter
(NO MESSAGE)

Interestingly, after simply restarting the host (PC), the nodes correctly appear in the list, and I can successfully subscribe to the topic. When I run snap restart ros2-talker-listener, both /talker and /listener disappear from the list of nodes, and I can no longer echo the topic. After restarting the host again, it becomes possible to do so once more.

My question is: Is this the correct behavior? I’m hoping to have communication functioning even after updating or restarting the snap package. Is it possible to achieve this through configuration?

Thank you,

In case it is needed, my environment is:

  • Ubuntu 22.04.5 LTS
  • snap 2.63+22.04ubuntu0.1
  • snapd 2.63+22.04ubuntu0.1
  • napcraft 8.4.1