[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74903":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},74903,"linux-android","mayukh4\u002Flinux-android","mayukh4","A script that sets up linux on your anroid device via termux","https:\u002F\u002Fyoutu.be\u002FtYm2rQpkOcg?si=GNAQU0WADxRXwnG7",null,"Shell",1919,159,11,1,0,6,13,216,18,80.11,false,"main",true,[],"2026-06-12 04:01:16","# Repurpose Your Old Android Phone\n\nTurn any old Android phone into a **Linux desktop** or a **smart home server** — no PC, no root, no cloud. Just [Termux](https:\u002F\u002Ftermux.dev).\n\n> Created to accompany a YouTube video walkthrough. Timestamps are referenced in the video description.\n\n```mermaid\ngraph LR\n    A[\"📱 Old Android Phone\u003Cbr\u002F>+ Termux\"] --> B[\"🖥️ Linux Desktop\u003Cbr\u002F>\u003Ci>termux-linux-setup.sh\u003C\u002Fi>\"]\n    A --> C[\"🏠 Smart Home Server\u003Cbr\u002F>\u003Ci>setup-homeassistant.sh\u003C\u002Fi>\"]\n    B --> D[\"GPU-accelerated DE\u003Cbr\u002F>Firefox, VLC, SSH, Wine\"]\n    C --> E[\"Home Assistant Core\u003Cbr\u002F>Control lights & plugs\"]\n```\n\n### Pick your path\n\n| | Linux Desktop | Smart Home Server |\n|---|---|---|\n| **What** | Full GUI desktop environment on your phone | Home Assistant hub that controls WiFi devices |\n| **Use cases** | Learning Linux, Python dev, SSH server, web browsing, media | Control smart lights\u002Fplugs, automation, dashboards |\n| **Script** | `bash termux-linux-setup.sh` | `bash setup-homeassistant.sh` |\n| **Time** | 10–30 min | 15–45 min |\n| **Jump to** | [Desktop setup](#installation) | [Home Assistant setup](#home-assistant--smart-home-server) |\n\nYou can run both on the same phone — they don't conflict.\n\nYou can follow along the YouTube video here: https:\u002F\u002Fyoutu.be\u002FtYm2rQpkOcg?si=moV59vk5J7B4h46N\n\n\u003Cimg width=\"1600\" height=\"900\" alt=\"mayukh_builds (3)\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fbb2efabe-ffff-4098-ba58-45d1e68a6aaf\" \u002F>\n\n---\n\n## Requirements\n\n### Hardware\n- Android phone with an **arm64 (64-bit)** processor\n- **3 GB+ RAM** recommended (4 GB+ for KDE Plasma)\n- **5–10 GB** of free storage (more if you install Wine)\n- A **Qualcomm Snapdragon** chip is ideal — it enables the best GPU acceleration (Turnip\u002FAdreno). The script works on Mali\u002Fother GPUs too but performance will be lighter.\n\n### Software\n| App | Where to Get It |\n|---|---|\n| **Termux** | [F-Droid](https:\u002F\u002Ff-droid.org\u002Fen\u002Fpackages\u002Fcom.termux\u002F) — **do not use the Play Store version, it is outdated** |\n| **Termux-X11** | [GitHub Releases](https:\u002F\u002Fgithub.com\u002Ftermux\u002Ftermux-x11\u002Freleases) — download the latest `.apk` |\n\n> **Note on rooting \u002F custom ROMs:** This script works on stock Android too. The video demonstrates it running on **LineageOS** on a OnePlus 5T. Rooting is not required by the script itself.\n\n---\n\n## Desktop Environments — Which One to Choose?\n\n| # | Desktop | Best For | Resource Usage |\n|---|---|---|---|\n| 1 | **XFCE4** *(default)* | Most users. Fast, customizable, macOS-style dock | Low–Medium |\n| 2 | **LXQt** | Old or low-RAM phones (2–3 GB) | Very Low |\n| 3 | **MATE** | Classic desktop feel | Medium |\n| 4 | **KDE Plasma** | Powerful phones only — Windows 11 style | High |\n\nIf you're unsure, go with **XFCE4**.\n\n---\n\n## Installation\n\n### Step 1 — Install required apps\n\nInstall **Termux** from F-Droid and **Termux-X11** from GitHub (links above). Grant both apps any permissions they request.\n\n### Step 2 — Pre-upgrade Termux (important — do this first)\n\nOpen Termux and run:\n\n```bash\ntermux-wake-lock\npkg upgrade -y\n```\n\nThe `termux-wake-lock` command keeps Termux alive when your screen turns off — without it, Android can kill the process mid-install. The `pkg upgrade` brings your base system up to date before the script runs, preventing a known crash involving `libpcre` and `libandroid-selinux`.\n\n### Step 3 — Download and run the script\n\n```bash\ncurl -O https:\u002F\u002Fraw.githubusercontent.com\u002Fmayukh4\u002Flinux-anroid\u002Fmain\u002Ftermux-linux-setup.sh\nchmod +x termux-linux-setup.sh\nbash termux-linux-setup.sh\n```\n\nThe script will ask you to choose a desktop environment and whether you want Wine. Everything else is automatic.\n\nInstallation takes **10–30 minutes** depending on your internet speed. A full log is saved to `~\u002Ftermux-setup.log` if anything goes wrong.\n\n### Step 4 — Start your desktop\n\n```bash\nbash ~\u002Fstart-linux.sh\n```\n\nThen **open the Termux-X11 app** on your phone. Your Linux desktop will appear inside it.\n\nTo stop:\n\n```bash\nbash ~\u002Fstop-linux.sh\n```\n\n---\n\n## What Gets Installed\n\n| Component | Details |\n|---|---|\n| **Termux-X11** | Display server — renders your desktop on screen |\n| **Desktop Environment** | Your choice: XFCE4, LXQt, MATE, or KDE |\n| **Mesa \u002F Zink** | OpenGL via Vulkan — enables GPU-accelerated graphics |\n| **Turnip driver** | Qualcomm Adreno open-source Vulkan driver (if detected) |\n| **PulseAudio** | Audio server |\n| **Firefox** | Full desktop web browser |\n| **VLC** | Video and audio player |\n| **Git, wget, curl** | Standard developer tools |\n| **Python 3 + pip** | Python runtime and package manager |\n| **OpenSSH** | SSH server and client — remote access from your PC |\n| **Wine** *(optional)* | Run Windows x86 apps via Hangover + Box64 |\n\n---\n\n## GPU Acceleration\n\nThe script detects your GPU automatically using hardware properties (not brand name — Samsung ships both Adreno and Mali phones depending on region, so brand detection is unreliable).\n\n**Qualcomm Adreno (Snapdragon phones):** Uses the open-source **Turnip** Vulkan driver + **Zink** (OpenGL on Vulkan). Near-native GPU performance.\n\n**Mali \u002F Other GPUs:** Falls back to **Zink + SwRast** (software Vulkan). Functional but lighter desktops (XFCE4, LXQt) are strongly recommended.\n\nThe GPU environment is saved in `~\u002F.config\u002Flinux-gpu.sh` and loaded automatically on every `start-linux.sh`. You can edit that file to tweak Mesa flags.\n\n---\n\n## SSH — Access Your Phone from a PC or Laptop\n\nOpenSSH is installed automatically by the script. This lets you SSH into your phone from any computer on the same Wi-Fi network — useful for running commands, transferring files, or doing development work on a proper keyboard.\n\n### First-time SSH setup\n\nOpen a terminal in Termux (not inside the desktop — the regular Termux app) and run:\n\n```bash\n# Start the SSH server\nsshd\n\n# Set your Termux password (you'll use this to log in over SSH)\npasswd\n```\n\nFind your phone's IP address:\n\n```bash\nip addr show wlan0 | grep 'inet '\n```\n\nThe output will look like `inet 192.168.1.42\u002F24` — your IP is the part before the `\u002F`.\n\n### Connect from your PC or laptop\n\nOn your computer (Linux, macOS, or Windows with Terminal):\n\n```bash\nssh your-termux-username@192.168.1.42 -p 8022\n```\n\n> **Port 8022** is the default Termux SSH port (not the standard port 22, which requires root).\n\nTo find your Termux username, run `whoami` in Termux. On most setups it will be something like `u0_a123`.\n\n### Simplified login with SSH config (optional)\n\nOn your PC, add this to `~\u002F.ssh\u002Fconfig` to avoid typing the full command every time:\n\n```\nHost myphone\n    HostName 192.168.1.42\n    User u0_a123\n    Port 8022\n```\n\nThen you can connect with just:\n\n```bash\nssh myphone\n```\n\n### File transfer with SCP or SFTP\n\nCopy a file from your PC to your phone:\n\n```bash\nscp -P 8022 myfile.txt u0_a123@192.168.1.42:~\u002F\n```\n\nCopy a file from your phone to your PC:\n\n```bash\nscp -P 8022 u0_a123@192.168.1.42:~\u002Fsomefile.txt .\u002F\n```\n\nOr use any SFTP client (like FileZilla or Cyberduck) — connect to the same IP and port 8022.\n\n### Keep SSH running when you close Termux\n\nBy default `sshd` stops when Termux is closed. To keep it running persistently:\n\n```bash\n# Add to your ~\u002F.bashrc so sshd auto-starts whenever Termux opens\necho 'sshd 2>\u002Fdev\u002Fnull' >> ~\u002F.bashrc\n```\n\n---\n\n## Windows App Support (Wine)\n\nIf you chose to install Wine, it uses **Hangover Wine** with **Box64** to translate Windows x86 calls to ARM64. Simple tools and utilities tend to work; heavy software or games may not.\n\nTo configure Wine, run `winecfg` in your desktop terminal or click the Wine Config shortcut on your desktop.\n\n---\n\n## Home Assistant — Smart Home Server\n\nTurn your old Android phone into an **always-on smart home hub** that controls WiFi smart lights, plugs, and other devices — accessible from any browser on your network.\n\nHome Assistant Core runs inside a lightweight Ubuntu container (via proot-distro) on your phone. No root, no cloud dependency for local devices.\n\n### What it can control\n\n| Device Type | Brand Examples | How it connects |\n|---|---|---|\n| **WiFi smart lights** | TP-Link Kasa, Govee, LIFX | Direct IP on your local network |\n| **WiFi smart plugs** | TP-Link Kasa, Wemo | Direct IP on your local network |\n| **Cloud-connected devices** | Tuya \u002F Smart Life, Govee | Via cloud API (works everywhere) |\n| **Other WiFi devices** | Smart switches, sensors, cameras | By IP or cloud integration |\n\n### Limitations on Android\n\n- **No Bluetooth** — HA cannot access the phone's Bluetooth stack through Termux\n- **No USB dongles** — Zigbee\u002FZ-Wave USB sticks won't work without root and kernel support\n- **No auto-discovery (mDNS)** — Android 10+ blocks `\u002Fproc\u002Fnet\u002Fdev`, which breaks Zeroconf. You must add devices by IP address or cloud API instead of relying on automatic detection\n- **No Docker\u002FAdd-ons** — This is HA Core, not HA OS. Community add-ons that require Docker won't work. Core integrations (2000+) work fine.\n\n### Installation\n\n```bash\ncurl -O https:\u002F\u002Fraw.githubusercontent.com\u002Fmayukh4\u002Flinux-anroid\u002Fmain\u002Fsetup-homeassistant.sh\nbash setup-homeassistant.sh\n```\n\nInstallation takes **15–45 minutes** depending on your phone. The longest step is compiling Home Assistant's Python dependencies (numpy, cryptography, etc.) inside the Ubuntu container.\n\n### Starting and stopping\n\n```bash\n# Start Home Assistant\nbash ~\u002Fstart-homeassistant.sh\n\n# Stop Home Assistant\nbash ~\u002Fstop-homeassistant.sh\n```\n\n### Accessing the dashboard\n\nOnce HA is running, open a browser on **any device on your WiFi network** and go to:\n\n```\nhttp:\u002F\u002F\u003Cyour-phone-ip>:8123\n```\n\nFind your phone's IP with `ip addr show wlan0 | grep 'inet '` in Termux.\n\nThe first launch takes **5–10 minutes** to initialize. You'll create your admin account in the browser on first visit.\n\n### Adding your first device — TP-Link Kasa\n\n1. Open the Kasa app on your regular phone and note the device's IP address (Device Settings → Device Info)\n2. In HA dashboard: **Settings → Devices & Services → + Add Integration**\n3. Search for **\"TP-Link Kasa Smart\"**\n4. Enter the device IP address when prompted\n5. Your light\u002Fplug should appear — you can now control it from the HA dashboard\n\n> Since mDNS is disabled on Android, auto-discovery won't find devices. Always add by IP.\n\n### Adding Tuya \u002F Smart Life devices\n\nTuya devices connect through the Tuya cloud API, which works regardless of local network restrictions:\n\n1. Go to [iot.tuya.com](https:\u002F\u002Fiot.tuya.com) and create a free developer account\n2. Create a **Cloud Project** → select your data center region → add the **Smart Home** API\n3. Go to **Devices** → **Link Tuya App Account** → scan the QR code with the Smart Life \u002F Tuya Smart app\n4. In HA dashboard: **Settings → Devices & Services → + Add Integration → Tuya**\n5. Enter your **Access ID** and **Access Secret** from the Tuya IoT console\n\n### Keeping Home Assistant running in the background\n\nBy default, Android kills Termux processes when the app is backgrounded. To keep HA running 24\u002F7:\n\n```bash\n# Option 1: Run in background with nohup\ntermux-wake-lock\nnohup bash ~\u002Fstart-homeassistant.sh > ~\u002Fhass.log 2>&1 &\n\n# Option 2: Auto-start on Termux launch (add to ~\u002F.bashrc)\necho 'termux-wake-lock && nohup bash ~\u002Fstart-homeassistant.sh > ~\u002Fhass.log 2>&1 &' >> ~\u002F.bashrc\n```\n\n`termux-wake-lock` prevents Android from suspending the process. Plug your phone into a charger and it becomes a dedicated always-on server.\n\n---\n\n## Video Use Cases\n\nIdeas for what you can do with your old Android phone running this setup:\n\n- **Smart home controller** — plug it in, run Home Assistant 24\u002F7, control your lights and plugs from any device on your network\n- **Linux desktop for learning** — a full XFCE4\u002FKDE\u002FMATE desktop to learn Linux without buying a PC\n- **SSH development server** — code on your laptop, run on your phone over SSH\n- **Python development workstation** — Python 3 + pip ready to go, great for learning or small projects\n- **Media server \u002F file server** — serve files over your local network using Python's built-in HTTP server or install Samba\n- **Network monitoring dashboard** — access Home Assistant and system stats from any browser\n\n---\n\n## Troubleshooting\n\n**Script exits mid-install without a clear error**\nCheck `~\u002Ftermux-setup.log`. The script logs every package install result. The last line will tell you exactly which package triggered the failure.\n\n**Desktop doesn't appear after running start-linux.sh**\nOpen the Termux-X11 app manually — the desktop renders inside that app, not in the Termux terminal itself.\n\n**Black screen in Termux-X11**\nRun `stop-linux.sh` then `start-linux.sh` again. KDE Plasma can take 20–30 seconds longer than other DEs on first boot.\n\n**\"library not found\" or \"cannot link executable\" error during install**\nThis is the libpcre crash. Close Termux completely, reopen it, run `pkg upgrade -y`, then re-run the script.\n\n**Package install fails with \"unmet dependencies\" or \"Conflicts\"**\nThe script's `safe_install_pkg` function automatically reads conflict declarations from apt and skips packages that would break your system. If you still see this, check the log and open a GitHub issue with your device model and Android version.\n\n**Audio not working**\nWait 5–10 seconds after the desktop appears. PulseAudio needs a moment to initialize on first start.\n\n**SSH connection refused**\nMake sure `sshd` is running (`ps aux | grep sshd`). If not, run `sshd` again. Confirm you're using port 8022, not 22.\n\n**Wine doesn't launch**\nWine needs an active display. Make sure your desktop is running first, then run `winecfg` from the terminal inside the desktop.\n\n**Home Assistant: \"pip install homeassistant\" fails with compilation errors**\nThis usually means a build dependency is missing. Run `proot-distro login ubuntu` and check that `python3-dev`, `libffi-dev`, `libssl-dev`, and `cargo` are installed. Then retry: `source ~\u002Fhass-venv\u002Fbin\u002Factivate && pip install homeassistant`.\n\n**Home Assistant: dashboard not loading at port 8123**\nFirst launch takes 5–10 minutes. Check if HA is still initializing: `proot-distro login ubuntu -- bash -c \"source ~\u002Fhass-venv\u002Fbin\u002Factivate && hass -c ~\u002Fhass-config\"` and watch the output. Make sure your phone and browser are on the same WiFi network.\n\n**Home Assistant: \"address already in use\" error on startup**\nAnother HA instance is already running. Stop it first with `bash ~\u002Fstop-homeassistant.sh`, or manually: `pkill -f \"hass -c\"`.\n\n**Home Assistant: devices not discovered automatically**\nThis is expected on Android. The `\u002Fproc\u002Fnet\u002Fdev` restriction on Android 10+ prevents mDNS\u002FZeroconf from working. Add devices manually by IP address or use cloud-based integrations (Tuya, Govee Cloud, etc.).\n\n---\n\n## Advanced Notes\n\n\u003Cdetails>\n\u003Csummary>Customize GPU flags\u003C\u002Fsummary>\n\n`~\u002F.config\u002Flinux-gpu.sh` is sourced on every desktop start. Common tweaks:\n\n```bash\n# Force software rendering (for debugging)\nexport GALLIUM_DRIVER=llvmpipe\n\n# Enable Mesa debug output\nexport MESA_DEBUG=1\n\n# Change OpenGL version override\nexport MESA_GL_VERSION_OVERRIDE=3.3\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>SSH key authentication (passwordless login)\u003C\u002Fsummary>\n\nOn your PC, generate a key pair if you don't have one:\n\n```bash\nssh-keygen -t ed25519\n```\n\nCopy your public key to your phone:\n\n```bash\nssh-copy-id -p 8022 u0_a123@192.168.1.42\n```\n\nAfter this, SSH will no longer ask for a password.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Auto-start desktop when Termux opens\u003C\u002Fsummary>\n\nAdd to `~\u002F.bashrc` in Termux:\n\n```bash\n# Uncomment to auto-launch desktop on Termux open\n# bash ~\u002Fstart-linux.sh\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>How the conflict-safe installer works\u003C\u002Fsummary>\n\nTermux has several packages that hard-conflict with each other (for example `vulkan-loader-android` and `vulkan-loader-generic` declare a mutual `Conflicts`). Standard `apt-get` will fail loudly when you try to install one while the other is present, causing the script to exit.\n\nThe `safe_install_pkg` function solves this by reading the `Conflicts` field from `apt-cache show` before every install attempt. If any declared conflict is already installed on the system, the package is skipped with a warning and the script continues. This means the script is safe to run on any Termux setup regardless of what packages were pre-installed.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>About the Termux path\u003C\u002Fsummary>\n\nAll hardcoded `\u002Fdata\u002Fdata\u002Fcom.termux\u002F...` paths have been replaced with `$PREFIX` (the standard Termux environment variable). This means the script works on non-standard installs such as Termux on a secondary Android user profile.\n\u003C\u002Fdetails>\n\n---\n\n## Contributing\n\nPRs and issues are welcome. If a package name has changed, a DE has a better startup command, or you've found a new conflict to handle, open an issue with your device model and Android version.\n\n---\n\n## License\n\nMIT — use and modify freely.\n","该项目通过Termux在安卓设备上安装Linux系统，将旧的安卓手机转变为Linux桌面或智能家居服务器。其核心功能包括一键式脚本部署（`termux-linux-setup.sh`用于搭建Linux桌面环境，`setup-homeassistant.sh`用于配置智能家居中心），支持GPU加速的桌面环境、常用软件如Firefox和VLC以及Home Assistant的核心功能。适用于希望通过移动设备学习Linux、进行Python开发、远程访问或者控制家庭智能设备的用户。无需Root权限，适合拥有至少3GB RAM和5-10GB存储空间的64位处理器安卓设备使用。",2,"2026-06-11 03:51:21","high_star"]