[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