[HOWTO] Installing adb, fastboot & heimdall on Mageia Linux and getting them to work

Most guides for Linux are exclusively Ubuntu-focused, so I’m sharing my experience as a Mageia 8 Linux user. This info may apply to other RPM-based or at least Fedora-based Linux distributions, your mileage may vary.

  1. Download Android Debug Bridge.
  2. Extract it somewhere.
  3. To be able to use the ADB commands from any terminal window without typing the whole route to the directory where you extracted them, open the file ~/.bash_profile and add this at the end (changing the route to the place where you’ve extracted ADB):
if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
 export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi
  1. Now connect your device to a USB port on your computer, execute the command ‘lsusb’ in a terminal and take note of the vendor and device ID for your device. The command should show something like this (among other entries):
    Bus 001 Device 009: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode)
    In this case 04e8 is the vendor ID for Samsung and 6860 is the device ID for Samsung Galaxy S9 GM-690F.
  2. With a simple text editor, write up a file named 51-android.rules with this content:
> SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]", MODE="0660", GROUP="adbusers"
> SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_adb"
> SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_fastboot"

Replace only [VENDOR ID] and [PRODUCT ID] with the IDs retrieved through lsusb.

  1. As superuser, place the file 51-android.rules in the directory /etc/udev/rules.d of your Linux system. If the file already exists, merely add the text to the end. Make sure the file has a+r permissions (world-readable).
  2. To be able to use adb and fastboot as regular user rather than superuser, create a new user group ‘adbusers’ creating the file /usr/lib/sysusers.d/android-udev.conf with this content:
    g adbusers - -
    Then you must put your regular user in that group with this command:
    gpasswd -a $(whoami) adbusers
    In case of doubt check the man page for sysusers.d.
  3. Finally restart all affected services (UDEV & ADB) with these commands:
    udevadm control --reload-rules
    systemctl restart systemd-udevd.service
    adb kill-server
    To be double sure log out and back again. Now you shoud see your device if you type this:
    adb devices
  4. For Samsung devices you must use Heimdall rather than fastboot, so you’ll have to download and extract it (if possible to the same “platform-tools” directory where you put adb and fastboot) and you won’t need the line ending with =“android_fastboot”, but the rest is the same.
  5. After you flash a custom ROM like /e/OS, it may happen that you get the message “no permissions; see [http://developer.android.com/tools/device.html]” when you run adb devices. This may happen if the ROM changes the vendor and device IDs; in that case, simply run lsusb again, note the new IDs and add them to 51-android.rules.
2 Likes

I have also a problem with installing Adb and Fastboot on Linux Mint 21.3
What did i wrong?

map platform tools
where to find the bashrc file

In Debian, having extracted platform-tools to my home directory (as you did, I think) my entry in ~/.bashrc reads:

export PATH="$HOME/platform-tools:$PATH"

Edit
And it is placed at the bottom of ~./bashrc not the top.

As you are using Linux Mint you will not need some of the complexity of this [HOWTO] hence my link to this page https://doc.e.foundation/pages/install-adb.

Thank you, but my home directory i have a map called michielp80 and their i would find the .bashrc file.
When i typ ./adb devices i got the message that the file of map do not excist.

I am sorry, I do not understand. Does it help to show the message itself from ./adb devices ?

It seems you found the ~/.bashrc file (I think?). Files starting with dot are hidden files, so in a file manager you may have to enable “Show hidden files”.

If you

cd platform-tools

Then run the commands as ./adb devices no entry is required in ~/.bashrc.

This is because ./ requests the command from this folder only.

The entry in your image of ~/.bashrc looks wrong. What happens if you remove this entry in ~/.bashrc then try as above?

This would be a first step to test.


Only if this test works with no error, then you could add the required entry to the foot of ~/.bashrc.

Now in your home directory (or any other folder) ‘adb devices’ (without any ./ ) is expected to work.