Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 315351 - sys-fs/udev rules stops gnome-bluetooth from using rfkill features
Summary: sys-fs/udev rules stops gnome-bluetooth from using rfkill features
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on: 316383
Blocks:
  Show dependency tree
 
Reported: 2010-04-14 21:55 UTC by Gilles Dartiguelongue (RETIRED)
Modified: 2010-12-16 23:25 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
40-rfkill.rules (40-rfkill.rules,117 bytes, text/plain)
2010-06-02 19:25 UTC, Gilles Dartiguelongue (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gilles Dartiguelongue (RETIRED) gentoo-dev 2010-04-14 21:55:43 UTC
Quoting the README:

> [1]: Note that read/write access to the /dev/rfkill device is
> required and should be provided by the distribution

After changing the relevant rule to make /dev/rfkill owned by the plugdev group, I can finally switch on/off my adapter without touching system services or kernel modules with bluetooth-applet.
Comment 1 Gilles Dartiguelongue (RETIRED) gentoo-dev 2010-05-18 11:45:41 UTC
Should I fix this myself ?
Comment 2 Matthias Schwarzott gentoo-dev 2010-05-18 20:26:45 UTC
Well, where do you want to fix this?
Which ebuild does create group plugdev?

Until now sys-fs/udev provided rules only know these groups: audio cdrom disk floppy kmem lp tape tty usb uucp video

This is almost like upstream, but gentoo adds group usb for /dev/bus/usb/* and renamed dialout to uucp.

So if we can be sure group plugdev will exist or udev does no harm in this case, I suggest adding it to 40-gentoo.rules
Comment 3 Gilles Dartiguelongue (RETIRED) gentoo-dev 2010-06-02 19:25:09 UTC
Created attachment 233877 [details]
40-rfkill.rules

Adding this just for the record. I've added the attached file to /etc/udev/rules.d/, reloaded rules and ran udevadm trigger and it made the problem go away.
Comment 4 Juergen Rose 2010-06-08 09:00:13 UTC
After adding 40-rfkill.rules to /etc/udev/rules.d/ and restarting udev (/etc/init.d/udev restart) I have now the following permissions of /dev/rfkill:
root@lynx:/root(8)# ll /dev/rfkill 
crw-r--r-- 1 root plugdev 10, 57 Jun  8 10:55 /dev/rfkill

I.e. it s not writable by plugdev.
Comment 5 Juergen Rose 2010-06-08 09:47:38 UTC
And also after reboot I find in .xsession-errors:
...
(gnome-settings-daemon:7941): GLib-GObject-CRITICAL **: g_param_spec_flags: assertion `G_TYPE_IS_FLAGS (flags_type)' failed

(gnome-settings-daemon:7941): GLib-GObject-CRITICAL **: g_object_class_install_property: assertion `G_IS_PARAM_SPEC (pspec)' failed

** (bluetooth-applet:8328): WARNING **: Could not open RFKILL control device, please verify your installation

(polkit-gnome-authentication-agent-1:8346): GLib-GObject-WARNING **: cannot register existing type `_PolkitError'

(polkit-gnome-authentication-agent-1:8346): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
Comment 6 Juergen Rose 2010-06-08 09:57:51 UTC
I suppose the reason is that /dev/rfkill does not have the permissions as expected from  /etc/udev/rules.d/40-rfkill.rules:

root@lynx:/root(6)# grep rfkill  /etc/udev/rules.d/40-rfkill.rules
KERNEL=="rfkill", GROUP="plugdev",      MODE="0664"

but:

root@lynx:/root(8)#  ls -l /dev/rfkill  | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf("%0o ",k);print}'
644 crw-r--r-- 1 root plugdev 10, 57 Jun  8 11:19 /dev/rfkill
Comment 7 Juergen Rose 2010-06-08 13:58:05 UTC
And I beling to plugdev group:
rose@lynx:/home/rose(1)$ id
uid=1203(rose) gid=1000(rose) Gruppen=1000(rose),4(adm),6(disk),7(lp),10(wheel),14(uucp),18(audio),19(cdrom),27(video),35(games),100(users),250(portage),1004(plugdev),1010(vboxusers),1013(wireshark),1016(qemu),1020(kvm),1212(nwaccess),1217(tuntap)
Comment 8 Juergen Rose 2010-06-08 15:00:27 UTC
If I switch on udev debugging and monitoring in /etc/conf.d/udev:
udev_debug="YES"
udev_monitor="YES"

I find in /dev/.udev/udev.log the lines:
...
1276007135.547856 [1167] udev_device_new_from_syspath: device 0x2338690 has devpath '/devices/virtual/misc/rfkill'
1276007135.547927 [1167] udev_rules_apply_to_event: GROUP 1004 /etc/udev/rules.d/40-rfkill.rules:4
1276007135.547932 [1167] udev_rules_apply_to_event: MODE 0664 /etc/udev/rules.d/40-rfkill.rules:4
1276007135.547953 [1167] udev_rules_apply_to_event: LINK 'char/10:57' /lib64/udev/rules.d/50-udev-default.rules:4
1276007135.547966 [1167] udev_rules_apply_to_event: MODE 0644 /lib64/udev/rules.d/50-udev-default.rules:104
1276007135.547986 [1167] udev_rules_apply_to_event: RUN 'socket:@/org/freedesktop/hal/udev_event' /etc/udev/rules.d/90-hal.rules:2
1276007135.547997 [1167] udev_event_execute_rules: no node name set, will use kernel supplied name 'rfkill'
1276007135.548033 [1167] udev_device_update_db: created db link (rfkill char/10:57)
1276007135.548042 [1167] udev_node_add: creating device node '/dev/rfkill', devnum=10:57, mode=0644, uid=0, gid=1004
1276007135.548049 [1167] udev_node_mknod: preserve file '/dev/rfkill', because it has correct dev_t
1276007135.548055 [1167] udev_node_mknod: set permissions /dev/rfkill, 020644, uid=0, gid=1004
1276007135.548071 [1167] node_symlink: creating symlink '/dev/char/10:57' to '../rfkill'
...

If I understand this correctly, udev gets the information from /etc/udev/rules.d/40-rfkill.rules to create a device node with mode 0664 and from /lib64/udev/rules.d/50-udev-default.rules to create the node mith mode 0644.

In /lib64/udev/rules.d/50-udev-default.rules I find the line:

root@moose:/root(5)# grep rfkill /lib64/udev/rules.d/50-udev-default.rules 
KERNEL=="rfkill",               MODE="0644"

What should I do, remove this line from 50-udev-default.rules, change the number 40-rfkill.rules name into a higher number, or...?

Comment 9 Gilles Dartiguelongue (RETIRED) gentoo-dev 2010-12-16 23:25:42 UTC
+  16 Dec 2010; Gilles Dartiguelongue <eva@gentoo.org> +files/80-rfkill.rules,
+  gnome-bluetooth-2.32.0.ebuild:
+  Add udev rules in order to get rfkill control, bug #315351.

ok, I decided to make gnome-bluetooth handle this stuff as most other packages to have to control specific devices (sane-backends, libgphoto2, ...). Feel free to stab me if the rules are wrong or whatever. Thanks for your help in this bug.