Apps command path is not searched relative to usr/bin

https://snapcraft.io/docs/python-apps says that apps command path is automatically searches in the usr/sbin , usr/bin , sbin , and bin sub directories of your snap, but for my case of command in usr/bin it does not work. If I ommit usr/bin prefix snapcraft fails with

path "command" does not exist

Kindly provide your snapcraft.yaml, for better help

name: qemu
base: core22
adopt-info: qemu
summary: A generic and open source machine emulator and virtualizer
description: |
  QEMU is a generic and open source machine emulator and virtualizer.

grade: devel
confinement: devmode

apps:
  x86-64:
    command: qemu-system-x86_64

parts:
  qemu:
    source: https://download.qemu.org/qemu-8.0.0.tar.xz
    plugin: autotools
    override-pull: |
      craftctl default
      craftctl set version=$(cat VERSION)
    autotools-configure-parameters:
      - --prefix=/usr
      - --target-list=arm-softmmu,x86_64-softmmu
    build-packages:
      - flex
      - bison
      - libglib2.0-dev
      - libpixman-1-dev
      - ninja-build
      - pkg-config
      - python3
    stage-packages:
      - libpixman-1-0

The apps part should have the name that you want to run, so, it should be

apps:
  qemu:
    command: usr/bin/(binary-file that is installed in usr/bin/ while building)

Check the build logs to know the actual name of the file.

A suggestion is to build the app from source(https://gitlab.com/qemu-project/qemu) with the tag that you want to build as source-tag

eg:

source: https://gitlab.com/qemu-project/qemu
source-tag: v8.0.0

this has been true once but not for a long time … if you find such issues in any snapcraft documentation, scroll to the bottom of the doc, there is an “improve this document in the forum” link, that takes you to:

where you can report the issue in a comment to get the doc fixed … :wink:

1 Like