Hacker News new | past | comments | ask | show | jobs | submit login

Speaking of booting Linux from places, what I would like to be able to do is carry a Linux image around with me on my (Android) smartphone, plug the phone into a USB port on a laptop and boot the Linux image from there on the laptop. Does such a thing exist?



This really is nice to have and a sibling comment has already linked to DriveDroid, the solution I'm using for this.

Back in the CyanogenMod days, I had an even better setup: there was an app that also let you emulate a USB keyboard and mouse, so I could, with some command-line trickery, boot a computer from an ISO on my phone, then use that same phone as a keyboard and mouse/trackpad, including in the BIOS.


A magisk module to do just that:

https://github.com/nitanmarcel/isodrive-magisk

needs root, and your kernel needs USB Mass storage gadget support module enabled, which, sadly, LineageOS doesn't enable by default.


I have used this many times on my phone running LineageOS. Did not have to enable any kernel features.


On the phones, where the Vendor kernel has this option enabled, Lineage also enables it, e.g. most LGs.

But Lineage does not enable it on all kernels, even if it could just be enabled. I observe this on all of my Samsungs, for example.

You can use this app to see which USB gadget options are enabled on your kernel: https://github.com/tejado/android-usb-gadget


Makes sense. My phone model is a Xiaomi. Don't know why Samsung would ship their kernels without ConfigFS support but I have never had such issues.


It's not about `ConfigFS` as a whole, but specifically `CONFIG_USB_CONFIGFS_MASS_STORAGE`, that is left disabled, while lots of other `CONFIG_USB_CONFIGFS_BLA` are enabled.

This and more can be seen in the `device info` screen of the App mentioned above


Should have said *proper ConfigFS support. Anyway, had no prior interest in this kernel feature until you mentioned the anomaly that is specific to certain vendors.

You can also do `zcat /proc/config.gz | grep CONFIGFS_` in a root shell (su) inside termux to get what options are set by the default kernel.



Also requires Root access


not sure if such a thing can work w/o root


i used drivedroid [0] on in the 2010's for this purpose. handy but never essential. requires root though.

[0] https://play.google.com/store/apps/details?id=com.softwareba...


Boot linux of a Smartphone would take drive emulation, which is possible, but not easily available.

To rootless Boot a Linux ON (not from) your phone is possible via tmux APP.

Search for "rootless kali nethunter" on YouTube. See here: https://m.youtube.com/watch?v=GmfM8VCAu-I


That is not booting a linux-kernel at all. it is just using the existing kernel which Android is based on (also Linux).


Glue a bootable usb to your phone.


Yes, do this. Don't under any circumstances try to solve a cute technical challenge -- that would only lead to fun, or worse yet, satisfaction.


It sounds to me like software enlightenment:

https://xkcd.com/1988/


Android stopped exposing USB Mass Storage, because it's problematic for the core use case of letting you grab pictures and what not from your phone, because it requires exclusive access to a filesystem; that wouldn't be a big deal for you, I don't think, you probably just want to create a large file and expose that as a device, but the implications of exposing the sd card (or the virtual sd card) as mass storage are why it went out of style.

I did find this, but it's ancient and may not meet your needs anyway... https://xdaforums.com/t/app-root-usb-mass-storage-enabler-v1...


What do you mean, usb mass storage was much better for the core use case of getting pictures of your phone than the flaky mtp now is


What I'd like to know is why my 2023 phone is still every bit as flaky as my 2018 phone was. For a while I was blaming my Linux solution but every time I try to use it on Windows it's just as flaky.

Fundamentally, accessing files on a live filesystem is a solved problem, and has been since before smart phones. I don't even know how they made such a broken setup.

(I believe the problem with USB mass storage is that it's closer to an IDE/SCSI protocol than a filesystem protocol. You can't have one bit of the system running around "accessing files" while you've got something else "moving the simulated drive head and writing this sector". In principle you could put the work in to make it all work out, but then it would be as flaky as the media access is now, only for a good reason rather than laziness/lockin.)


Regarding accessing files on a live filesystem being a solved problem:

One question I have is the following: If I take two linux PC's, why can't I just plug a USB cable between the two and communicate files to each other?

Instead the only solution I know is run an ssh server on one of them, and use sshfs on the other


The situation with USB is a lot more complicated than it appears. See things like this for instance: https://unix.stackexchange.com/questions/120368/make-a-compu... The controllers that sit between the port and the computer can create significant limitations versus what is theoretically possible if you were directly bit-banging the cords.

You can do this with an ethernet cable, if you have one and an ethernet port on both ends. You can manually set up a network on just that cable and transfer at full speed. (AFAIK all modern ethernet ports are capable of figuring out that they need to crossover in this situation and you haven't needed a special crossover cable in a long time.)


I mean, yes, but ...

If the sd card is mounted by your computer, you can't run any apps on the phone that need to use the sd card. That means, apps you moved to the SD card for space reasons, or apps that might save photos to the SD card (such as messengers).

If your computer messes up the filesystem, then you're in a world of hurt.


Couldn't they emulate it then?

If multiple apps can access the filesystem at the same time, why couldn't also some app (background system process) read from / write to the filesystem in an android multi access compatible way, while serving the mass storage device API on the other side


That's possible, but really challenging to do because mass storage is block oriented, the host (desktop) is likely to do read and write caching, and there's no mechanism for a host to say I finished writing this file, and there's no mechanism for a device (phone) to say blocks changed from under you.

The paradigm for block oriented filesystem access is exclusive access, and filesystem code is built around that. There's some niche filesystems around multiple simultaneous access to block devices, but I don't know if there's any that are open source; mostly people don't setup scsi/sas/das disk arrays with two hosts anymore, and when they do, they're much more likely to have exclusive access with failover than simultaneous access.

If you had a team of really detail oriented developers capable of getting this done for Android and desktop platforms, wouldn't you rather they work on something else?

Another approach might be to build a virtual filesystem to export as a block device on usb connection that's essentially a snapshot of the current one, and then you sync any changes that were written on usb disconnect, but then you need to manage divergent changes and that's unfun too.

SMB over USB would be terrible in many ways, but probably handle this use case much better.


> If you had a team of really detail oriented developers capable of getting this done for Android and desktop platforms, wouldn't you rather they work on something else?

If you can improve the world (mass storage device is really wide spread) this way, why not?


For better or worse, most people's photos never get transferred to a computer. Heck, there's a ton of people who don't have a non-phone computing device. Pushing their photos to the cloud so they see them after their current device dies is better than working on a new filesystem that allows for multiple host simultaneous access and porting that to everything. I could make a huge list of more tractable things that this hypothetical team could work on to make Android better for way more people.

Top on my list would be getting it so the touch screen just works every time. I can't count the number of times I've had to turn the screen off and on, because the touch screen came up in a way that I can't swipe up to get the code entry because swiping from the bottom to the top of the screen doesn't move it enough. I've had this happen on pretty much all my androids.

Things like booting faster would actually be nice. Especially since sometimes phones reboot in pockets. Setting up applications for faster starting would be amazing. It's not all in Google's court, but a basic hello world with the Android IDE starts up rather slow, even if you've noticed you need to compile a release build.


You can just use termux+rsync to get files to or from your phone.


Why just not use Samsung's DeX that gets you a linux desktop when you plug your phone in a usb-c monitor/console


Wasn't Linux on DeX discontinued?


Dex does not need an underlying OS. Your conflating features. Dex simply requires a monitor. No computer.


Yes it was.


Dex does not need an underlying OS. Your conflating features. Dex simply requires a monitor. No computer.



different use case and requirement for samsung device?


You could set up a PXE boot server on the android phone, then set up computer to boot off it.


Why does it need to be on the phone? Carry a normal USB stick.


It doesn't, but consider that the vast majority of us already carry our phones everywhere.

Would carrying an extra USB stick be that big of a hassle? No, but I can see the need for booting up a ready Linux image being extremely situational so the vast majority of time you're just carrying dead weight.


You can have a stick with one boot and one commonly formatted (FAT32/exFAT/ext) partition, Linux image being stored in later. Then it's like a normal stick that can also be used to boot Linux. Ventoy automates this process, allowing you to throw any ISO in a specific directory and boot it.


Wouldn't it be cool if these general purpose computers in our pockets were useful in novel ways?

You're only allowed to use it in the prescribed fashion.


What do you do about the USB cable though? A flash drive you can plug in directly, it's guaranteed to work. A phone requires you to either carry around an extra cable (arguably more annoying to carry than a flash drive) or take the risk that you won't have the right cable available nearby when you're trying to (say) boot a laptop.


The USB stick will be forgotten or lost much quicker than the phone.


I have a few Verbatim "Tuff and Tiny" USB drives. Like this but without the plastic clip part. I can fit them in my wallet because its about the thickness of 2 credit cards which are also in my wallet.

https://www.amazon.com/Verbatim-8GB-Clip-Flash-Drive/dp/B00N...


Reminds me of the credit card sized (literally [1]) USB stick I still have somewhere but it was too annoying to carry around and hope that next time that cheap stick still works...

Using the phone directly still seems the cleanest and most reliable way. Or maybe a combination of both, like those magnetic plugs [2] but with an integrated USB stick. Bonus points if you don't have to take it out at all (until needed) by either connecting the other magnetic part for data transfer and charging or data through USB OTG and wireless charging. One can dream... but the technology will shrink even further so who knows.

1. https://www.amazon.com/Enfain-Flash-Drives-Memory-Credit/dp/...

2. https://www.adafruit.com/product/5524


USB sticks attached to keychains are already widespread in some communities (DJs for example), I'm sure us software people could do it too if we wanted to :)


I leave my keychain at the door when I get home. This is probably a common practice.


That makes sense. I once got falsely identified as a DJ, but it was just a YubiKey.


Also attach an USB killer for extra thrill


I glue phones to all my USB sticks for just this reason.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: