You are not logged in.

#1 2016-12-04 21:39:17

NeilMunday
Member
From: UK
Registered: 2016-12-04
Posts: 6
Website

[SOLVED] udev Bluetooth rules no longer working after upgrade

Hi,

I have used the following udev rule in /etc/udev/rules.d/10-local.rules as per: https://wiki.archlinux.org/index.php/bluetooth under Arch Linux to automatically start my Bluetooth adpater at boot time:

ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig %k up"

Until last week when I performed a system update, the udev rule does not appear to run as the bluetooth adapter is in its default state of "DOWN".

If I run:

udevadm test /sys/devices/pci0000\:00/0000\:00\:06.0/usb1/1-2/1-2\:1.0/bluetooth/hci0

I can see that the rule is found and triggered albeit in test mode:

[root@arch ~]# udevadm test /sys/devices/pci0000\:00/0000\:00\:06.0/usb1/1-2/1-2\:1.0/bluetooth/hci0
calling: test
version 232
This program is for debugging only, it does not run any program
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

=== trie on-disk ===
tool version:          232
file size:         8441128 bytes
header size             80 bytes
strings            1846968 bytes
nodes              6594080 bytes
Load module index
Found container virtualization none
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Created link configuration context.
timestamp of '/etc/udev/rules.d' changed
Reading rules file: /usr/lib/udev/rules.d/10-dm.rules
Reading rules file: /etc/udev/rules.d/10-local.rules
Reading rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
Reading rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
Reading rules file: /usr/lib/udev/rules.d/50-udev-default.rules
Reading rules file: /usr/lib/udev/rules.d/60-block.rules
Reading rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
Reading rules file: /usr/lib/udev/rules.d/60-drm.rules
Reading rules file: /usr/lib/udev/rules.d/60-evdev.rules
Reading rules file: /usr/lib/udev/rules.d/60-pcmcia.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
Reading rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
Reading rules file: /usr/lib/udev/rules.d/60-serial.rules
Reading rules file: /etc/udev/rules.d/60-vboxadd.rules
Reading rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
Reading rules file: /usr/lib/udev/rules.d/64-btrfs.rules
Reading rules file: /usr/lib/udev/rules.d/64-md-raid-assembly.rules
Reading rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
Reading rules file: /usr/lib/udev/rules.d/70-mouse.rules
Reading rules file: /usr/lib/udev/rules.d/70-power-switch.rules
Reading rules file: /usr/lib/udev/rules.d/70-touchpad.rules
Reading rules file: /usr/lib/udev/rules.d/70-uaccess.rules
Reading rules file: /usr/lib/udev/rules.d/71-seat.rules
Reading rules file: /usr/lib/udev/rules.d/73-seat-late.rules
Reading rules file: /usr/lib/udev/rules.d/75-net-description.rules
Reading rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
Reading rules file: /usr/lib/udev/rules.d/78-sound-card.rules
Reading rules file: /usr/lib/udev/rules.d/80-drivers.rules
Reading rules file: /usr/lib/udev/rules.d/80-net-setup-link.rules
Reading rules file: /usr/lib/udev/rules.d/90-vconsole.rules
Reading rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
Reading rules file: /usr/lib/udev/rules.d/99-systemd.rules
rules contain 24576 bytes tokens (2048 * 12 bytes), 12060 bytes strings
1776 strings (22269 bytes), 1177 de-duplicated (10809 bytes), 600 trie nodes used
RUN '/usr/bin/hciconfig %k up' /etc/udev/rules.d/10-local.rules:1
created db file '/run/udev/data/+bluetooth:hci0' for '/devices/pci0000:00/0000:00:06.0/usb1/1-2/1-2:1.0/bluetooth/hci0'
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:06.0/usb1/1-2/1-2:1.0/bluetooth/hci0
DEVTYPE=host
SUBSYSTEM=bluetooth
SYSTEMD_ALIAS=/sys/subsystem/bluetooth/devices/hci0
SYSTEMD_WANTS=bluetooth.target
TAGS=:systemd:
USEC_INITIALIZED=10993834
run: '/usr/bin/hciconfig hci0 up'
Unload module index
Unloaded link configuration context.
[root@arch ~]#

If I I roll back my Arch Linux installation to 15th November, my udev rule works once again. If it helps, here are the packages that were downgraded to restore functionality:

archlinux-keyring: downgrading from version 20161201-1 to version 20161101-1
bash: downgrading from version 4.4.005-1 to version 4.4-1
glib2: downgrading from version 2.50.2-1 to version 2.50.1-1
gnupg: downgrading from version 2.1.16-1 to version 2.1.15-2
hwids: downgrading from version 20161103-1 to version 20160801-1
iputils: downgrading from version 20161105.1f2bb12-1 to version 20160308.0db72a4-1
libgpg-error: downgrading from version 1.25-1 to version 1.24-1
libsystemd: downgrading from version 232-4 to version 231-4
linux: downgrading from version 4.8.11-1 to version 4.8.7-1
linux-headers: downgrading from version 4.8.11-1 to version 4.8.7-1
mkinitcpio: downgrading from version 22-1 to version 21-1
ncurses: downgrading from version 6.0+20161112-1 to version 6.0-4
npth: downgrading from version 1.3-1 to version 1.2-1
pacman-mirrorlist: downgrading from version 20161203-1 to version 20161114-1
pinentry: downgrading from version 1.0.0-1 to version 0.9.7-3
sqlite: downgrading from version 3.15.2-1 to version 3.15.1-2
systemd: downgrading from version 232-4 to version 231-4
systemd-sysvcompat: downgrading from version 232-4 to version 231-4
tzdata: downgrading from version 2016j-1 to version 2016i-1
virtualbox-guest-modules-arch: downgrading from version 5.1.10-2 to version 5.1.8-1
xz: downgrading from version 5.2.2-2 to version 5.2.2-1
zlib: downgrading from version 1:1.2.8-7 to version 1.2.8-4

Could a recent change to systemd be the issue?

Thanks,

Neil.

Last edited by NeilMunday (2016-12-10 19:32:41)

Offline

#2 2016-12-04 22:08:47

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,785

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

It appears that this is a cross post and is now moot based upon this thread
As such, I am going to close and dust bin this thread.  If I am wrong, please leave the moderators a note using the report link and we will restore the thread to Kernel and Hardware

Restored, by request

Last edited by ewaller (2016-12-05 00:16:21)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-12-05 04:29:39

vic_acid
Member
Registered: 2016-12-05
Posts: 13

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

I just ran into this issue myself.

If it's of any additional help, I noticed the following in journalctl:

systemd-udevd[153]: Process '/bin/hciconfig hci0 up' failed with exit code 1.

It seems to be happening on all of my boxen that were updated to systemd 232. The manpage for hciconfig didn't give any info about exit code 1.

Offline

#4 2016-12-05 15:24:19

vociferos
Member
Registered: 2016-12-05
Posts: 6

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

Same issue here. I changed the udev rule to redirect output to a log file

ACTION=="add", SUBSYSTEM=="hci0", RUN+="/usr/bin/sh -c '/usr/bin/hciconfig %k up >>/var/log/hciconfig.log 2>&1'"

Under systemd-231, the command is successful with no error messages. Under systemd-232, the following error message appears

Can't open HCI socket.: Protocol not supported

I searched the error in hciconfig source and found it here: http://git.kernel.org/cgit/bluetooth/bl … ig.c#n2019

If I had to guess I'd say that either udev 232 is running hciconfig "too early" compared to 231 or something has changed in the way udev runs processes.

Possibly these new lines in systemd-udevd.service:

MountFlags=slave
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6

When I get a chance I will try changing these lines to try to understand what is going on.

Offline

#5 2016-12-05 17:48:37

vociferos
Member
Registered: 2016-12-05
Posts: 6

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

I have solved the issue on my machine by using

sudo systemctl edit --full systemd-udevd.service

to comment out the last line of the unit (RestrictAddressFamilies). Bluetooth now powers back on properly, both on startup and on resume from suspend/hibernate.

Offline

#6 2016-12-05 21:50:56

vic_acid
Member
Registered: 2016-12-05
Posts: 13

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

Thanks for tracking that down and for the solution, @vociferos! Very helpful!

Just as a variation, I tested it by adding AF_BLUETOOTH to RestrictAddressFamilies instead of commenting it out, and that worked as well. So we have two possible solutions smile

Here's what mine now says for reference:

RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6 AF_BLUETOOTH

Offline

#7 2016-12-05 22:05:46

NeilMunday
Member
From: UK
Registered: 2016-12-04
Posts: 6
Website

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

Thanks guys, these work for me too. :-)

Offline

#8 2016-12-08 18:00:21

Maeda
Member
Registered: 2015-02-17
Posts: 44

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

I choose vic_acid solution, works perfect !
Thanks to community smile

Offline

#9 2016-12-08 21:19:48

NeilMunday
Member
From: UK
Registered: 2016-12-04
Posts: 6
Website

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

Is it worth updating https://wiki.archlinux.org/index.php/bluetooth to include vic_acid's solution above or should a bug be raised against the systemd package?

Offline

#10 2017-03-04 11:44:26

Maeda
Member
Registered: 2015-02-17
Posts: 44

Re: [SOLVED] udev Bluetooth rules no longer working after upgrade

With last bluez update, no power up at boot.

I have to change

AutoEnable=true

in /etc/bluetooth/main.conf, as it was commented on false, and then rebooted.

I kept the vic_acid's solution.

Offline

Board footer

Powered by FluxBB