FAQ & Troubleshooting¶
This page reference ROS and ROS 2 snap common questions and troubleshooting:
Frequently Asked Questions¶
If you cannot find an answer to your question here, feel free to ask it on the ubuntu forum.
I cannot snap my application. What should I check?¶
Snapcraft uses the familiar ROS tools (
rosdep/catkin/colconetc). Which means that your application must follow the ROS directives for proper packaging, such as declaring all the necessary dependencies in thepackage.xmlfiles or the install rules in yourCMakeFile.txt.
Make sure that these are in good order before attempting to create a snap.
Use colcon-in-container to validate your workspace before snapping
If you’re encountering persistent issues when snapping your ROS 2 application, especially related to missing dependencies or environment mismatches, we recommend trying colcon-in-container. This tool builds and tests your ROS workspace inside an ephemeral, isolated container with a clean ROS environment.
Which base should I use (core18, core20, core22 or core24)?¶
You should use the base that corresponds to your ROS version. That is,
core18for ROS Melodic and ROS 2 Dashing.core20for ROS Noetic and ROS 2 Foxy.core22for ROS 2 Humble.core24for ROS 2 Jazzy.
For ROS 1, do I have to expose roscore from my snap?¶
Exposing a
roslaunchcommand from your snap will automatically launch aroscoreif needed. The only reason to expose explicitly theroscorewould be if you plan to start theroscoreexplicitly from your snap.
Where should my snapcraft.yaml file live?¶
Within the package:
In
core20and above, the snap/ directory should be located at the root of the package (next to your package.xml file)In
core18the snap/ directory should be located either one folder behind your package root or at the root of your workspace
Outside the package:
Using a
rosinstallfile to download the sources.Using a single git repository holding the sources.
Can my snap save data on the host?¶
The snap defines some environment variables for data and file storage pointing to different locations that a snap can write to depending on the use case of your data.
You can save data that are common across revisions of a snap. These directories won’t be backed-up and restored across revisions:
$SNAP_COMMON, typical value:/var/snap/hello-world/common. Owned byroot$SNAP_USER_COMMON, typical value:/home/$USER/snap/hello-world/common. Owned by$USER
You can save data for a revision of a snap. This directory is backed up and restored across revisions:
$SNAP_DATA, typical value:/var/snap/hello-world/27. Owned byroot$SNAP_USER_DATA, typical value:/home/$USER/snap/hello-world/27. Owned by$USER
Additionally, with the
homeinterface, your snap could access the real$HOMEof the user by accessing$SNAP_REAL_HOME.
Troubleshooting¶
The command(s) rosrun and/or roslaunch are not available in my snap¶
If this happens, it means that your ROS project does not define a runtime dependency on either
rosrunnorroslaunchanywhere. You can fix this by declaring the dependency in the appropriate ROS package.xml file. Another option is to list either (or both) ROS packages asstage-packagesin your snapcraft.yaml. The ROS packages forrosrunandroslaunchare respectively:ros-${ROS-DISTRO}-rosbashros-${ROS-DISTRO}-roslaunch.
With core18 Catkin plugin creates an external link that prevents the security checks to pass¶
Please see: Catkin generating an external link.
Missing lapack and/or blas¶
Paths to the libraries
lapackandblasare not included in the library path by default. Thus, it must be extended manually in your app.environment: "LD_LIBRARY_PATH": "$LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack"
Warning: “This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft”¶
Some libraries are build-time only dependencies, but are still reported as run-time dependencies by
snapcraft. This warning is a false positive and will be fixed soon in snapcraft. For instance, when snappingros2-demoyou might encounter:This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft: # false-positive, none of the following are necessary at run-time libnddsc.so libnddscore.so libnddscpp.so librosidl_typesupport_connext_c.so librosidl_typesupport_connext_cpp.so librticonnextmsgcpp.so
At runtime, the snap shows an error similar to¶
[rospack] Unable to create temporary cache file /home/USER/.ros/.rospack_cache.VyyWPF: Permission denied
By default
rospackandroslogwrite to the$HOME/.ros. When strictly confined a snap which doesn’t have thehomeinterface cannot access the host$HOME. Also, even with thehomeplug the snap cannot access to hidden directories (.directories) for security reasons (like .ssh).To solve that, we can write ROS logs in the
$SNAP_USER_DATAenvironment variable. We can do so by defining the ROS environment variableROS_HOME. We can do so by adding to a snap app in thesnapcraft.yaml:[...] apps: myapp: environment: ROS_HOME: $SNAP_USER_DATA/ros command: [...]
The data will also be available from the host in:
~/snap/YOUR_SNAP_NAME/current/ros.
Calling snapcraft give the following error¶
Failed to install GPG key: unable to establish connection to key server 'keyserver.ubuntu.com'
Recommended resolution:
Verify any configured GPG keys.
Detailed information:
GPG key ID: C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
GPG key server: keyserver.ubuntu.com
If the problem is persistent, it’s most probably a DNS issue.
To verify if it’s a DNS issue, if the following command succeeds it’s most probably a DNS issue:
sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654We can also verify that the port
11371is not blocked or occupied.