Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 515712 - =sys-apps/systemd-212-r5: files in /etc/udev/rules.d are not processed
Summary: =sys-apps/systemd-212-r5: files in /etc/udev/rules.d are not processed
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-30 00:53 UTC by vm
Modified: 2014-07-23 00:15 UTC (History)
1 user (show)

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


Attachments
emerge --info systemd (syso.txt,5.79 KB, text/plain)
2014-06-30 00:57 UTC, vm
Details
abd_usb.ini (adb_usb.ini,130 bytes, text/plain)
2014-06-30 01:00 UTC, vm
Details
51-android.rules (51-android.rules,143 bytes, text/plain)
2014-06-30 01:02 UTC, vm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vm 2014-06-30 00:53:54 UTC
I have a new android device (Azpen A727). The vendor ID is 0x1f3a. I created the file /etc/udev/rules.d/51-android.rules containing this line:

SUBSYSTEM=="usb", ATTR{idVendor}=="1f3a", MODE="0664", group="android"

When I plug the device in, "adb devices" does not recognize it. If I append the exact same line to /lib/udev/rules.d/80-android.rules, the device is recognized. The documentation indicates that the /etc/udev/rules.d file is the correct place for this, since it is not (yet) part of the android-sdk-update-manager package.

Reproducible: Always

Steps to Reproduce:
1. find an android device whose manufacturer is not in /lib/udev/rules.d/80-android.rules
2. add the appropriate line to /etc/udev/rules.d/51-android.rules
3. connect the device
4. run "adb devices"

Actual Results:  
device was not recognized by adb

Expected Results:  
device should be recognized by adb

i added 1f3a to my ~/.android/adb_usb.inf
Comment 1 vm 2014-06-30 00:57:29 UTC
Created attachment 379952 [details]
emerge --info systemd
Comment 2 vm 2014-06-30 01:00:19 UTC
Created attachment 379954 [details]
abd_usb.ini
Comment 3 vm 2014-06-30 01:02:07 UTC
Created attachment 379956 [details]
51-android.rules

the SYSFS line is so that the device will be recognized as a removable drive
Comment 4 vm 2014-06-30 01:05:36 UTC
Portage 2.2.8-r1 (default/linux/amd64/13.0/desktop/gnome/systemd, gcc-4.7.3, glibc-2.17, 3.12.21-gentoo-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.12.21-gentoo-r1-x86_64-Intel-R-_Core-TM-_i7-2700K_CPU_@_3.50GHz-with-gentoo-2.2
KiB Mem:    16352360 total,  15582316 free
KiB Swap:    4976556 total,   4976556 free
Timestamp of tree: Thu, 26 Jun 2014 00:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.3.3
dev-util/cmake:           2.8.12.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.13 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7-avx -mtune=corei7-avx -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=corei7-avx -mtune=corei7-avx -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs --load-average=6 --autounmask=y --autounmask-write=y --keep-going --ask-enter-invalid --backtrack=50"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/ http://mirror.usu.edu/mirrors/gentoo/ ftp://gentoo.cites.uiuc.edu/pub/gentoo/ http://gentoo.mirrors.tds.net/gentoo"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/ssdtmp/portage"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync5.us.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi aes alsa amd64 avx berkdb branding bzip2 cairo caps cdda cdr cli colord cracklib crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo exif fam firefox flac fortran gdbm gif glib gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk iconv introspection ipv6 jpeg lcms ldap libnotify libsecret mad mmx mng modules mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls nptl ogg opengl openmp orc pam pango pcre pdf png policykit ppds pulseaudio qt3support qt4 readline sdl session spell sse sse2 sse4_1 sse4_2 ssl ssse3 startup-notification svg symlink systemd tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

sys-apps/systemd-212-r5 was built with the following:
USE="acl filecaps firmware-loader gudev introspection kmod pam policykit seccomp -audit -cryptsetup -doc -gcrypt -http (-kdbus) -lzma -python -qrcode (-selinux) (-ssl) -test -vanilla -xattr" ABI_X86="64 -32 -x32" PYTHON_SINGLE_TARGET="python2_7 -python3_2 -python3_3" PYTHON_TARGETS="python2_7 python3_3 -python3_2"
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2014-06-30 06:43:30 UTC
Which package file /lib/udev/rules.d/80-android.rules belongs to?
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2014-06-30 06:43:55 UTC
Ah, android-sdk-update-manager, of course
Comment 7 vm 2014-06-30 09:06:32 UTC
It's just the ATTR rule that seems to be ignored. The SYSFS rule works.
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2014-06-30 10:53:07 UTC
(In reply to vm from comment #7)
> It's just the ATTR rule that seems to be ignored. The SYSFS rule works.

can you pastebin the /lib/udev/rules.d/80-android.rules here for convinience?
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2014-06-30 10:54:42 UTC
Just looking at maybe you should be using ATTRS instead of ATTR (just speaking loud what I'm thinking I'd try myself, so take it with a grain of salt)
Comment 10 Richard Freeman gentoo-dev 2014-06-30 12:14:53 UTC
This might be helpful:
http://developer.android.com/tools/device.html#VendorIds

They recommend the syntax in the file, though I certainly can add more of the table to it.  Apparently Azpen didn't make Google's list either.

I also found a few example sets of rules which are more complete.  

One thing I don't like about this is that they match on vendor only - I can't imagine that phones are the only thing they make and I could see this causing trouble with other devices which have more specific rules (unless udev handles that already).  

I found this approach which is more specific, but obviously even harder to maintain long-term:
https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules

I'm certainly happy to update the rules.
Comment 11 vm 2014-06-30 22:38:46 UTC
$ cat /lib/udev/rules.d/80-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="1f3a", MODE="0664", GROUP="android"

The exact same ATTR line works when it is in /lib/udev, but not when it is in /etc/udev
Comment 12 Mike Gilbert gentoo-dev 2014-07-01 13:31:28 UTC
Are you running udevadm control --reload after creating the file in /etc/udev?
Comment 13 vm 2014-07-01 22:54:52 UTC
Well, I had rebooted a time or twelve. So I commented the line out of /lib/udev and left it in /etc/udev and ran the command. Still no love. Rebooted. No love
Comment 14 Mike Gilbert gentoo-dev 2014-07-02 02:10:08 UTC
Comment on attachment 379956 [details]
51-android.rules

One thing I note here is that "group" is in lowercase. Are you sure you are using EXACTLY the same rules in /etc/udev/rules.d/51-andriod.rules?

I did a quick test with systemd-214, and udev rules from /etc/udev/rules.d work just fine. It seems very unlikely that this was broken in 212.
Comment 15 Mike Gilbert gentoo-dev 2014-07-02 02:13:06 UTC
Also, the file name you are using is significant; 51-android.rules comes much earlier in the process than 80-andriod.rules, and so some other ruleset may be overriding the former.
Comment 16 vm 2014-07-03 01:13:42 UTC
Oh, that's new. I had expected that there would be a two-level scheme for processing: directories, then files within directories. You're saying that there's  actually a flat scheme: all files in all directories are collected and processed in order of filename?
Comment 17 Mike Gilbert gentoo-dev 2014-07-03 01:23:02 UTC
(In reply to vm from comment #16)

Yes. This is documented in udev(7).
Comment 18 Mike Gilbert gentoo-dev 2014-07-15 17:18:45 UTC
I am guessing based on your last message that you had misconfigured your system. Closing.
Comment 19 vm 2014-07-15 22:57:01 UTC
Then I'd appreciate a guess as to where the misconfiguration lies. I've renamed the /lib and /etc files to be processed in either order, moved the offending line from one to the other or had it in both, and checked every change with a restart. Maybe with all the back and forth I just missed the Magic One. Whatever. I've got a working configuration, just not one that is easily maintainable.
Comment 20 Mike Gilbert gentoo-dev 2014-07-15 23:21:14 UTC
(In reply to vm from comment #19)

For example, on my system 69-libmtp.rules assigns my Nexus 5 group of "plugdev".

If I create a rule to assign group "android" in 51-android.rules, it gets overridden and I end up with a device with group "plugdev". If it is named 80-android.rules, it wins and assigns group "android".

Perhaps you could check the group on the appropriate device node (/dev/usb/<bus>/<device>). You can find the bus/device values from lsusb. That might give a clue as to what is happening.
Comment 21 Mike Gilbert gentoo-dev 2014-07-16 14:51:37 UTC
(In reply to Mike Gilbert from comment #20)
> Perhaps you could check the group on the appropriate device node
> (/dev/usb/<bus>/<device>). You can find the bus/device values from lsusb.
> That might give a clue as to what is happening.

Sorry, that should be /dev/bus/usb/<bus>/<device>
Comment 22 vm 2014-07-23 00:15:54 UTC
It seems that it was the SYSFS line. I finally looked in /var/log/messages and it was flagged as an unknown key. I removed it and the thing works. Thanks for all your help and keeping me on this one.