Android Phone USB Reverse Tethering & share Screen via ADB (scrcpy)

Hey guys… Maybe a crazy idea but would it be possible to configure this constellation?

  • Phone connected via USB Cable
  • Phone gets Internet from a Net Cube (e.g. VPN Cube)
  • Mirror the Phone Screen to the Qube which it is connected to via ADB (scrcpy)

So basically I want to use it like Waydroid but in the Backend it is a real Android Device (e.g. Pixel with GrapheneOS and no SIM)…

Edit:

Gnirehtet (also from Genymobile) can provide Tethering from Linux to Android…

So I would need another USB Qube but with Network Connection… Then I would pass the USB device to this Qube and hope that gnirehtet and scrcpy work together…

Could I pass the Android Phone automatically to a specific Qube upon connect?

I don’t think a phone can connect to the Internet through USB, maybe using a proxy over tcp over usb?

adb does not work on Qubes OS with USB passthrough :confused:

I added some Info, it can! It is called reverse tethering and can be achieved with gnirehtet (which reads backwards as “tethering”)…

Okay, so if ADB would not work with passing a USB device to a Qube I guess it would work with passing the whole USB Controller like in the Standard USB Qube?

You can connect the phone to the Qubes OS using Ethernet. You can also use dock station with ethernet and PD to be able to charge the phone while connected to ethernet.
Connect USB Ethernet adapter to the phone and then connect it to the Qubes OS machine using ethernet cable.
Create a sys-net-share qube with Ethernet controller attached to it to which the phone is connected.
Set sys-net-share net qube to the net qube that you want to use to provide the network for the phone.
Use Network Manager in sys-net-share to create a new Ethernet connection and in IPv4 Settings set the method to “Shared to other computers”.
Then configure the firewall to accept the DHCP requests from the phone and configure the dnat-dns rules to pass the requests from the connected phone to the Qubes OS virtual DNS servers.

Maybe you can install some VNC server or something similar and connect to it using the network.

Okay, already thought about that, as I have both USB-Ethernet Adapter and Type-C Dock with Ethernet… But usually I have only one LAN Port and it could be occupied already for the Host Network… So I would need two USB-Ethernet Adapters… VNC would work for controlling the device…

But I guess I’ll try the scrpy/gnirehtet variant with a single USB Cable first…

Working Reverse Tethering & Screen Mirroring Qube for Android Device

  1. Create Template Qube from fedora-40-xfce Template

  2. Install scrcpy with

sudo dnf copr enable zeno/scrcpy && sudo dnf install scrcpy
  1. Create App Qube from the Template we just created

  2. Passthrough USB Controller to App Qube, switch Virt Mode to hvm

  3. Run Terminal on App Qube

  4. Install homebrew with

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install gnirehtet with
brew install gnirehtet
  1. Enable Developer Settings & USB Debugging on Android Device
  2. Connect Android Device via USB
  3. Run
sudo adb devices

And authorize PC on Android Device

  1. Start Reverse Tethering with
gnirehtet run

and accept VPN Connection Window on Android Device

  1. Run scrcpy from Start Menu

Now I installed everything to a template and created an App Qube from the template but I can only use scrcpy…

Brew and gnirehtet is not available in the App Qube… How can I fix it?

Update:

Had to install scrcpy in Template but gnirehtet in App Qube!