3

The following error occurs when I issue sudo rfcomm listen rfcomm0

Can't create RFCOMM TTY: Address already in use

I received some serial Bluetooth data in a Python program beforehand. So, it seems something gets stuck.

Then I type sudo rfcomm release rfcomm0 which yields:

Can't release device: Operation already in progress

How can I make a hard release? For now the only way to get it working again is to reboot.

1

Ok since rebooting is annoying, I have tried two approaches.

  • Create another device and bind the bluetooth to it. Then use the new one in your program.

Open /etc/bluetooth/rfcomm.conf and add another device.

rfcomm0 { # Automatically bind the device at startup bind no; # Bluetooth address of the device device 00:06:66:68:20:61; # RFCOMM channel for the connection channel 1; # Description of the connection comment "This is Device 1's serial port."; }

rfcomm2 { # Automatically bind the device at startup bind no; # Bluetooth address of the device device 20:15:12:08:62:95; # RFCOMM channel for the connection channel 1; # Description of the connection comment "This is Device 1's serial port."; }

rfcomm3 { # Automatically bind the device at startup bind no; # Bluetooth address of the device device 20:15:12:08:62:95; # RFCOMM channel for the connection channel 1; # Description of the connection comment "This is Device 1's serial port."; }

Restart the bluetooth service then :

userk@dopamine:~$ sudo rfcomm bind 2 DEV_ADDR CHANNEL
  • The answer:

Rfcomm can't release the device because of some other process in Ubuntu. Check which one with

userk@dopamine:~$ sudo lsof | grep /dev/rfcomm2

MATLAB    5554 6868            userk  514u      CHR              216,2       0t0        603 /dev/rfcomm2

Kill it!!

userk@dopamine:~$ ps -ax | grep MATLAB
 7684 pts/5    Sl     0:39 /usr/local/MATLAB/R2015b/bin/glnxa64/MATLAB
 7873 pts/5    S+     0:00 grep --color=auto MATLAB

userk@dopamine:~$ kill -9 7684

Voilà no ore forced reboot! Hope it helps

1

Quite late here but I had this same issue on Ubuntu 16.04.

What I did was the following:

sudo service bluetooth restart

Which gave me the error:

Warning: bluetooth.service changed on disk. Run 'systemctl daemon-reload' to reload units.

After running the suggested command in the warning I was able to succesfully restart the bluetooth service and commence listening on the port.

I suspect that in my case I changed a config (running bluetoothd with the --compat argument) and therefor the init system had to reload.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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