I have paired two android phones to the Raspberry Pi 3. However when I attempt to execute a file it gives me the error:

[Errno 2] could not open port /dev/rfcomm0: [Errno 2] No such file or directory: '/dev/rfcomm0'

I have tried testing the connection using the Bluetooth Terminal from Play Store. It says that the device is unavailable.

Does anyone know how to fix this problem?

1 Answer 1


You have to perform several steps in order to establish communication.

  1. You have to pair your desired bluetooth device using bluetoothctl

    sudo bluetoothctl -a

    scan on
    pair XX:XX:XX:XX:XX:XX
    trust XX:XX:XX:XX:XX:XX

    Where XX:XX:XX:XX:XX:XX is the MAC address of your bluetooth device.

  2. You have to create the serial device that binds to your paired bluetooth device.

    sudo rfcomm bind /dev/rfcomm0 XX:XX:XX:XX:XX:XX 1

    The last number is the communication channel. It has to bee unique for all your connections.

Then you should be able to open a connection. (Assuming your bluetooth device actually supports the required SPP protocol.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.