Calling bluetoothctl in command-chain: "not found"

Since bluetoothctl is still missing the feature of power-on on start-up, I would like to use a command-chain to start it before the snap daemon is started. I made a shell script, added it as a part and added the following command-chain:

command-chain: []


#!/bin/sh -e

{ printf 'power on\n\n'
  sleep 2
  printf 'exit\n\n'
} | bluetoothctl

However, this leads to the error:

May 14 01:11:37 localhost my_snap.daemon[30626]: /snap/my_snap/75/ 6: /snap/my_snap/75/ bluetoothctl: not found
May 14 01:11:39 localhost systemd[1]: snap.my_snap.daemon.service: Main process exited, code=exited, status=127/n/a
May 14 01:11:39 localhost systemd[1]: snap.my_snap.daemon.service: Failed with result 'exit-code'.

If I manually execute the script, which is placed in $SNAP with


it works perfectly fine. I’m not so sure if I understand the command-chains, but I thought this would be exactly a use-case for them.

do you ship bluetoothctl in your snap ? (nothing will allow you to execute bluetoothctl outside of the snap … the bluez and bluetooth-control interfaces only allow access to dbus and the device nodes but not directly to a host binary)

Oh, ok. Still need to get used to confinement. Is there an easy way to pack the bluez snap in my snap?

Otherwise it might be easier to just use a systemd service unit.

you should be able to use bluez via a stage-snaps entry …

Added it as a stage-snap, but I’m missing a shared library now:

May 14 14:55:59 localhost my_snap.daemon[10538]: bluetoothctl: error while loading shared libraries: cannot open shared object file: No such file or directory

How can this be missing? Shouldn’t it be in the bluez snap?