Cannot use rfcomm as regular user. Permission denied.

Bug #1014992 reported by Burkhard Arenfeld
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
bluez (Ubuntu)
Medium
Unassigned

Bug Description

After updating from 8.04 to 12.04 I cannot use rfcomm without sudo.

I've already added the user to group 'dialout' .

Temporary I tried to change udev.rules (KERNEL=="rfcomm[0-9]*", GROUP="dialout", MODE="666") but this doesn't
solve the problem so I removed it again.

Here the commands I used :

burki@orion:/$ hcitool scan
Scanning ...
 00:12:6F:08:98:FF GEO LE-71 00001

burki@orion:/$ rfcomm connect 1 00:12:6F:08:98:FF
Can't open RFCOMM device: Permission denied

burki@orion:/$ ls -l /dev/rfcomm1
ls: cannot access /dev/rfcomm1: No such file or directory

burki@orion:/$ groups
burki adm dialout fax cdrom floppy tape sudo audio dip video plugdev fuse scanner lpadmin netdev sambashare

burki@orion:/$ sudo rfcomm connect 1 00:12:6F:08:98:FF
Connected /dev/rfcomm1 to 00:12:6F:08:98:FF on channel 1
Press CTRL-C for hangup

In another terminal while connection is running ...

burki@orion:/$ ls -l /dev/rfcomm1
crw-rw---- 1 root dialout 216, 1 Jun 19 09:01 /dev/rfcomm1

burki@orion:/$ UDEV_LOG=debug udevadm test $(udevadm info -q path -n rfcomm1)
(I've stolen this command from another bug report #570692. Output is very long. Please see attachment)

WORKAROUND: sudo chmod u+s /usr/bin/rfcomm

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: linux-image-3.2.0-25-generic-pae 3.2.0-25.40
ProcVersionSignature: Ubuntu 3.2.0-25.40-generic-pae 3.2.18
Uname: Linux 3.2.0-25-generic-pae i686
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 2.0.1-0ubuntu8
Architecture: i386
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: burki 1730 F.... pulseaudio
CRDA: Error: command ['iw', 'reg', 'get'] failed with exit code 1: nl80211 not found.
Card0.Amixer.info:
 Card hw:0 'PCH'/'HDA Intel PCH at 0xfe500000 irq 56'
   Mixer name : 'Intel CougarPoint HDMI'
   Components : 'HDA:10ec0887,10438444,00100302 HDA:80862805,80862805,00100000'
   Controls : 49
   Simple ctrls : 21
Date: Tue Jun 19 09:15:54 2012
HibernationDevice: RESUME=UUID=f3e3a302-4042-4fcd-86c5-756ae88e15b8
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release i386 (20120423)
IwConfig:
 lo no wireless extensions.

 eth0 no wireless extensions.
MachineType: System manufacturer System Product Name
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-25-generic-pae root=UUID=f791f2d4-8966-47d3-a19d-9b0b649e63ea ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-3.2.0-25-generic-pae N/A
 linux-backports-modules-3.2.0-25-generic-pae N/A
 linux-firmware 1.79
RfKill:
 0: hci0: Bluetooth
  Soft blocked: no
  Hard blocked: no
SourcePackage: linux
StagingDrivers: mei
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 10/21/2011
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 0703
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: P8Z68-V LX
dmi.board.vendor: ASUSTeK Computer INC.
dmi.board.version: Rev X.0x
dmi.chassis.asset.tag: Asset-1234567890
dmi.chassis.type: 3
dmi.chassis.vendor: Chassis Manufacture
dmi.chassis.version: Chassis Version
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr0703:bd10/21/2011:svnSystemmanufacturer:pnSystemProductName:pvrSystemVersion:rvnASUSTeKComputerINC.:rnP8Z68-VLX:rvrRevX.0x:cvnChassisManufacture:ct3:cvrChassisVersion:
dmi.product.name: System Product Name
dmi.product.version: System Version
dmi.sys.vendor: System manufacturer

Revision history for this message
Burkhard Arenfeld (elektronik) wrote :
Brad Figg (brad-figg)
Changed in linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Burkhard Arenfeld (elektronik) wrote :

Hello again ...

I've found a workaround.
After setting the SUID bit for rfcomm with the following command :

sudo chmod u+s /usr/bin/rfcomm

I can use rfcomm as regular user.

description: updated
tags: added: regression-release
Changed in linux (Ubuntu):
importance: Undecided → Medium
importance: Medium → Low
tags: added: bios-outdated-4105
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Burkhard Arenfeld (elektronik) wrote :

Hello Christopher,
I updated my mainboard bios to the latest version as you advised me to do, but nothing changed.
Here the output of the command:
sudo dmidecode -s bios-version && sudo dmidecode -s bios-release-date

4105
07/01/2013

(At first I reset the suid bit of /usr/bin/rfcomm I made earlier by reinstalling the bluez package)

Then I made the following tests:

burki@orion:~$ hcitool scan
Scanning ...
 00:12:6F:08:98:FF GEO LE-71 00001

burki@orion:~$ rfcomm connect 1 00:12:6F:08:98:FF
<<< First time the pairing pin is requested by the bluetooth applet here >>>
Can't open RFCOMM device: Permission denied

burki@orion:~$ sudo rfcomm connect 1 00:12:6F:08:98:FF
[sudo] password for burki:
Connected /dev/rfcomm1 to 00:12:6F:08:98:FF on channel 1
Press CTRL-C for hangup

This is the same behaviour like before ...

(Note: I use the gnome desktop and not unity)

Revision history for this message
Christopher M. Peñalver (penalvch) wrote :

Burkhard Arenfeld, thank you for updating your BIOS. Could you please confirm this issue exists with the latest development release of Ubuntu? ISO images are available from http://cdimage.ubuntu.com/daily-live/current/ . If the issue remains, please just make a comment to this.

Please note, given that the information from the prior release is already available, doing this on a release prior to the development one would not be helpful.

If reproducible, could you also please test the latest upstream kernel available (not the daily folder) following https://wiki.ubuntu.com/KernelMainlineBuilds ? It will allow additional upstream developers to examine the issue. Once you've tested the upstream kernel, please comment on which kernel version specifically you tested. If this bug is fixed in the mainline kernel, please add the following tags:
kernel-fixed-upstream
kernel-fixed-upstream-VERSION-NUMBER

where VERSION-NUMBER is the version number of the kernel you tested. For example:
kernel-fixed-upstream-v3.13-rc7

This can be done by clicking on the yellow circle with a black pencil icon next to the word Tags located at the bottom of the bug description. As well, please remove the tag:
needs-upstream-testing

If the mainline kernel does not fix this bug, please add the following tags:
kernel-bug-exists-upstream
kernel-bug-exists-upstream-VERSION-NUMBER

As well, please remove the tag:
needs-upstream-testing

Once testing of the upstream kernel is complete, please mark this bug's Status as Confirmed. Please let us know your results. Thank you for your understanding.

tags: added: latest-bios-4105
removed: bios-outdated-4105
Revision history for this message
Burkhard Arenfeld (elektronik) wrote :

Hello again,

I have done some tests with the latest development release of Ubuntu (trusty-desktop-i386.iso, downloaded on 13.01.2014).
The bug is still there.

Here the steps I've done to check it:
- Boot ubuntu from CD (live cd, image from 13.01.2014)
- Start the bluetooth applet
- Open a terminal and enter.
  "hcitool scan" will list my bluetooth device correctly (MAC: 00:12:6F:08:98:FF)
- Start the bluetooth applet from panel to add a new bluetooth device. In the "PIN-Option" screen
  I've checked fixed pin '1234'. On the first time a number is shown which I should enter on the bluetooth device.
  This doesn't work for me. My bluetooth device could not do this. The pairing failed after a few seconds.
  On the second try this number isn't shown and pairing is OK. (This behaviour is reproducable ;-).
- Back into the terminal I entered
  "sudo usermod -a -G dialout ubuntu"
  to add the default user ubuntu to the dialout group and than login again to activate this setting with:
  "sudo login" with user "ubuntu" and empty password.
- "rfcomm connect 1 00:12:6F:08:98:FF" fails with error "Can't open RFCOMM device: Permission denied"
- "sudo rfcomm connect 1 00:12:6F:08:98:FF" works

The tests with the latest upstream kernel available I have not done. This machine is on my work and I don't
want to replace my 12.04LTS here.
But if it's useful I can do it on my new PC at home.
Should I set the "kernel-bug-exists-upstream" flag now?

Revision history for this message
Christopher M. Peñalver (penalvch) wrote :

Burkhard Arenfeld, thank you for testing Trusty.

>"Should I set the "kernel-bug-exists-upstream" flag now?"

No, as this is strictly reserved for actually testing the latest upstream mainline kernel only. Testing Trusty is testing the downstream Ubuntu kernel, not mainline.

However, the next step is to fully bisect from 8.04 to 12.04, to identify the offending commit. Could you please do this following https://wiki.ubuntu.com/Kernel/KernelBisection ?

tags: added: trusty
tags: added: needs-bisect
removed: rfcomm
Revision history for this message
Burkhard Arenfeld (elektronik) wrote :
Download full text (3.2 KiB)

Hello Christopher

I've done some tests to find the first time this bug occur. I started the PC with different Ubuntu live CDs (every CD was a i386, desktop image). The last working distribution was 8.10 (Intrepid). The first time this bug appears was in the next version 9.04 (Jaunty). I've done this tests on several machines. The behaviour was the same on all machines so I think it's not hardware dependent.
To make further tests I installed a *fresh* :-) Ubuntu 8.10 on a PC at my home.
After the fresh install I've done
 sudo usermod -a -G dialout sysadmin
and relogin.

Then I tested it again:

 sysadmin@ritsch:~$ uname -a
 Linux ritsch 2.6.27-7-generic #1 SMP Fri Oct 24 06:42:44 UTC 2008 i686 GNU/Linux
 sysadmin@ritsch:~$ hcitool scan
 Scanning ...
 00:12:6F:08:98:FF GEO LE-71 00001
 sysadmin@ritsch:~$ rfcomm connect 1 00:12:6F:08:98:FF <<<--- On first time I was asked for the pin code here
 Connected /dev/rfcomm1 to 00:12:6F:08:98:FF on channel 1
 Press CTRL-C for hangup

--->>> Everything OK with vanilla 8.10 Ubuntu

In the next step I changed the apt package source in /etc/apt/sources.list
(old-releases.ubuntu.com) and update the system to the latest available
version for 8.10 and reboot.

Then I repeat the test from above. The kernel version changed ...

 sysadmin@ritsch:~$ uname -a
 Linux ritsch 2.6.27-17-generic #1 SMP Fri Mar 12 03:09:00 UTC 2010 i686 GNU/Linux

... but the bug is not there and everything works fine.

--->>> Everything OK with 8.10 Ubuntu with kernel 2.6.27-17

Now I decided to try to update the kernel to the same version as in the
not working 9.04 ubuntu. The kernel version on my 9.04 CD is:

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux

The first try was to install the .deb packages from 9.04 on 8.10, but that don't work because
some versions mismatch (wrong libc6-version ...).
So I download the file linux-source-2.6.28_2.6.28-11.42_all.deb from
https://launchpad.net/ubuntu/jaunty/i386/linux-source-2.6.28/2.6.28-11.42
and try to install it on the 8.10 ubuntu.
To build the new kernel I installed all essential build tools, login as root
and done the following steps:

cd
tar xjf linux-source-2.6.28.tar.bz2
cd linux-source-2.6.28
make mrproper
cp /boot/config-2.6.27-17-generic .config
make oldconfig <<<---- I answered all new questions with simply hit enter to use the default values
make clean
make deb-pkg
                                           ... some hours later ...
sudo dpkg -i linux-2.6.28.9_2.6.28.9-1_i386.deb
sudo dpkg -i linux-firmware-image_2.6.28.9-1_all.deb
sudo update-initramfs -u -k 2.6.28.9
sudo update-grup

The I reboot the PC and do the test again ...

sysadmin@ritsch:~$ uname -a
Linux ritsch 2.6.28.9 #1 SMP Fri Feb 7 00:16:26 CET 2014 i686 GNU/Linux

The bug was not there!

--->>> Everything OK with 8.10 Ubuntu with kernel 2.6.28.9

I was a little bit confused, that the kernel version is 2.6.28.9. I expected 2.6.28.11 because the
package name was linux-source-2.6.28_2.6.28-11.42_all.deb ???

I'm not sure if this problem is only a kernel problem. Perhaps there are some other
things (hotplug,...

Read more...

Revision history for this message
Christopher M. Peñalver (penalvch) wrote :

Burkhard Arenfeld, given rfcomm is provided by bluez, and this would appear not to be a kernel bug, sending to them for review.

affects: linux (Ubuntu) → bluez (Ubuntu)
Changed in bluez (Ubuntu):
importance: Low → Undecided
status: Incomplete → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bluez (Ubuntu):
status: New → Confirmed
Revision history for this message
Nicolas Göddel (ngoeddel) wrote :

This bug affects me on Ubuntu Gnome 14.04 x64.

uname -a:
Linux tp-w530 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

On a Thinkpad W530.

Revision history for this message
Jürgen (j-w-ott) wrote :

This bug exists in Ubuntu 15.04 allthough I can only run Kernel 3.16.0-31-generic #43-Ubuntu SMP x86_64

Revision history for this message
Jürgen (j-w-ott) wrote :

3.19.0-15-generic x86_64 x86_64 x86_64 problem persists

tags: added: vivid
Changed in bluez (Ubuntu):
importance: Undecided → Medium
tags: added: jaunty
removed: vivid
Revision history for this message
sash-kan (alex-barakin) wrote :

the problem may be in the ModemManager:
$ sudo lsof /dev/rfcomm0
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ModemMana 10865 root 9u CHR 216,0 0t0 132879 /dev/rfcomm0

after

$ sudo service ModemManager stop

i was able to connect to the device as regular user.

Revision history for this message
jareyes (juan-reyes-lopez) wrote :

Same problem in Xubuntu 15.04. Can't access /dev/rfcomm0 as regular user. I stopped service ModemManager, then lsof /dev/rfcomm0 returned nothing and the problem persist. I only can do "cat /dev/rfcomm0" as root.

Revision history for this message
Jakub (szczur01) wrote :

Problem still persists, can't access any /dev/rfcomm device (nor laptop built-in, nor usb bluetooth adapter) as a regular user.
Tested on:
uname -a
Linux jakub-Inspiron-3537 3.19.0-20-generic #20-Ubuntu SMP Fri May 29 10:10:47 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Alejandro Romero Herrera (alromh87) wrote :

Writing a udev rule to ignore device by ModemManager worked for me:

/etc/udev/rules.d/55-bluetooth-drone-NoModem.rules
KERNEL=="rfcomm*", ATTR{address}=="xx:d3:xx:00:xx:xx", ENV{ID_MM_DEVICE_IGNORE}="1"

And reloading rules:
sudo udevadm control --reload-rules

So I connect to device as root
sudo rfcomm connect hic0 XX:D3:XX:00:XX:XX

and then I am able to use it as regular user from dialout group

Revision history for this message
gratefulfrog (gratefulfrog) wrote :

I have this same problem on Xubunut 16.04.

I cannot access rfcomm* except as root, despite the permissions:

$ ls -al /dev/rfcomm0
crw-rw---- 1 root dialout 216, 0 Feb 18 13:58 /dev/rfcomm0

and my membership to dialout:

$ id bob
uid=1000(bob) gid=1000(bob) groups=1000(bob),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),44(video),46(plugdev),115(lpadmin),131(sambashare)

I would like to access rfcomm0 via putty, but it WILL only work with
$ sudo putty

Is there a workaround that can permanently fix this?

Thanks bob.

Cheers,
Bob

Revision history for this message
vbargsten (vbargsten) wrote :

Have the same problem on opensuse. #17 fixes it for me, thank you for the info.

tags: added: xenial
summary: - Ubuntu 12.04, i386, cannot use rfcomm as regular user. Permission
- denied.
+ Cannot use rfcomm as regular user. Permission denied.
To post a comment you must log in.