Catkin plugin 'rosinstall-files' results in Git "Permission denied"

I figured out that it would be better to open a new topic here for this issue.

I followed the example here to add my ROS package dependencies to the workspace. I think this is a fundamental feature to create ROS snaps. I followed the instructions and I’m trying since days without any success. Unfortunately, there is not too much information about the catkin/catkin-tools plugin out there.

In an example where I have only the catkin_simple package as dependency in the rosinstall file, this gives me the error message:

Installing wstool...
Initializing workspace (if necessary)...
Merging /root/parts/workspace/src/snap/local/snap.rosinstall
Updating workspace...
The authenticity of host 'github.com (140.82.118.3)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
Error updating workspace: Cloning into '/root/parts/workspace/src/src/catkin_simple'...
warning: templates not found /usr/share/git-core/templates
Warning: Permanently added 'github.com,140.82.118.3' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
ERROR in config: Error processing 'catkin_simple' : [catkin_simple] Checkout of git@github.com:catkin/catkin_simple.git version None into /root/parts/workspace/src/src/catkin_simple failed.

The only things I have in this snap package are:

  • snapcraft.yaml with:
...
parts: 
  workspace:
    plugin: catkin-tools
    source: .
    rosinstall-files: [snap/local/snap.rosinstall]
    catkin-packages: [catkin_simple]
...
  • snap.rosinstall:
- git:
    local-name: catkin_simple
    uri: https://github.com/catkin/catkin_simple.git

Adding a sudo ssh key results in the same error. Even changing SSH to https in the rosinstall file does not help and gives the additional error: fatal: Unable to find remote helper for 'https' . I don’t understand why, since this is even a public repo. Both ssh -T git@github.com and sudo ssh -T git@github.com work fine as well as cloning in general.

I also tried @kyrofa example here, which also gives me the https error:

Installing wstool...
Initializing workspace (if necessary)...
Merging /root/parts/ros-part/src/snap/local/snap.rosinstall
Updating workspace...
Error updating workspace: Cloning into '/root/parts/ros-part/src/src/ur_modern_driver'...
warning: templates not found /usr/share/git-core/templates
fatal: Unable to find remote helper for 'https'
ERROR in config: Error processing 'ur_modern_driver' : [ur_modern_driver] Checkout of https://github.com/ros-industrial/ur_modern_driver version None into /root/parts/ros-part/src/src/ur_modern_driver failed.

I’m wondering if I’m the only one having this issue since there are not too many alternatives to this.

I can duplicate this, and am working on a fix now. I’m not sure when things broke, but the tests didn’t catch it because they happen to include git as a build-package (as did my local build environment, I’m afraid). While waiting for my fix, you can use that as a workaround.

The fix for this issue is contained in this pull request:

https://github.com/snapcore/snapcraft/pull/2852

Thank you very much for reporting, @prex!

Thank you for taking care of this so quickly, @kyrofa.

Concerning your mentioned workaround: Can I add several git URIs to build-packages or do you mean defining a git source and then defining the required packages? I can’t find the tests. Does build-package work together with defining specific catkin-packages?

1 Like

Let me clarify with an example. The bug is that, if the host building the snap (that might be a build VM and not your dev machine) doesn’t have git installed, the catkin (and catkin-tools) plugin will use the git that was fetched along with wstool, and that functionality was broken (in reality, it’s what it should be doing always anyway).

So let’s say you had the following snapcraft.yaml snippet:

parts: 
  workspace:
    plugin: catkin-tools
    source: .
    rosinstall-files: [snap.rosinstall]

If the machine or VM building that snap didn’t have git installed, and the snap.rosinstall file included git URLs, you would see the error in the OP. The workaround is to install git on the machine/VM building the snap, by making git a build-package:

parts: 
  workspace:
    plugin: catkin-tools
    source: .
    rosinstall-files: [snap.rosinstall]
    build-packages: [git]

That will install git on the build machine/VM, and then wstool would be happy. As soon as the above PR is merged and released, you won’t need that build-package anymore.

1 Like

I understand. Thanks for the explanation!

2 Likes

I need to bring this topic up again because I still get a “publickey missing” error with the build-package workaround when using SSH. On the other side, when using https and entering username and password when prompted, it works fine now.

Since I don’t get the “templates not found error anymore” I assume the git build works fine now. But it seems like I can not access my SSH publickey from the VM. Is this the intended behaviour?

Do I somehow need to include the SSH publickey?

Yeah the build VM is an isolated machine that doesn’t include your keys. This is intended behavior. @sergiusens any recommendation for dealing with that?

On edge still,

snapcraft --bind-ssh

For more info,

snapcraft help snap

Cheers,
Sergio

2 Likes