14 ms·
Repurposing an old Android phone as a web server
- hifikuno 4y agoIt's worth mentioning if you are going to follow these instructions that the creator of Termux no longer recommends you install from the Play Store[1], and to instead install from F-Droid or Github. --- 1. https://wiki.termux.com/wiki/Main_Page#:~:text=do%20not%20install%20it%20from%20google%20play.%20 https://wiki.termux.com/wiki/Main_Page#:~:text=do%20not%20in...
- readyoubestbook 4y agoDoes he also mention why?
- andyjohnson0 4y agoIts to do with the Play Store requiring apps to target the Android 10 api level. Details at [1]. [1] https://www.xda-developers.com/termux-terminal-linux-google-play-updates-stopped/ https://www.xda-developers.com/termux-terminal-linux-google-...
- rektide 4y agoThe "write-or-execute" policy causing this havoc is remarkably similar to what is being done with WebExtensions v3 banning any dynamic code execution. Termux wants to be able to bring down code & let users run it, but that's verboten. Similarly, all WebExtensions will be forbidden from bringing down code (or accepting user entered code). That sounds fine/good for like 98% of extensions. But the other 2%... extensions like GreaseMonkey/VioletMonkey/TamperMonkey, or one could imagine something like IFTTT or PushBullet, where the extension might perhaps want some intrinsic extensibility to itself: those are all now verboten. There's not really any discussion or push/pull on the new security regimes. Computers just get more and more clamped down. I'm interested to see how Termux goes forward. In the past they seemed to have some "in-APK packaging" notions for how to deal with Android 10+. I haven't stumbled upon a good description of what this is or how it would work, and I'm not really sure whether these ideas are still active or whether F-Droid and using ever aging SDKs is the way forward.
- jeroenhd 4y agoTermux still works fine on any Android device, all you've got to do is install it through F-Droid or similar. Google Play is the party blocking W+X, Android itself will happily execute your downloaded binaries (for now, at least). There are also other APIs that are absolutely verboten by Google Play but will work fine if the app is installed through alternative app stores.
- pjmlp 4y agoNope, Android started to ban linking to native APIs that aren't officially part of the NDK, like Linux syscalls. More recent versions will just kill the application if they get used, and Termux folks refuse to accept that they have to go through JNI for specific OS features, so they won't be around for much longer, other than on rooted devices. Or they might eventually accept how things are done on Android.
- danhor 4y agoSince termux just uses regular unix applications, adapting them to use JNI sounds like a world of pain.
- pjmlp 4y agoThat is what they refuse to accept, Android isn't UNIX, it just happens to use Linux kernel. The official APIs are Java based, ISO C and ISO C++ standard libraries, and the NDK libraries that ship on device.
- nyanpasu64 4y agoGoogle is killing Android as a general-purpose computing platform.
- pjmlp 4y agoPhones were never a general-purpose computing platform to start with.
- syrrim 4y agoThe play store version isn't being updated, owing to a policy change by google affecting their package manager
- deleted 4y ago[deleted]
- cdev_gl 4y agoThis is basically similar to the process I've used to turn my phone into a dev/writing environment for spending months thru-hiking in areas without internet. I use termux to host a jupyterlab instance and bring along a tiny folding bluetooth keyboard. Even in airplane mode I can connect to the locally hosted jupyterlab instance. Notebooks are kept in git and synced up to my private repo when I'm back on grid. There are simpler solutions for writing, but this allows me to keep a single workflow across home/travel contexts. Being able to run graphs, basic code and computation as needed is also a plus.
- ASalazarMX 4y agoI don't know what is braver, if hiking for months or developing on a Bluetooth keyboard and a phone.
- cdev_gl 4y agoI don't know about brave, but the funniest thing I've done with my phone and keyboard is access an amazon workspace to run adobe InDesign for magazine layout while in my tent— sitting in a sleeping bag, a cold rain pattering against the "roof", with my back resting against my backpack and my phone angled nicely in my lap, using the keyboard's attached touchpad to carefully move and assign articles, tweak colors, and do the final bits needed for printing. There was definitely some squinting at the screen involved, heh.
- tambourine_man 4y agoI’d love to know more about that. Isn’t running Adobe CC on AWS prohibitively expensive? You need a decent video card and at the very least 8GB of RAM. Couldn’t you buy a laptop with what they’d charge you for a day of work? A quick simulation here is showing me US$ 140/h for a 4 core 16GB of Ram machine, no mention of video card.
- mrlemke 4y agoYou can easily stow a portable solar panel in a hiking bag that can charge your phone and the other accessories. A laptop would have a harder time getting charged, even if it was a Chromebook. Portable battery packs intended for phones would also be easy to stow. Not only do they fit more compactly, but they are light on your weight budget and not as fragile as lightweight laptops.
- tengbretson 4y agoAny tips on how to do this without eventually exploding your battery from having it permanently plugged in and under load?
- mmastrac 4y agoUsually these don't like booting without the battery, but maybe there's a way to provide data-only USB connections and a lithium-level voltage internally. Often the early boot stages will interrogate the battery level and refuse to boot if it's too low, but it's very much model dependent.
- mgdlbp 4y agoThere should be little current through the battery while the phone is plugged in, virtually none if the charger can meet its peak power draw. If degradation over time is a concern (perhaps it boot loops if the battery is very dead), a charge-limiting app set to 50%, the level recommended for storage and used in the Microsoft Surface UEFI Kiosk mode, should maximize life.
- kupfer 4y agoIf the phone is rooted, you can use Advanced Charging Controller to cycle it between min/max values. That would only prolong it, of course.
- password4321 4y agohttps://github.com/Magisk-Modules-Repo/acc https://github.com/Magisk-Modules-Repo/acc also mentioned at https://news.ycombinator.com/item?id=27576120#27578301 https://news.ycombinator.com/item?id=27576120#27578301 and related https://news.ycombinator.com/item?id=31325191#31325561 https://news.ycombinator.com/item?id=31325191#31325561 (laptop) Also, an alternative to termux, https://github.com/CypherpunkArmory/UserLAnd https://github.com/CypherpunkArmory/UserLAnd found https://news.ycombinator.com/item?id=30119029 https://news.ycombinator.com/item?id=30119029
- z3t4 4y agohad two batteries "explode" (ballooned ¹) because of this, then I switched to another phone and knock on wood the battery has not yet exploded (about 2 years). ¹ This is probably why you should not cut off the battery plastic sealing like some DIY guides tell you to do, it's probably there for a reason.
- rodolphoarruda 4y agoI have always thought the best possible repurposing project for old Androids would be Mesh routers. https://rodolphoarruda.pro.br/ideias/#202206MESH https://rodolphoarruda.pro.br/ideias/#202206MESH (Portuguese)
- xchip 4y agoNot only a web server, it is my personal cloud!
- jrib 4y agowhat software are you using?
- ChrisArchitect 4y ago(2020)
- butterNaN 4y agoThis is very interesting, and I want to try it out. The part about them immediately receiving 'attack packets' made me realise that I am quite ignorant about the realities of web security. It is eye opening to me that a lot of web traffic is malicious. Are there any 'security hardening your server 101 for n00bs' resources? It should be useful for any of these 'phone servers' as well (preferably tool agnostic)
- killjoywashere 4y agoStep 1) If it's not installed, it can't be exploited.
- RajT88 4y agoUse ubiquitous open source software, which has been battle-hardened over the years. I ran a web forum for years, either on PhPbb, or YAF.net. Never got compromised. Constant, round-the-clock attacks though. I think the ultimate saving grace is that the site didn't contain anything of interest - it wasn't selling anything, so no stored credit cards. No digital goods to steal, no public forum topics which relate to videogames, politics, etc. It was a small forum for friends of mine, so there was no obvious community anyone wanted to ruin. The worst we got, was some spam bots once in a while would breach the captcha, and start posting ads. Easily fixed. Not a hack, per se, but neither benign. I don't think we ever attracted the attention of a human hacker, and that's likely why we never got breached.
- RajT88 4y agoAlso - I am more knowledgeable now. Also install ModSecurity. That will block a lot of malicious stuff once you tune it to your application.
- Gigachad 4y agoPHP forum software getting hacked used to be very common occurrence. Not so sure about those but I remember a vbulitin one being exploited.
- 4y ago
- bityard 4y agoDoesn't Android's aggressive app sleeping/killing policies (ostensibly to extend battery life) make this somewhat... well if not useless then at least a challenge? I have a bunch of old Android phones kicking around that I'd like repurpose for random IoT/monitoring things but I don't trust them to stay "on" all the time. And Raspberry Pis are pretty cheap, so...
- aroldan85 4y agoRaspberry Pi's haven't been cheap for quite a while now.
- ChuckNorris89 4y agoOr available for that matter
- tim333 4y agoPi pico £3.46, available https://coolcomponents.co.uk/products/raspberry-pi-pico?src=raspberrypi https://coolcomponents.co.uk/products/raspberry-pi-pico?src=...
- ChuckNorris89 4y agoI meant the full sized one, with ports.
- the_third_wave 4y agoJust make sure to either set the thing to not go to sleep while connected to a power supply in the developer settings, get a wake lock for your specific application or use another app to keep the device awake. Android phones make for versatile sensor-rich platforms for monitoring/media/etc. applications. They come with their own wifi hotspots, 3/4G communications, several cameras, microphones, motion sensors, compass, gyroscope, light sensors, proximity sensors, magnetic sensors and more. They even have their own built-in UPS so... get hackin'.
- 4y ago
- victornomad 4y agoYou could use PHONK https://phonk.app/ https://phonk.app/ to create a script that runs a web server and combine it with more custom stuff such as Sound, visuals, MQTT, sms, etc etc
- 0x_rs 4y agoMost (if not all) current phones available in the market cannot even boot without a battery connected, is that correct? I'd feel a lot more comfortable without having to worry about it and risking forgetting about it for any unspecified amount of time just to find a pillow protruding from the back case. I really find it a shame that we have relatively powerful, energy efficient, mass produced devices in our pockets we eventually dispose of when they could have a second life serving another purpose. postmarketOS is a really interesting project, and if most phone manufacturers weren't actively user-hostile I could've used some old phone instead of my Pi(s) for whatever project I'm interested into, but I however think it's fruitless until strict regulations allow users to do whatever they wish with their handheld PCs. Due to this, among other things, I find all the talk about recycling and whatnot hypocritical from big companies, that should be the last stage of something's life, not dictated by obsolete security patches or the likes.
- Gigachad 4y agoPhones can't run without the battery because their peak power usage can exceed what the phone chargers provide. So the battery is used to cover these micro power spikes.
- tintedfireglass 4y agoEven with 80w-120w chargers these days?
- deleted 4y ago[deleted]
- nomel 4y agoI wonder if you could make a virtual battery, that was really just a dummy load that always said the battery was at 100%, so a charger could be used.
- moreira 4y agoThis sort of thing exists! I use something like that with my DSLR for a webcam. It’s great, there’s no real battery involved, it’s just a power cable with the end shaped like a battery.
- imwillofficial 4y agoThis is seriously cool. We should burn through old discarded tech as burner RPIs or something. Then my cyberpunk dreams can be made manifest!
- mholt 4y agoSure, you can do this with nginx and dynamic DNS if you really want to, but Caddy does it all for you, with automatic HTTPS, and runs natively on Android (or in Termux): https://caddy.community/t/running-caddy-2-on-android/13993?u=matt https://caddy.community/t/running-caddy-2-on-android/13993?u... Here's the dynamic DNS plugin: https://github.com/mholt/caddy-dynamicdns https://github.com/mholt/caddy-dynamicdns -- it will just update the A records for your domain directly with your DNS provider, no need for a third-party service.
- gitowiec 4y agoI don't think dynamic DNS will work on a phone connected to LTE service. LTE providers keep phones behind the NAT (or something with similar results). There is no way to forward/open a port for incoming connections. I wish there was a way to bring up a tunnel to make incoming connections possible via LTE/GSM OTA way.
- madacol 4y agoWell, if you don't mind really slow bandwidth, you can set up a Tor onion service
- gjadi 4y agoWouldn't it be possible with ssh -R ? The device connect remotely to a server that you control and give access back to you. https://man.openbsd.org/ssh#R https://man.openbsd.org/ssh#R Or setup wireguard and forward PUBLICIP:PORT to PHONE_WG_IP:PORT
- cocoafleck 4y agoT-Mobile has open ports on IPv6 (at least as of a few months ago). I was curious, and tried hosting a web site from my phone, and it worked flawlessly (assuming you are willing to abandon IPv4).
- lbrito 4y agoThanks for that, will look at it! I actually moved away from DDNS after a while because I moved and my new ISP had CGNAT. I posted about it here https://lbrito1.github.io/blog/2020/07/replacing_google_analytics_android.html https://lbrito1.github.io/blog/2020/07/replacing_google_anal...
- DesktopECHO 4y agoI went the Linux Deploy route and published a couple of container images that Just Work on pretty much any ARM Android device. Once you shiv systemd, some pretty elaborate scripts can run in an Android chroot just like they would on bare-metal ARM. Just think of your old Android as an off-brand rPi with case, built-in touchscreen LCD, and way, way fewer GPIO pins. No surprise the server will need a new UPS battery. NextCloudDroid: https://github.com/DesktopECHO/nextcloudpi https://github.com/DesktopECHO/nextcloudpi Pi-hole for Android: https://github.com/DesktopECHO/Pi-hole-for-Android https://github.com/DesktopECHO/Pi-hole-for-Android
- ge96 4y agooof rip Windows Mobile OS
- throwaway894345 4y agoAnyone know if we can run termux on a Fire Stick?
- throwaway2056 4y agoYes, as long as you know to install the APK. Just google termux apk.
- janandonly 4y agoI've used a cheap samsung A model to run a complete bitcoin node on. I think i used the ABCore.apk for this...
- markvdb 4y agoJust bought my significant other a new Android phone. I carefully picked the right device: - Lineageos supported - mainline linux 5.17 supported (except for the camera for now)
- shmde 4y agoIs it a OnePlus device ?
- what-imright 4y agoOf all the terrible ideas. Just why? get an orange pi for $50 stick OpenBSD on it. they have usb c input and a metal enclosure.
- Hedepig 4y ago> Just why? Your suggested alternative increases e-waste unless one specifically hunts for secondhand chips.
- what-imright 4y agofacepalm. you think you’re saving the planet reusing an old cellphone? what about the other 8 billion people who don’t care? it’s just virtue signaling. fantasy. you don’t have a reason just a rationalization. and that’s a problem because it means your logic is frying like an egg on a hot sidewalk
- orestarod 4y agoIt is well known you can't do a Good Thing if Others don't do it too because it will be inefficient and have no result globally visible. And why Others don't do it? Nobody else is doing it, duh.
- Damian21 4y ago
- lbrito 4y agoOooh, just saw that someone posted this! Author here. Sad that I missed the action. I'll answer questions if there are any.