Fixing adb, fastboot and udev rules

Last time I installed LineageOS and then GrapheneOS, I used something Ubuntu based.

sudo apt install adb fastboot

usually fixed it.

GrapheneOS even has a Web installer which means Chromium Browsers have the Android tools built in? Pretty weird but the installer is great.

on Fedora

android-tools

The problem:

  • the udev rules are incomplete
  • the fedora fastboot is broken (GrapheneOS install fails)

I have to admit, I gave up. I downloaded the Google binaries from the Guide here and added them to my path. Or even changed the install script to for sure use the working fastboot.

Still, because of broken udev rules it failed. In the end I used Windows. Plugging in the device installed the correct Google Pixel phone drivers, and from Brave it literally only was a few clicks.

I am not sure how fastboot could be fixed, couldn’t fedora just ship the google binaries?

And where are the udevs, how can they be fixed? At least the ubuntu ones work.

I can confirm this. I usually worked around this by chowning the USB device file manually.

Could you elaborate here? I restored a Nexus 5x to factory OS recently without any issues. The process involved using fastboot, too.

We build them from Google sources. Please open a bug report with steps to reproduce.

Please open a bug report saying that as well and add me to Cc. I might be able to help draft a PR with a fix.

1 Like

The rules are already packaged, you can enable them like this:

sudo ln -s /usr/share/doc/android-tools/51-android.rules /etc/udev/rules.d

See also: Is ADB supported out of the box? - #2 by vgaetera

2 Likes

Thanks, why is this not by default? Afaik it is the correct location for the udev rules?

@rathann I already reported such a bug, but I could not explain how the build process is broken.

Also the version is one too old. Maybe that fixes it?

Perhaps the maintainers want to minimize security threat from ADB by forcing the user to explicitly enable only specific rules to reduce the attack surface.

It should be and it works for me.

android-tools (adb & fastboot) from fedora work fine here.

this is what i did:
sudo ln -s /usr/share/doc/android-tools/51-android.rules /etc/udev/rules.d/
sudo udevadm control --reload
sudo systemctl enable adb.service
sudo systemctl start adb.service

notes:
fastboot must use sudo or root (sudo su).
meanwhile adb can work without sudo.

1 Like

fastboot should not need to use sudo. This has to be a polkit permission problem. I would be happy for help fixing that.

@vgaetera why would adding the Android udev rules be a security problem?

The rules trigger the ADB service increasing the attack surface which may result in arbitrary code execution by connecting a compromised USB device.

Either enable the rules or the service, using both is redundant.

1 Like

okay so symlinking the rules did something, using the GrapheneOS webinstaller (which unfortunately is not verbose at all) I was able to brick the OS until it hangs. Probably Brave Browser using the systems fastboot which is broken, maybe something else.

If you enable the service, the rules are redundant.
If you use the rules, there’s no need to enable and start the service.

ah, you are right

Have you ever tried this method? I can use fastboot commands without sudo.

or you can install android-udev-rules from copr
https://copr.fedorainfracloud.org/coprs/fulltext/?fulltext=android-udev-rules

1 Like

Cool! I will try that.

Also I will use the cli installer to get an idea of what was happening