Issues running a bluetooth service (nodejs + bleno)

Hello !

I’m currently building a device that needs to act as a bluetooth peripheral for a mobile app.

when I run it and try accessing it from the app or from light blue, it either makes the app/lightblue crash, or only displays advertisement data (services aren’t available)

current versions of the supervisor and balenaOS:
Screenshot 2022-01-07 at 19.33.57

my Dockerfile:

FROM balenalib/%%BALENA_MACHINE_NAME%%-node:16.13-buster-build as build

# D-Bus calls needs to be directed to the system bus that the host OS is listening on. Required to execute nmcli from container
ENV DBUS_SYSTEM_BUS_ADDRESS unix:path=/host/run/dbus/system_bus_socket
# needed for nmcli from container
# ENV INITSYSTEM on 

# Enable i2c
CMD modprobe i2c-dev

# Install packages for node-gyp
RUN install_packages build-essential python3 make g++
RUN install_packages pigpio python-pigpio python3-pigpio

# install overmind
RUN wget https://github.com/DarthSim/overmind/releases/download/v2.2.2/overmind-v2.2.2-linux-arm.gz
RUN gunzip overmind-v2.2.2-linux-arm.gz
RUN mv overmind-v2.2.2-linux-arm overmind
RUN chmod +x overmind

# Copies the package.json first for better cache on later pushes
COPY package.json package.json
COPY yarn.lock yarn.lock
COPY .yarnclean .yarnclean

# This install npm dependencies on the balena build server,
# making sure to clean up the artifacts it creates in order to reduce the image size.
RUN yarn install
# ?
# RUN yarn add @vladmandic/human @tensorflow/tfjs-node --force --build-from-source
RUN yarn autoclean --force

# # build front end app
# RUN yarn build

FROM balenalib/%%BALENA_MACHINE_NAME%%-node:16.13-buster-run
# install neccessary runtime dependencies
RUN install_packages bluetooth bluez libbluetooth-dev libudev-dev libusb-1.0-0-dev i2c-tools pigpio python-pigpio python3-pigpio tmux network-manager wireless-tools

ENV INITSYSTEM on
ENV DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

RUN systemctl mask NetworkManager.service
RUN systemctl enable pigpiod
# make sure bluetooth service is not running
RUN update-rc.d bluetooth remove
RUN service bluetooth stop

# Defines our working directory in container
WORKDIR /usr/src/app

# Copy app files and dependencies built at the previous step
COPY --from=build ./node_modules ./node_modules
COPY --from=build ./overmind ./overmind
COPY . ./

# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# server.js will run when container starts up on the device
CMD ["sh", "./startup.sh"]

As you can see I also tried killing the running bluetooth service to ensure only the one from bleno was running (as seen in GitHub - abandonware/bleno: A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals) but this does seem to have any effect as the service still show up as running.

I get the exact same result when using the example from GitHub - balenalabs-incubator/balena-web-ble: A project to showcase a Web BLE app communicating with a balena powered BLE peripheral

any idea on how to get my services running ?

The issue was found related to @abandonware/bleno and has nothing to do with balena: bluetooth-hci-socket@0.5.8-8 is broken · Issue #33 · abandonware/bleno · GitHub

Thanks for letting us know!