# $ADB_VENDOR_KEYS is not set

# Black Lives Matter

# $ADB_VENDOR_KEYS is not set

## Story

I like scrcpy. It allows me to cast my phone to computer and use it ther thanks to cable technology (wifi works too). So, after hopping to Pop_OS! I reinstalled adb and scrcpy. But this time scrcpy didn't work. Instead it throw this error:

> `adb: error: failed to get feature set: device unauthorized.
> This adb server's $ADB_VENDOR_KEYS is not set
> Try 'adb kill-server' if that seems wrong.
> Otherwise check for a confirmation dialog on your device.
> ERROR: "adb push" returned with value 1`

## Easy way | Grant access using prompt on the phone

After enabling USB debugging in Developer options connect phone to computer and run `scrcpy`. Phone should prompt you for granting access to computer. All you have to do is accept and connection will be granted 🎉️

This prompt didn't appear on my phone. As it turns out, that prompt doesn't works as expected on some custom ROMS. After some digging online, I came across this answer on stack overflow. Which leads to a commit message for (new) adb authentication implemented in 2012. This prompt copies ~/.android/adbkey.pub on computer, `$ADB_VENDOR_KEYS`, to `/data/misc/adb/adb_keys` file in phone's memory. since prompt isn't working for me I have to add that key manually 😕️

## Littler harder way | copy-paste using Termux + root

Since `/data/misc/adb/adb_keys` file is offlimits for the user, we need root priviledges for this method.

1. Copy ~/.android/adbkey.pub to phone's memory
2. Open Termux and install sudo > `pkg install tsu`
3. Navigate to where file adbkey.pub is. I'm using Redmi Note 4 and its `/sdcard` directory is used for .
   File is at `/sdcard/adbkey.pub` in my case > `cd /sdcard`
4. Copy `adbkey.pub` to `/data/misc/adb/adb_keys` with sudo priviledges > `sudo cp adbkey.pub /data/misc/adb/adb_keys`
5. Double check if content of `/data/misc/adb/adb_keys` on phone and `~/.android/adbkey.pub` on computer are the same
6. Enjoy 😊️

Your browser does not support the video tag.

## Hard way | copy-paste using TWRP

This is the "no-root" hard method. You will still need root priviledges to edit `/data/misc/adb/adb_keys`. If your phone isn't rooted but has TWRP, GREAT. TWRP has root priviledges and a file manager.

1. Boot into TWRP by holding Vol+ and Power keys while the phone is turned off.
2. Connect phone to computer
3. Copy ~/.android/adbkey.pub to phone's memory
4. Go to Advanced > File manager
5. Navigate to where adbkey.pub was copied to. I am using Redmi Note 4 and MTP connects to `/sdcard` on this device.
6. Copy `adbkey.pub` to `/data/misc/adb/adb_keys`
7. Delete `adb_keys` in
8. Rename `adbkey.pub` to `abd_keys`
9. Double check if content of `/data/misc/adb/adb_keys` on phone and `~/.android/adbkey.pub` on computer are the same
10. Enjoy 😊️

It was a little annoying adventure for me to find where the adbkey.pub suppose to go. I am not immitated with having to do that thing manually. I was annoyed that this information isn't out there in Android documentations and requires reading answers from 2014 on stack overflow.

### I hope this guide was helpful to you 😊️

Day 7 of #100DaysToOffload

## Comments

Toot on this thread to comment. This blog is a static site. Comments won't appear here.

## blogroll

- Kev Quirk
- Mike Stone
- Yarmo Mackenbach

## social

- atom feed
- rss feed
- Fostodon

Ali Murteza Yesil I'm a student, privacy advocate and SysAdmin wannabe. I was born in Turkey but I live abroad. Blogging Open Source Software Privacy