<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>apac-rmのブログ</title>
<link>https://ameblo.jp/apac-rm/</link>
<atom:link href="https://rssblog.ameba.jp/apac-rm/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>自宅でITインフラ技術（linux/仮想化技術）を触った記録を掲載。</description>
<language>ja</language>
<item>
<title>自宅SV(RockyLinux9.8)でredroidを動作させてみた。</title>
<description>
<![CDATA[ <p>&nbsp;</p><h2 class="limited038_heading01" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited038_heading01" data-entrydesign-tag="h2" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="margin:4px 0;font-weight:bold;color:#333;font-size:20px;line-height:1.6;min-height:32px;overflow-wrap:break-word;text-align:left;border-left:8px solid #674D05"><span style="display:block"><span data-entrydesign-content="" style="display:block;padding:4px 8px">環境</span><span class="amp-nodisplay" contenteditable="false" role="presentation"><span style="display:block;width:100%;height:6px;border-top:1px solid #674D05;border-right:1px solid #674D05;border-bottom:1px solid #674D05;box-sizing:border-box">&nbsp;</span></span></span></h2><p>&nbsp; &nbsp;＜クライアントPC：RockyLinux9.8 + Xorg+Openbox+xfdesktop＞</p><p>&nbsp; &nbsp; &nbsp;192.168.20.117&nbsp;</p><p>&nbsp; &nbsp; &nbsp; -----+--------</p><p>&nbsp;　&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</p><p>&nbsp; &nbsp; &nbsp; -----+-------</p><p>&nbsp; &nbsp; 192.168.20.118　　</p><p>　　docker0: 172.17.0.1</p><p>　　 +</p><p>　　｜</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reroid:172.17.0.2</p><p>&nbsp;　＜ゲストOS：RockyLInux9.8 minimal＞</p><p>&nbsp; &nbsp; &nbsp;----------------</p><p><span>　＜ホストVM: ESXi6.5 (vm:cpu 4コア,mem:4G)＞</span></p><p><span>&nbsp; &nbsp; &nbsp;---------------</span></p><h2 class="ameba_heading03" data-entrydesign-alignment="center" data-entrydesign-count-input="part" data-entrydesign-part="ameba_heading03" data-entrydesign-tag="h2" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="margin:8px 0;font-weight:bold;color:#08121A;font-size:20px;line-height:1.6;min-height:32px;overflow-wrap:break-word;text-align:center;background:url(https://stat100.ameba.jp/ameblo/entry_designs/v1/sources/assets/ameba_heading03_underline.png) no-repeat;background-position:center bottom;background-size:72px 10px;padding-bottom:14px"><span style="display:block"><span data-entrydesign-content="" style="display:block">失敗例から</span></span></h2><p>失敗なので、短めに書きます。</p><p>&nbsp;</p><p>(1)クライアントPC：&nbsp;android-tools をインストール</p><p>(2)ホストVM：</p><p>　①7.3.1-1.el9.elrepo.x86_64　へカーネルを変更 ※dnfで実施　（android機能への対応のため）</p><p>　②docker をインストール</p><p>　③redroid 用コンテナを起動</p><p>(3)クライアントPC： adb connect 192.168.20.118 → no route to host</p><p>&nbsp;</p><p>※もちろん、firewalld や クライアント・ホスト間ipレイヤのルーティングは問題なし</p><p>→色々切り分けると、ホスト側docker redroidのnetd が kernelモジュール(Binder)を読み込めずにクラッシュしていることが発覚</p><p>→ホスト側でmodprobe,modinfoなどでロードしているモジュールを確認すると、binderはロードされておらず、個別コンパイルも不可の状況</p><p>&nbsp;</p><p>&nbsp;</p><h2 class="limited005_heading" data-entrydesign-alignment="center" data-entrydesign-count-input="part" data-entrydesign-part="limited005_heading" data-entrydesign-tag="h2" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="background:url(https://stat100.ameba.jp/ameblo/entry_designs/v1/sources/assets/limited005_heading_underline.png) no-repeat;background-size:89px 19px;padding-bottom:23px;margin:8px 0;font-weight:bold;color:#3E598E;letter-spacing:0.01em;font-size:20px;line-height:1.3;min-height:26px;line-break:loose;word-break:break-word;background-position:center bottom;text-align:center"><span style="display:block"><span data-entrydesign-content="" style="display:block">成功した構築例</span></span></h2><p>&nbsp;</p><h2 class="limited037_heading04" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited037_heading04" data-entrydesign-tag="h2" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px 0;font-weight:bold;color:#333;font-size:20px;line-height:1.6;min-height:32px;overflow-wrap:break-word;justify-content:flex-start;text-align:left">(全体の流れ)RockyLinux９.８へ　Redroido（docker)をインストール</h2><p><br>1. カーネルソース取得<br>2. 現在の設定を流用<br>3. Binder / BinderFS有効化<br>4. ビルド<br>5. インストール<br>6. Binderデバイス作成<br>7. Redroid再起動　（※事前にdockerのインストール）<br>8. Clientからadbおよびscrcpyで接続<br>&nbsp;</p><h3 class="limited009_heading" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited009_heading" data-entrydesign-tag="h3" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px auto;font-weight:bold;color:#333;letter-spacing:0.01em;font-size:20px;line-height:1.4;min-height:28px;overflow-wrap:break-word;word-break:break-word;box-sizing:border-box;border-bottom:2px dotted #9CDDEF;padding-bottom:8px;justify-content:flex-start;text-align:left"><span style="background:url(https://stat100.ameba.jp/ameblo/entry_designs/v1/sources/assets/limited009_check.png) 0 5px no-repeat;background-size:20px 22px;padding-left:28px;min-height:22px;display:block"><span data-entrydesign-content="" style="display:block">カーネルコンパイル</span></span></h3><p><br>##開発ツールなど必要ツールのインストール<br>sudo dnf groupinstall -y "Development Tools"<br>sudo dnf install -y \<br>gcc gcc-c++ make ncurses-devel \<br>bison flex elfutils-libelf-devel \<br>openssl-devel rpm-build bc rsync<br>sudo dnf install wget<br><br>##ソース取得<br>su -</p><p>cd /usr/src<br>wget https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-7.3.1.tar.xz<br>tar -xf linux-7.3.1.tar.xz<br>cd linux-7.3.1<br><br>##Make<br>#現在の設定コピー<br>cp /boot/config-$(uname -r) .config<br><br>#makeの設定<br>make menuconfig<br># --- 以下の設定を有効化--- #<br>Device Drivers<br>&nbsp;└ Android<br>CONFIG_ANDROID=y<br>CONFIG_ANDROID_BINDER_IPC=y<br>CONFIG_ANDROID_BINDERFS=y<br>CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"<br>## ----- ##<br><br>#Configへ反映<br>make olddefconfig<br>#コンパイル<br>make -j2 2&gt;&amp;1 | tee make.log<br>#モジュールのインストール<br>make modules_install<br>#カーネルのインストール&nbsp;<br>make install<br><br>#新しい、カーネルがロードされるかどうかを確認<br>uname -r<br>&nbsp;7.3.1-1.el9.elrepo.x86_64<br><br>grubby --info=ALL<br>&nbsp;index=1<br>kernel="/boot/vmlinuz-7.3.1"grubby --default-kernel<br>/boot/vmlinuz-7.3.1<br>...<br><br>grubby --default-kernel<br>/boot/vmlinuz-7.3.1<br><br>#再起動&nbsp;<br>reboot&nbsp;<br><br>#カーネルバージョン確認(7.3.1となっていること）<br>uname -r&nbsp;<br><br>&nbsp;</p><h3 class="limited009_heading" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited009_heading" data-entrydesign-tag="h3" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px auto;font-weight:bold;color:#333;letter-spacing:0.01em;font-size:20px;line-height:1.4;min-height:28px;overflow-wrap:break-word;word-break:break-word;box-sizing:border-box;border-bottom:2px dotted #9CDDEF;padding-bottom:8px;justify-content:flex-start;text-align:left"><span style="background:url(https://stat100.ameba.jp/ameblo/entry_designs/v1/sources/assets/limited009_check.png) 0 5px no-repeat;background-size:20px 22px;padding-left:28px;min-height:22px;display:block"><span data-entrydesign-content="" style="display:block">モジュールロード</span></span></h3><p>--- Binder デバイスの作成 ---<br># マウント先ディレクトリの作成<br>sudo mkdir -p /dev/binderfs<br><br># binderfsをマウント（これにより、必要なデバイスがディレクトリ内に自動生成されます）<br>sudo mount -t binder binder /dev/binderfs<br><br>#確認<br>ls -l /dev/binderfs/<br>crw-------. 1 root root 241, 1 11月 &nbsp;4 09:52 binder<br>crw-------. 1 root root 241, 0 11月 &nbsp;4 09:52 binder-control<br>drwxr-xr-x. 2 root root &nbsp; &nbsp; &nbsp;0 11月 &nbsp;4 09:52 features<br>crw-------. 1 root root 241, 2 11月 &nbsp;4 09:52 hwbinder<br>crw-------. 1 root root 241, 3 11月 &nbsp;4 09:52 vndbinder<br>&nbsp;</p><h3 class="limited009_heading" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited009_heading" data-entrydesign-tag="h3" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px auto;font-weight:bold;color:#333;letter-spacing:0.01em;font-size:20px;line-height:1.4;min-height:28px;overflow-wrap:break-word;word-break:break-word;box-sizing:border-box;border-bottom:2px dotted #9CDDEF;padding-bottom:8px;justify-content:flex-start;text-align:left"><span style="background:url(https://stat100.ameba.jp/ameblo/entry_designs/v1/sources/assets/limited009_check.png) 0 5px no-repeat;background-size:20px 22px;padding-left:28px;min-height:22px;display:block"><span data-entrydesign-content="" style="display:block">docker(redroid)起動</span></span></h3><p>--reroid起動--<br><br>#secureLinuxをOFF<br>sudo getenforce&nbsp;<br>→Enforcingなら以下<br>sudo setenforce 0<br><br>#以前に古いdockerで作成したことがあれば一度削除<br>docker rm -f redroid<br><br>ーーdockerインストール---<br>sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo<br>sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin<br>sudo systemctl enable --now docker<br>sudo usermod -aG docker $USER<br>sudo shutdown -r now<br><br>--redroidコンテナを作成---<br><br>#reroid作成/run<br>docker run -d --privileged &nbsp; &nbsp; --name redroid &nbsp; &nbsp; -v ~/data:/data:z &nbsp; &nbsp; -p 0.0.0.0:5555:5555 &nbsp; &nbsp; redroid/redroid:13.0.0-latest &nbsp; &nbsp; androidboot.use_metadata_allocator=1 &nbsp; &nbsp; androidboot.hardware=redroid &nbsp; &nbsp; androidboot.use_memfd=sudo dnf install growpart<br><br><br>sudo docker ps<br>CONTAINER ID &nbsp; IMAGE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COMMAND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATED &nbsp; &nbsp; &nbsp; &nbsp; STATUS &nbsp; &nbsp; &nbsp; &nbsp; PORTS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NAMES<br>8dee5577120f &nbsp; redroid/redroid:13.0.0-latest &nbsp; "/init qemu=1 androi…" &nbsp; 6 seconds ago &nbsp; Up 5 seconds &nbsp; 0.0.0.0:5555-&gt;5555/tcp &nbsp; redroid<br><br>---firewall設定---<br>sudo systemctl stop firewalld&nbsp;<br>※ちゃんと、5555ポートのみを許可する場合は調べて設定のこと<br><br>--reroid内部の確認---<br>docker exec -it redroid sh<br><br>getprop service.adb.tcp.port<br><br><br>##以下実ログ<br>docker exec -it redroid sh<br>8dee5577120f:/ # getprop service.adb.tcp.port<br><br>8dee5577120f:/ # getprop | grep adb<br>[init.svc.adbd]: [running]<br>[init.svc_debug_pid.adbd]: [111]<br>[persist.adb.wifi.guid]: [adb-wBnlcZLNpHuOZOOM-OcwCLe]<br>[persist.sys.usb.config]: [adb]<br>[ro.adb.secure]: [0]<br>[ro.boottime.adbd]: [770463322084]<br>[sys.usb.config]: [adb]<br>[sys.usb.state]: [adb]<br>8dee5577120f:/ # ip route<br>172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.2&nbsp;<br>8dee5577120f:/ # ss -lnt<br>State &nbsp; &nbsp; &nbsp; Recv-Q Send-Q Local Address:Port &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Peer Address:Port &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>LISTEN &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*:5555 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *:* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>8dee5577120f:/ # getprop init.svc.netd<br>running<br>8dee5577120f:/ #&nbsp;<br>&nbsp;</p><h3 class="limited009_heading" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited009_heading" data-entrydesign-tag="h3" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px auto;font-weight:bold;color:#333;letter-spacing:0.01em;font-size:20px;line-height:1.4;min-height:28px;overflow-wrap:break-word;word-break:break-word;box-sizing:border-box;border-bottom:2px dotted #9CDDEF;padding-bottom:8px;justify-content:flex-start;text-align:left"><span style="background:url(https://stat100.ameba.jp/ameblo/entry_designs/v1/sources/assets/limited009_check.png) 0 5px no-repeat;background-size:20px 22px;padding-left:28px;min-height:22px;display:block"><span data-entrydesign-content="" style="display:block">クライアント側のインストール</span></span></h3><p><br>===Client側====<br>#必要ソフトインストール<br>sudo dnf install -y android-tools<br>sudo dnf install -y ninja-build pkgconfig SDL2-devel ffmpeg-devel libusb1-devel --skip-broken<br>sudo dnf install ffmpeg-devel --allowerasing<br><br>#scrcpy ソースインストール<br>git clone https://github.com/Genymobile/scrcpy.git<br>cd /usr/local/src/scrcpy<br><br>#一括インストールシェル<br>./install_release.sh<br><br>adb connect 192.168.20.118:5555<br><br>#起動<br>scrcpy --keyboard=uhid --audio-codec=aac<br><br>→uhidがエラーとなる場合は,--keybordは除いて起動<br><br>&nbsp;</p><h2 class="limited037_heading04" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited037_heading04" data-entrydesign-tag="h2" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px 0;font-weight:bold;color:#333;font-size:20px;line-height:1.6;min-height:32px;overflow-wrap:break-word;justify-content:flex-start;text-align:left">（参考）日本語化</h2><p>&nbsp;</p><p><br><br>■ホスト側でuhidのを許可<br>docker exec -it redroid sh<br>8dee5577120f:/ # chmod 666 /dev/uhid<br><br>■日本語のインストール<br>adb install Gboard.apk　# 適切な最新版をクライアント側でダウンロードしてadbでインストール<br><br>■確認<br>adb shell ime list -s<br><br>※なお、必要なソフトウェアのxxxx.apkファイルをクライアントに落としてきて、<br>adb install xxxx.apk　<br>で概ねのソフトウェアはインストール可能<br>&nbsp;</p><h2 class="limited037_heading04" data-entrydesign-alignment="left" data-entrydesign-count-input="part" data-entrydesign-part="limited037_heading04" data-entrydesign-tag="h2" data-entrydesign-type="heading" data-entrydesign-ver="1.54.1" style="display:flex;margin:8px 0;font-weight:bold;color:#333;font-size:20px;line-height:1.6;min-height:32px;overflow-wrap:break-word;justify-content:flex-start;text-align:left">＝＝＝＝＝(参考）トラブルシュート用※主に通信関係＝＝＝＝＝</h2><p>&nbsp;</p><p><br>#dockerのすべてのコンテナを確認する<br>sudo docker ps -a<br><br>#redroidの中のIProute<br>docker exec redroid ip route<br><br>#redroidのリッスンポート確認<br>docker exec redroid sh -c "ss -lnt"<br>State &nbsp; &nbsp; &nbsp; Recv-Q Send-Q Local Address:Port &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Peer Address:Port &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>LISTEN &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*:5555 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *:* &nbsp; &nbsp;<br><br>#redroid から ping<br>docker exec redroid ping -c 3 172.17.0.1<br><br>#コンテナ内に入ってから詳細にNW系ログを確認するコマンド<br>logcat -d | grep -iE "netd|network|eth0|route"<br><br>#悪かった実績のあるnetdのサービス状態の確認<br>getprop init.svc.netd<br>または<br>docker exec redroid getprop init.svc.netd<br><br>#docker内部のログの確認　（今回は主にnetdのエラーログ解析用)<br>docker exec redroid sh<br>logcat -b crash -d | tail -100<br>logcat -d | grep -A20 -B20 "netd"<br><br>→　Binderがカーネルで有効化されていなかったので、netd起動時にbinder読み込み不可でエラーとなっていた<br><br>=== カーネル関係切り分け ===<br>find /lib/modules/$(uname -r) -name '*binder*'<br>grep BINDER /boot/config-$(uname -r)<br><br>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/apac-rm/entry-12983620744.html</link>
<pubDate>Thu, 05 Nov 2026 00:25:55 +0900</pubDate>
</item>
</channel>
</rss>
