Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need sudo on Fedora #106

Closed
DamienCassou opened this issue Mar 21, 2017 · 14 comments
Closed

Need sudo on Fedora #106

DamienCassou opened this issue Mar 21, 2017 · 14 comments

Comments

@DamienCassou
Copy link

DamienCassou commented Mar 21, 2017

I have a bacon phone and a Fedora 25 laptop. I think I did what was required but I still need sudo to list devices:

10:21:44 [:~] $
> head /etc/udev/rules.d/51-android.rules 
# These rules refer: https://developer.android.com/studio/run/device.html
# and include many suggestions from Arch Linux, GitHub and other Communities.
# Latest version can be found at: https://github.com/M0Rf30/android-udev-rules

# Skip this section below if this device is not connected by USB
SUBSYSTEM!="usb", GOTO="android_usb_rules_end"

LABEL="android_usb_rules_begin"
# Devices listed here in android_usb_rules_{begin...end} are connected by USB
#	Acer

10:24:06 [:~] $ 
> ls -l /etc/udev/rules.d/51-android.rules 
lrwxrwxrwx. 1 root root 67 21 mars  10:16 /etc/udev/rules.d/51-android.rules -> /home/cassou/Documents/projects/android-udev-rules/51-android.rules

10:23:08 [:~] $ 
> id
uid=1000(cassou) gid=1000(cassou) groups=1000(cassou),10(wheel),978(wireshark),979(vboxusers),1001(docker),1002(adbusers) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

I rebooted my laptop but still:

10:21:44 [:~] $
> fastboot devices
no permissions; see [http://developer.android.com/tools/device.html]	fastboot

10:19:48 [:~] $ 
> sudo fastboot devices
5d5015ff	fastboot
@zamber
Copy link
Contributor

zamber commented Mar 21, 2017

Try adding yourself to the plugdev group and retest.

@DamienCassou
Copy link
Author

DamienCassou commented Mar 21, 2017 via email

@zamber
Copy link
Contributor

zamber commented Mar 21, 2017

plugdev that is (edited comment on GH but it was to late and the notification already went out).

@DamienCassou
Copy link
Author

DamienCassou commented Mar 21, 2017 via email

@zamber
Copy link
Contributor

zamber commented Mar 21, 2017

Just googled it out. I don't have a Fedrora install to test (nor any friends that would use it).

Please run:

which adb
adb version
sudo udevadm monitor -e
# here plug in your phone

Paste in here in a code block or on a pastebin service you prefer.

@DamienCassou
Copy link
Author

12:35:47 [:~] 10s $ 
> which adb
/usr/bin/adb
13:39:18 [:~] $ 
> adb version
Android Debug Bridge version 1.0.35
Revision 3761365735de
13:39:22 [:~] $ 
> sudo udevadm monitor -e
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[12175.598302] add      /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1 (usb)
ACTION=add
BUSNUM=001
DEVNAME=/dev/bus/usb/001/029
DEVNUM=029
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1
DEVTYPE=usb_device
MAJOR=189
MINOR=28
PRODUCT=5c6/6765/232
SEQNUM=3313
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[12175.599235] add      /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.0 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.0
DEVTYPE=usb_interface
INTERFACE=255/255/0
MODALIAS=usb:v05C6p6765d0232dc00dsc00dp00icFFiscFFip00in00
PRODUCT=5c6/6765/232
SEQNUM=3314
SUBSYSTEM=usb
TYPE=0/0/0

KERNEL[12175.600121] add      /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.1 (usb)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.1
DEVTYPE=usb_interface
INTERFACE=255/66/1
MODALIAS=usb:v05C6p6765d0232dc00dsc00dp00icFFisc42ip01in01
PRODUCT=5c6/6765/232
SEQNUM=3315
SUBSYSTEM=usb
TYPE=0/0/0

UDEV  [12175.667278] add      /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1 (usb)
ACTION=add
BUSNUM=001
COLORD_DEVICE=1
COLORD_KIND=camera
DEVLINKS=/dev/libmtp-1-4.4.1
DEVNAME=/dev/bus/usb/001/029
DEVNUM=029
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1
DEVTYPE=usb_device
DRIVER=usb
GPHOTO2_DRIVER=proprietary
ID_BUS=usb
ID_FOR_SEAT=usb-pci-0000_00_14_0-usb-0_4_4_1
ID_GPHOTO2=1
ID_MEDIA_PLAYER=1
ID_MODEL=A0001
ID_MODEL_ENC=A0001
ID_MODEL_ID=6765
ID_MTP_DEVICE=1
ID_PATH=pci-0000:00:14.0-usb-0:4.4.1
ID_PATH_TAG=pci-0000_00_14_0-usb-0_4_4_1
ID_REVISION=0232
ID_SERIAL=OnePlus_A0001_5d5015ff
ID_SERIAL_SHORT=5d5015ff
ID_USB_INTERFACES=:ffff00:ff4201:
ID_VENDOR=OnePlus
ID_VENDOR_ENC=OnePlus
ID_VENDOR_FROM_DATABASE=Qualcomm, Inc.
ID_VENDOR_ID=05c6
MAJOR=189
MINOR=28
PRODUCT=5c6/6765/232
SEQNUM=3313
SUBSYSTEM=usb
TAGS=:uaccess:seat:
TYPE=0/0/0
USEC_INITIALIZED=12175622657

UDEV  [12175.671699] add      /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.0 (usb)
.MM_USBIFNUM=00
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.0
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=Qualcomm, Inc.
INTERFACE=255/255/0
MODALIAS=usb:v05C6p6765d0232dc00dsc00dp00icFFiscFFip00in00
PRODUCT=5c6/6765/232
SEQNUM=3314
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=12175670995

UDEV  [12175.671803] add      /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.1 (usb)
.MM_USBIFNUM=01
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4.4/1-4.4.1/1-4.4.1:1.1
DEVTYPE=usb_interface
ID_VENDOR_FROM_DATABASE=Qualcomm, Inc.
INTERFACE=255/66/1
MODALIAS=usb:v05C6p6765d0232dc00dsc00dp00icFFisc42ip01in01
PRODUCT=5c6/6765/232
SEQNUM=3315
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=12175671481

@zamber
Copy link
Contributor

zamber commented Mar 21, 2017

OK, I tried to replicate it with the OnePlus One we have at the office and failed. I'm pretty sure that either the rules file was not parsed by your udev and/or you'll have to add yourself to the plugdev group.

Note that on Fedora there's no default plugdev group and according to this thread they advise to make an androiddev group.

So to ensure that everything is in order we'll follow most of the advise in that thread using plugdev instead of androiddev (because plugdev is used in 51-android.rules):

sudo groupadd plugdev
sudo usermod -aG plugdev your_login_name

# refresh groups for this shell session - hacky hack - log out and in if it fails
exec su -l $USER

# reload rules and restart udev
sudo udevadm control --reload
sudo systemctl restart systemd-udevd.service

# test if it worked
adb devices

@DamienCassou
Copy link
Author

DamienCassou commented Mar 22, 2017

adb devices works, but fastboot devices still requires sudo.

> adb devices
List of devices attached
5d5015ff	device

> adb reboot bootloader

> fastboot devices
no permissions (verify udev rules); see [http://developer.android.com/tools/device.html]	fastboot

> sudo fastboot devices
5d5015ff	fastboot

> fastboot devices
no permissions (verify udev rules); see [http://developer.android.com/tools/device.html]	fastboot

@rafael-caldeira
Copy link

I just had a similar issue. I found out that I had multiple versions of adb, and the version avaliable on PATH wasn't the right one. May be fastboot is calling a different adb

@DamienCassou
Copy link
Author

@RSFalcon7 Thanks for the suggestion. I don't think I'm in a similar situation because (1) I just reinstalled my whole system, (2) I installed adb/fastboot from the fedora package manager and from nowhere else, and (3) locate can't find anything else either.

@zamber
Copy link
Contributor

zamber commented Mar 29, 2017 via email

@M0Rf30 M0Rf30 closed this as completed Sep 2, 2017
@jacksongoode
Copy link

Still having this issue on Fedora 34

@likeadragonmaid
Copy link

Having same issue on Fedora 35/ Rawhide

@JoesCat
Copy link
Collaborator

JoesCat commented Oct 14, 2021

Some differences to note:
With Debian derived distros - example....Ubuntu, Mint,.... use group "plugdev"

With Redhat aligned distros - example...Fedora,Centos,Mageia,SuSE, ...try use group "usb".
These distros didn't really catch onto using sudo either.
sudo is convenient, but it is also putting ease-of-use ahead of security.

Command 'which' can also help you find which version of adb you are actually using, example:
which adb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants