Skip to content

Instantly share code, notes, and snippets.

@MewX
Last active August 20, 2026 10:17
Show Gist options
  • Select an option

  • Save MewX/23c080bce51649180629fcecec3c145e to your computer and use it in GitHub Desktop.

Select an option

Save MewX/23c080bce51649180629fcecec3c145e to your computer and use it in GitHub Desktop.
WSL2 Android USB Connection Cheat Sheet

WSL2 Android USB Connection Cheat Sheet

This guide summarizes how to bridge an Android device from Windows over to WSL2 using usbipd-win and fix permission issues inside Ubuntu.


πŸ› οΈ Step 1: Fix the Windows Service (One-Time Setup)

If you see the error usbipd: warning: The service is currently not running, start the service in an Administrator PowerShell:

# Start the USBIPD service manually
Start-Service usbipd

# Verify it is running (Status should say 'Running')
Get-Service usbipd

πŸ”— Step 2: Attach the Phone from Windows to WSL2

Every time you unplug your phone or restart your computer, you must attach it again using an Administrator PowerShell:

# 1. Find your phone's BUSID (e.g., 1-1)
usbipd list

# 2. Bind the device (Only needed the very first time)
usbipd bind --busid 1-1

# 3. Share the device into WSL2
usbipd attach --wsl --busid 1-1

Note: Your phone will temporarily disappear from Windows and move into WSL2.


🐧 Step 3: Fix Linux Permissions & UDEV (Inside WSL2)

To avoid the slow 60-second warning caused by sudo service udev start, use the direct daemon method instead.

First-Time Setup Only:

# 1. Check if WSL physically sees the phone hardware
lsusb

# 2. Create the Android permission rule file
sudo touch /etc/udev/rules.d/51-android.rules

# 3. Add your device rule (Replace '18d1' with your Vendor ID from lsusb)
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/51-android.rules

Every-Time Routine Command:

# Start the udev daemon cleanly without warnings
sudo /lib/systemd/systemd-udevd --daemon

✨ Optional: Make UDEV start automatically

To stop typing the daemon command manually, add it to your terminal startup profile:

  1. Open your profile: nano ~/.bashrc
  2. Paste this at the bottom: sudo /lib/systemd/systemd-udevd --daemon > /dev/null 2>&1
  3. Save and exit (Ctrl + O, Enter, then Ctrl + X).

πŸ“± Step 4: Restart ADB and Authorize

Finally, restart the ADB server inside WSL2 with root privileges to force it to look for the device:

# Force ADB to restart cleanly
sudo adb kill-server
sudo adb devices

πŸ’‘ Troubleshooting Checklist

  • Phone Screen: Unlock your phone and tap "Allow USB Debugging" when the popup appears.
  • USB Mode: Swipe down your phone notification shade and change the USB mode to File Transfer or PTP if it still isn't showing up.
  • Windows ADB Conflict: If Windows Android Studio is stealing the phone, run adb kill-server in Windows PowerShell first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment