This repository has been archived on 2022-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
blog.old/output/adb_vendor_keys-is-not-set....

186 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>$ADB_VENDOR_KEYS is not set</title>
<link rel="stylesheet" href="https://murtezayesil.me/theme/css/main.css" />
<link rel="stylesheet" href="https://murtezayesil.me/theme/css/tooltip.css" />
<link href="https://murtezayesil.me/feeds/atom.xml" type="application/atom+xml" rel="alternate" title="Ali Murteza Yesil Atom Feed" />
<link href="https://murtezayesil.me/feeds/rss.xml" type="application/rss+xml" rel="alternate" title="Ali Murteza Yesil RSS Feed" />
<!-- This border added via BLACK_LIVES_MATTER toggle in site settings -->
<style>
body {
border-width: 5em ;
border-color: #000000 ;
border-style: none solid solid solid ; /* top border : none, right bottom left : solid */
}
</style>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body id="index" class="home">
<!-- This banner added via BLACK_LIVES_MATTER toggle in site settings -->
<div style="background-color: black; padding: 1em; margin-bottom: .8em">
<h1 style="text-align: center; margin-bottom: 0em"><a href="https://blacklivesmatter.com/" style="color: #fce21b; font-size: 2em">Black Lives Matter</a></h1>
</div>
<header id="banner" class="body">
<h1><a href="https://murtezayesil.me/">Ali Murteza Yesil <strong>Blog</strong></a></h1>
<nav><ul>
<li><a href="https://murtezayesil.me/pages/about.html">About</a></li>
<li><a href="https://murtezayesil.me/pages/contact.html">Contact</a></li>
</ul>
<form id="search" action"#" onsubmit="javascript:window.open('https://duckduckgo.com/?q='+document.getElementById('keywords').value+'+site:https://murtezayesil.me');">
<input id="keywords" type="text" />
</form>
</nav>
<div id="submenu">
<ul>
<li><a href="https://murtezayesil.me/category/draft.html">draft</a></li>
<li class="active"><a href="https://murtezayesil.me/category/notes.html">Notes</a></li>
<li><a href="https://murtezayesil.me/category/personal.html">Personal</a></li>
<li><a href="https://murtezayesil.me/category/tech.html">Tech</a></li>
</ul>
<div>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="https://murtezayesil.me/adb_vendor_keys-is-not-set.html" rel="bookmark"
title="Permalink to $ADB_VENDOR_KEYS is not set">$ADB_VENDOR_KEYS is not set</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<span>Wed 22 July 2020</span>
<span>| in <a href="https://murtezayesil.me/category/notes.html">Notes</a></span>
<span>| tags: <a href="https://murtezayesil.me/tag/android.html">android</a><a href="https://murtezayesil.me/tag/problem.html">problem</a><a href="https://murtezayesil.me/tag/100daystooffload.html">100DaysToOffload</a></span> <span>| Day <strong>7</strong> of #100DaysToOffload</span>
</footer><!-- /.post-info --> <h2>Story</h2>
<p>I like <a href="https://github.com/Genymobile/scrcpy" title="scrcpy by Genymobile - GitHub">scrcpy</a>. It allows me to cast my phone to computer and use it ther thanks to cable technology (wifi works too). So, after hopping to <img src="https://fosstodon.b-cdn.net/custom_emojis/images/000/025/123/static/a76f54a7dbcd8afd.png" width="15em" height="15em"> Pop_OS! I reinstalled adb and scrcpy.
But this time scrcpy didn't work. Instead it throw this error:<br>
<blockquote style="font-style: normal;">
<code>
adb: error: failed to get feature set: device unauthorized.<br>
This adb server's $ADB_VENDOR_KEYS is not set<br>
Try 'adb kill-server' if that seems wrong.<br>
Otherwise check for a confirmation dialog on your device.<br>
ERROR: "adb push" returned with value 1
</code>
</blockquote> </p>
<h2>Easy way | Grant access using prompt on the phone</h2>
<p>After enabling <a href="https://www.howtogeek.com/129728/how-to-access-the-developer-options-menu-and-enable-usb-debugging-on-android-4.2/">USB debugging in Developer options</a> connect phone to computer and run <code>scrcpy</code>. Phone should prompt you for granting access to computer. All you have to do is accept and connection will be granted 🎉️</p>
<hr>
<p>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 <a href="https://stackoverflow.com/a/26309956">this answer on stack <strong>overflow</strong></a>. Which leads to a <a href="https://android.googlesource.com/platform/system/core/+/d5fcafaf41f8ec90986c813f75ec78402096af2d">commit message for (new) adb authentication</a> implemented in 2012. This prompt copies ~/.android/adbkey.pub on computer, <code>$ADB_VENDOR_KEYS</code>, to <code>/data/misc/adb/adb_keys</code> file in phone's memory. since prompt isn't working for me I have to add that key manually 😕️</p>
<h2>Littler harder way | copy-paste using Termux + root</h2>
<p>Since <code>/data/misc/adb/adb_keys</code> file is offlimits for the user, we need root priviledges for this method.</p>
<ol>
<li>Copy ~/.android/adbkey.pub to phone's memory</li>
<li>Open Termux and install sudo &gt; <code>pkg install tsu</code></li>
<li>Navigate to where file adbkey.pub is. I'm using Redmi Note 4 and its <code>/sdcard</code> directory is used for .<br>
File is at <code>/sdcard/adbkey.pub</code> in my case &gt; <code>cd /sdcard</code></li>
<li>Copy <code>adbkey.pub</code> to <code>/data/misc/adb/adb_keys</code> with sudo priviledges &gt; <code>sudo cp adbkey.pub /data/misc/adb/adb_keys</code> </li>
<li>Double check if content of <code>/data/misc/adb/adb_keys</code> on phone and <code>~/.android/adbkey.pub</code> on computer are the same</li>
<li>Enjoy 😊️</li>
</ol>
<video width="720" height="auto" controls="controls">
<source src="https://murtezayesil.me/videos/copying_adb_vendor_keys_using_termux_and_root.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<hr>
<h2>Hard way | copy-paste using TWRP</h2>
<p>This is the "no-root" hard method. You will still need root priviledges to edit <code>/data/misc/adb/adb_keys</code>. If your phone isn't rooted but has TWRP, GREAT. TWRP has root priviledges and a file manager.</p>
<ol>
<li>Boot into TWRP by holding Vol+ and Power keys while the phone is turned off.</li>
<li>Connect phone to computer</li>
<li>Copy ~/.android/adbkey.pub to phone's memory</li>
<li>Go to Advanced &gt; File manager</li>
<li>Navigate to where adbkey.pub was copied to. I am using Redmi Note 4 and MTP connects to <code>/sdcard</code> on this device.</li>
<li>Copy <code>adbkey.pub</code> to <code>/data/misc/adb/adb_keys</code></li>
<li>Delete <code>adb_keys</code> in </li>
<li>Rename <code>adbkey.pub</code> to <code>abd_keys</code></li>
<li>Double check if content of <code>/data/misc/adb/adb_keys</code> on phone and <code>~/.android/adbkey.pub</code> on computer are the same</li>
<li>Enjoy 😊️</li>
</ol>
<p><img alt="SCRCPY is casting Android phone's screen on to computer after manually copying computer's adbkey.pub file to phone's adb_keys file" src="images/scrcpy_casting_android_to_computer.png" title="scrcpy is finally working"></p>
<hr>
<p>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 <strong>overflow</strong>.</p>
<h3>I hope this guide was helpful to you 😊️</h3>
</div><!-- /.entry-content -->
<!-- #100DaysToOffload message -->
<p>Day <strong>7</strong> of <a href="https://100daystooffload.com/" title="click to read about the challenge">#100DaysToOffload</a></p>
<!-- Comments -->
<hr>
<h2>Comments</h2>
<p>Toot on <a href="https://fosstodon.org/@murtezayesil/104558575376752243">this thread</a> to comment. This blog is a static site. Comments won't appear here.</p>
</article>
</section>
<section id="extras" class="body">
<div class="blogroll">
<h2>blogroll</h2>
<ul>
<li><a href="https://kevq.uk">Kev Quirk</a></li>
<li><a href="https://mikestone.me">Mike Stone</a></li>
<li><a href="https://yarmo.eu/">Yarmo Mackenbach</a></li>
</ul>
</div><!-- /.blogroll -->
<div class="social">
<h2>social</h2>
<ul>
<li><a href="https://murtezayesil.me/feeds/atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
<li><a href="https://murtezayesil.me/feeds/rss.xml" type="application/rss+xml" rel="alternate">rss feed</a></li>
<li><a href="https://fosstodon.org/@murtezayesil" rel="me">Fostodon</a></li>
</ul>
</div><!-- /.social -->
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<p>Powered by <a href="http://getpelican.com/">Pelican</a>. Theme <a href="https://github.com/blueicefield/pelican-blueidea/">blueidea</a>, inspired by the default theme.</p>
</footer><!-- /#contentinfo -->
<!-- IndieWeb Profile -->
<!-- ToDo : Make IndieWeb Profile auto generating according to site preferences -->
<!-- This profile is created by following https://kevq.uk/how-to-create-an-indieweb-profile/ blog post. Thanks to Kev Quirk -->
<section style="display: none;" class="h-card">
<!-- About me -->
<span class="p-name">Ali Murteza Yesil</span>
<span class="p-note">I'm a student, privacy advocate and SysAdmin wannabe. I was born in Turkey but I live abroad.</span>
<!-- Profile picture -->
<img class="u-photo" src="https://murtezayesil.me/images/avatar_polygon_128x128.png"/>
<!-- My location -->
<!-- <span class="p-locality">City, Country or Country</span> -->
<!-- Links -->
<a class="u-url u-uid" href="https://murtezayesil.me"></a>
<!-- Mail Template <a class="u-email" rel="me" href="mailto:USERNAME@SERVICEPROVIDER"></a> -->
<a class="u-url" rel="me" href="https://fosstodon.org/@murtezayesil"></a>
<!-- Twitter Example <a class="u-url" rel="me" href="https://twitter.com/USERNAME"></a> -->
<!-- Template <a class="u-url" rel="me" href="https://URL"></a> -->
<!-- Categories -->
<span class="p-category">Blogging</span>
<span class="p-category">Open Source Software</span>
<span class="p-category">Privacy</span>
</section>
</body>
</html>