Missing binary + multipass error message

Hello,
I’m still learning how to use snapcraft but I keep running into the same problem. It appears that whenever I try to snap python packages it can’t find the binary. I ran unsquashfs and confirmed that there is no binary in the bin directory. Can anyone shed some light on what I am doing wrong and can you make any sense of the error messages below?

Thank You!

name: crosslinked
base: core18
version: ‘0.1’
summary: LinkedIn enumeration tool
description: |
LinkedIn enumeration tool to extract valid employee names from an organization through search engine scraping.
Names can be formatted in a defined naming convention for further security testing.

grade: devel
confinement: devmode

parts:
my-part:
plugin: python
source: https://github.com/m8r0wn/crosslinked
source-type: git

apps:
crosslinked:
command: bin/crosslinked

Failed to generate snap metadata: The specified command ‘crosslinked’ defined in the app ‘crosslinked’ does not exist or is not executable.
Ensure that ‘crosslinked’ is relative to the prime directory.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute ‘sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap’ with ‘multipass’: returned exit code 2.

Hi –

Snapcraft people, please keep me honest here . . .

One thing that may not be immediately clear about snaps is that when using plugins like ‘python’, ‘maven’, etc, snapcraft expects the projects to be set up in standard ways. In the case of python, snapcraft expects the project to use setuptools in order to work out of the box.

That said, many projects are not set up in standard ways for various reasons and that’s a-okay. In that case, you simply need to tell snapcraft how to build and install your project using build-override.

In addition, you reference bin/crosslinked in your apps section, but the command needs to reference an actual executable script. This can be a wrapper, a python script, or whatever, but crosslinked doesn’t exist in your project.

What’s confusing is that ‘crosslinked’ is the name of the snap application, so snap run crosslinked will work, but command can point to any old script – here, I would imagine usr/bin/crosslinked.py.

Also, I had to add a couple of build/stage packages. I’m not actually sure why these aren’t pulled in automatically when you specify the python plugin, but it wouldn’t work for me otherwise.

Try this mod of your snap as a place to start from. This built for me using the snap version of snapcraft with --use-lxd in an 18.04 env:

name: crosslinked
base: core18
version: "0.1"
summary: LinkedIn enumeration tool
description: |
  LinkedIn enumeration tool to extract valid employee names from an organization through search engine scraping.
  Names can be formatted in a defined naming convention for further security testing.
grade: devel
confinement: devmode

parts:
  my-part:
    plugin: python
    source: https://github.com/m8r0wn/crosslinked
    source-type: git
    build-packages:
      - python3
      - python3-pip
    override-build: |
      set -x
      snapcraftctl build
      cp crosslinked.py $SNAPCRAFT_PART_INSTALL/usr/bin/.
    stage-packages:
      - python3
      - python3-pip

apps:
  crosslinked:
    command: usr/bin/crosslinked.py

The other alternative is to use setuptools, as I mentioned.

1 Like

Thanks for your quick and well explained reply. :heart_eyes: