Google is preparing to let you run Linux apps on Android, just like Chrome OS

pnutzh4x0r@lemmy.ndlug.org to Linux@lemmy.ml – 581 points –
Google is preparing to let you run Linux apps on Android, just like Chrome OS
androidauthority.com

Google is developing a Terminal app for Android that'll let you run Linux apps. It'll download and run Debian in a VM for you.

...

Engineers at Google started work on a new Terminal app for Android a couple of weeks ago. This Terminal app is part of the Android Virtualization Framework (AVF) and contains a WebView that connects to a Linux virtual machine via a local IP address, allowing you to run Linux commands from the Android host. Initially, you had to manually enable this Terminal app using a shell command and then configure the Linux VM yourself. However, in recent days, Google began work on integrating the Terminal app into Android as well as turning it into an all-in-one app for running a Linux distro in a VM.

...

Google is still working on improving the Terminal app as well as AVF before shipping this feature. AVF already supports graphics and some input options, but it’s preparing to add support for backing up and restoring snapshots, nested virtualization, and devices with an x86_64 architecture. It’s also preparing to add some settings pages to the Terminal app, which is pretty barebones right now apart from a menu to copy the IP address and stop the existing VM instance. The settings pages will let you resize the disk, configure port forwarding, and potentially recover partitions.

...

If you’re wondering why you’d want to run Linux apps on Android, then this feature is probably not for you. Google added Linux support to Chrome OS so developers with Chromebooks can run Linux apps that are useful for development. For example, Linux support on Chrome OS allows developers to run the Linux version of Android Studio, the recommended IDE for Android app development, on Chromebooks. It also lets them run Linux command line tools safely and securely in a container.

177

Termux has been a thing for years.

Yeah but I bet google's one will have lots of cool features like being harder to use and not supporting becoming root and requiring google play services for no discernable reason

And will be cancelled in 18 months with 2 weeks notice.

If it’s anything like ChromeOS, it’ll be a VM where you can do whatever you want, within that VM.

Termux recently got moved off of the play store (kinda), and is now only available on f-droid/github, because Google was further locking down what they allowed on their store.

And in addition to that, they recently added a restriction in later versions of Android: "Child process limit". Although this limit used to not there, when enabled, it prevents users from truly running arbitrary linux programs, like via termux.

Although the child process limit can still be disabled in developer options, it doesn't bode well for how flexible base android in the future will be, since many times corpos like Google move stuff into the "secret" options before eventually removing that dial all together.

TLDR: Termux has been, and is a thing... for now.

Also, I want to shout out winlator. It uses a linux proot, similator to termux, and has box64 and wine inside that proot that people can use to play games. I tested with Gungeon, and it even has controller support and performance, which is really impressive.

winlator can run windows apps on android

Hey that sounds neat!

uses ubuntu as a base

Oh no...

MIT license

oh no

Have to install from github/no F-Droid build

oh no

Winlator is really just termux + proot + box64 + wine wrapped in a neat UI (+ controller support). You can, and people have set this up manually before winlator came along. You'll either need termux-x11 or vnc for the GUI.

Mobox is a similar project that does this automatically via a script... but I don't see a license in their github repo, plus they require the proprietary input bridge for touch controls.

I used Winlator at the start of the year just to test out some little itch.io games and it was pretty basic, huge to hear how far it's come already!

Termux doesn't run arbitrary software. There's a pretty large set that does but plenty doesn't. A VM would resolve that.

Through termux you can already install a full linux distro on android. It is a little slow, but full desktop environment. Not bad if you have a phone that supports display output

Do you mean via QEMU without hardware acceleration?

I didn't think to check how it worked, other than the graphics part is accessed via a VNC app. If you have a spare phone check out Anlinux on PlayStore or F-Droid

Anlinux

This application will allow you to run Linux on Android, by using https://f-droid.org/packages/com.termux and PRoot technology, you can even run SSH and Xfce4 Desktop Environment!!!

Features:

  • NO ROOT ACCESS REQUIRED!!!
  • Lots of Linux distros supported:
  1. Ubuntu
  2. Debian
  3. Kali
  4. Parrot Security OS
  5. Fedora
  6. CentOS
  7. openSUSE Leap
  8. openSUSE Tumberweed
  9. Arch Linux
  10. Black Arch
  • Xfce4, Mate, LXQt, LXDE Desktop Environment Supported
  • Install multiple distros without conflict
  • Provide uninstallation script to fully uninstall distro

The problem with the desktops in termux is that the apps don't work reliably.

I found generally it was fine but some needing true root hardware access failed

Firefox doesn't work right and neither does chromium

I don't recall having issues with firefox. Was there anything specific?

So is termux a containerized Linux? (I haven't looked into it yet, just on my list). I had assumed it was a VM, guess I was incorrect.

My sense was that it's kinda like cygwin. Just natively compiled apps and a filesystem layout.

This is correct. There's no containerization like LXC/Docker.

Not even that, Android is enough of a Linux system they really just needed a repo of natively compiled apps.

...and a filesystem layout. They don't install things to the "root" linux so they have their own /var, /bin, /usr, etc.

I could remember wrong, but doesn't it just use symlinks?

I doubt it - it runs in an android sandbox. Why would they even bother? it's easier to just create a filesystem "chroot" and use that. That way you get full read/write and control of versions.

Ehh it kinda does considering you can get a pretty full compiler tool chain running via termux.

Termux has been a thing for years.

Termux is not a full linux environment, you need proot (slow) or chroot (insecure) to get a full environment.

Not arguing, just curious: what makes chroot insecure? I've used it for installing Gentoo, but I don't really understand what it's doing under the hood.

Chroot = change root, and needs root to do so. Doing anything as root is insecure. escaping a chroot really isn't all that hard. The second you elevate privledges, you need extra steps to to become secure. Chroot almost never involves any of these steps (though there is some selinux stuff you could do.)

This is an old example, but still a valid one https://github.com/earthquake/chw00t

Termux is just proot

Termux is just a shell running in the context of an app

Termux isn't just proot, but you can install proot inside termux

It is proot based though. It is very useful but it does have disadvantages.

How is ut proot based? Afaik it runs binaries built for termux and not any linux binaries. Isn't it directly executing the files?

Maybe I'm mistaken then. I had in my head that it was proof based. However, that wouldn't make any sense as Termux has access to the system

Yeah... While making users run Linux applications on a system where Google is root might be a wet dream for Google, it's more of a nightmare for me.

I really hate the fact that the vast majority of consumers are perfectly fine with not being in full control of their appliances and that Google (and others) register everything they do.

The reason so many people are fine with using corporate garbage is ironically the same reason they'd be just fine using something that wasn't that. Users can adapt and learn a system way better than most people think.

It's the convenience angle.

I have very experienced IT friends who continue to use privacy invasive crap, knowingly because they like the convenience.

That kinda thing is a sliding scale for everyone, if my Linux machine wasn't 90% as reliable and usable as when I was on windows I would probably still be using windows

And yet there they all are, using corporate garbage.

Yep. Because that's the default. And the corporate garbage says that the other stuff is a worse experience.

Well, it is.

It's a lot more work to use not-Google stuff on Android. Which I try very hard to do.

Now trying to get a family member to install and run anything not from the Play store is like pulling teeth.

I thought the snapdragon Samsung rooting would be farther along than where we are now. I'm stuck with my phone until further notice s23u

I personally run a custom rom, even with that I find this very exciting, This should balance the Security, Perf, Convience, aspects quite nicely

graphene OS. i would not have bought an android phone if i had to use google roms

I want a Linux phone capable of running android apps

Pine64+waydroid

So, I'm not that great with Linux. I know the basics, that's it.

Is it user friendly? I mainly want Linux with Android app support because I hate Google.

I've used windows my entitle life. Now windows 11 upgrade was done without consent, now they are doing their best to make it even worse then it already was. I would love to switch to Linux, it's just that I'm using some apps which do not exist for Linux yet. Next to that I'm not that comfortable with the Linux mechanics to make the switch on my main PC. As in: Like I know what I'm doing on the machine which I use a big part of my time. I need full control. I know I have it with Linux, I just don't know how. And I feel stupid for it.

The moral of my story is: I'm scared to make a switch from something I'm so familiar with for years and years to something new, even though I hate the corporations behind the stuff I use.

You can test Linux out by using a live USB instance or in a VM. You can also dual boot so you'll always have Windows available if you need it.

You can also install WSL on Windows or something like Git Bash or MSYS2 to get a Linux-y environment on Windows.

I have used dual boot, live usb sticks and VM's. It's just that I don't feel that comfortable within the Linux environment as my knowledge is lacking somewhat and I haven't used it enough to fix that.

Came in to say this. Linux on ARM is getting so close to daily driver ready.

Will never happen because of SafetyNet. Google does not want you running Android apps on anything other than their approved Android ROMs.

What's that?

Looks like Google is calling it Play Integrity these days: https://developer.android.com/privacy-and-security/safetynet/deprecation-timeline

But it's this: https://developer.android.com/google/play/integrity

It's an API that ensures you're running apps on the hardware and Android ROMs Google approves of. It can also ensure that apps are not running on rooted phones.

Developers can integrate it into their apps. Banking apps do it, for example, and won't run in Waydroid as a result. More and more apps integrate it over time.

1 more...

I’ll just run Linux shit on…Linux

I’ll just run Linux shit on…Linux

Android is a variant of Linux, just not GNU/Linux because of not using glibc.

With diffs sometimes around 5m lines of code (in case of qcom)

With diffs sometimes around 5m lines of code (in case of qcom)

Nobody's denying that. Many embedded distributions targeted special hardware are like that.

android just uses the kernel

android just uses the kernel

Yes and the kernel's name is "Linux". No other software is named "Linux". Ask Linus Torvalds if you don't believe me.

there's more to an operating system that a program needs other than the kernel(?)

there’s more to an operating system that a program needs other than the kernel(?)

Yes, and the other parts have other names, like the toolkit GTK or the C standard library glibc and all those things make up a Linux distribution, like Fedora.

Much more appealing to me is running Android apps on Linux officially. I don't want to use Android as my main system, but I sure as heck would love to have one or two Android apps available on my Linux Machines.

wayDroid does let you do that, in a fairly lightweight way (uses Linux namespaces iirc, similar to lxc.

It's still not full native, which would be even nicer. I play droidfish on my Linux machines using it.

I'm glad it worked for you, it borked the fuck out of my system 🤣

It also borked the eff out of my system too, and I'm still seeing traces of its lefotver desktop files after uninstallation

It always worked for me except in some cases the 'hardware' compositor (ie the wayland side) is a bit buggy for clipboards and inputs in general. I had issues with lxc network in past but that's long ago.

I still don't understand what borked your system. Waydroid downloads the images, mounts and runs them inside lxc just like normal android. It doesn't touch your /usr or anything else. Works well in immutable os too.

I'd rather have a linux OS on the phone that can run Android apps.

That's what android is ;)

That's like saying MacOS and IOS are BSD

Its not the "Linux OS" that we want, but it is Linux, it runs the Linux kernel, so does chromeOS.

Be cleat about what you want.

What you call "Linux OS" is actually GNU/Linux, or as I've taken to calling it lately, GNU + Linux.

Cool and all but id rather run android apps on a linux phone.

You can already, Waydroid exists

I think you misread. They want a Linux phone, not a container for android apps on Linux Desktop. Also, yeah there are very limited options to do this, but most of us can't yet.

Linux phones do exist, I was saying that you could use Waydroid on those devices (although you can also use it on Linux Desktop), such as postmarketOS on eg a Fairphone 5.

Okay but they only run on pretty weak(usually because it has to be old) hardware. We need a linux flagship phone.

Fairphone 5 isn't old. It's a fairly recent, midrange phone

As an American, I absolutely would choose a Fairphone if it wasn't only available through that third party distributor.

Can't wait to have Google's telemetry injected into my Linux apps

an all-in-one app for running a Linux distro in a VM.

No, it won't

let you run Linux apps on Android

It will let you run Linux apps in Linux

Plasma Mobile for Android? 🤔

Plasma Mobile for Android? 🤔

Doubtful. A VM doesn't have access to the underlying hardware (unless explicitly passed through).

I commented having only read the headline. Too bad it's a VM, Android could have a sort of reverse Waydroid.

not doubtful, a lot of compositors, kwin included can run nested.

not doubtful, a lot of compositors, kwin included can run nested.

It's not a question if some of Plasma Mobile could run in that VM. It's a question if anything usable is possible. I highly doubt Google will make it possible to call phone numbers etc. in that VM.

sure, but if 90% of the stuff work work, voip, and it seems to be using crosvm for avf, so those capabilities could be passed through.

I was thinking the same thing! But it would be running from a Debian VM so I'm not sure how realistic that is. And I doubt it would have access to android apps.

Google is still working on improving the Terminal app as well as AVF before shipping this feature. AVF already supports graphics and some input options, but it’s preparing to add support for backing up and restoring snapshots, nested virtualization, and devices with an x86_64 architecture.

This is the part I cared about. Can it run x86_64 programs, or is it just an ARM-compatible version of Debian?

If it can actually run x86_64 programs on ARM devices, then that's kinda fucking sick and would likely help the world transition to ARM. Like, fuck Google, but this sounds like a good thing, maybe?

It will be ${NATIVE_ARCH} debian or whatever distro, use box86 on top of it.

devices with an x86_64 architecture

Sounds like the opposite of what you want; you would want x86_64 code on devices with an ARM architecture.

But I didn't actually read the article, so maybe that line is poorly worded

Can it run x86_64 programs

The article sound like it will work for x86 devices running Android as well. I don't think this is about emulation.

That just sounds painfully inefficient (though we've been doing stuff like this for decades).

Arm isn't as efficient at higher cpu states as x86, and running a VM you're definitely going to up the cpu usage.

Still interesting to watch. And every use-case is unique. For the typical short-run process this is for, it'll probably be fine.

Steam?

No, not unless you have an x86 Android device. While this will run Linux apps, it will be limited to the CPU architecture. Unless there is a x86 to ARM translation layer on Linux that I'm not aware of?

box86/box64, and there's also FEX-emu which is used by the Asahi Linux project (Linux on Apple Silicon macbooks).

Unless there is a x86 to ARM translation layer on Linux that I’m not aware of?

https://steamdb.info/app/3043620/

It appears Valve is working on Proton for arm64, I was wondering if this is to attend the mobile market, a new Index or maybe a smaller Steam Deck.

You can use QEMU's usermode emulation to transparently run ARM binaries with binfmt_misc on x86.

Steam requires it to be installed in an x86 environment, whether natively, or through emulation (and most x86 emulation has significant overhead and imperfections)

But java applications should run natively if you supply an appropriate build of java. I have an arm VPS that I've hosted several Minecraft servers on without any problems (other than those I created myself) and I also learned by accident that Microsoft's builds of OpenJDK actually work for (at least some) Minecraft versions that they aren't supposed to, so I have to wonder if that's a happy accident or intentional work by Microsoft

Why not androids terminal since android is base on linux this one just downloads debian

Android userland is vastly different from 'linux' ie desktop linux people are used to. While there exists unshare/proot based containers (termux is an example) it might not be suitable for privileged features of kernel except for rooted devices.

Chromeos is much closer to desktop linux (init being upstart not systemd afaik) but still the 'linux' apps run inside crosvm to keep the locked down nature of the os intact.

makes sense and i thought termux uses the android terminal
chromeos yeah it makes sense aswell its linux with google spyware i seen some distros use sysvinit and runit instead of systemd (aka systemd-free distros)

I've never tried it myself, but I think you can run full Linux VMs on Pixel phones already. A quick search brings up https://www.xda-developers.com/nestbox-hands-on/

Anyone have experience with this or similar options? Personally I've never used anything more advanced than Termux (which is lean and super cool, but not a full-blown VM).

You can pretty much chroot into a full debian installation, and even make kernel calls higher than that natively supported by your phone through proot. It's a weird time to be alive.

Would it be like a Windows Subsystem for Linux (WSL) but then for Android?

We already have termux for that, and on a rooted device you could do pretty much anything. This is pointless

Yeah but I'm unwilling to root my device, so hopefully this will allow me to do some cool stuff too.

Yeah, I just installed Debian in Termux last night. I've got a Samsung phone with a locked down bootloader, so it's the best I can do.

Interesting... but well.. Android isn't rooted, so will it use chroot or something like that? Or it will use a whole another kernel, complete VM?

Well, the summary pasted in the post mentions "VM" about a dozen times

That's a bad move of Google, this has no reason at all!
Chroot/docker will use a more practical way to run Linux, as Android is just a Linux distro, why bother with running a whole another kernel!

A reasonable build of the kernel optimized for virtualization won't take more than a few tens of megabytes of RAM (and it will have support for memory ballooning, so the virtualized kernel will give the memory it doesn't need back to the host), and the userspace will need to be separate anyway due to how different Android is to normal Linux distros.

Containers are nice when you want to run dozens of separate services on the same server or want to get the benefits of infrastructure as code, but in this case they would provide minimal benefits at the cost of having no way of loading any kernel modules not built into whatever ancient kernel version your SoC manufacturer decided you have to use on your phone. Also, container escape vulnerabilities are still a bit more common than full VM escape, so this is also good for security on top of being more useful.

For what I've read and heard mentioned by engineers when I worked for a phone manufacturer, Android already heavily uses virtualization. If I remember correctly it does that for the A/B partitions for updating, as well as for the multiple user support. But I'm very open to anyone with closer experience to the Android kernel than I have chiming in with better specifics

I just wish I had vim with a tiny keyboard that I hit with one finger

Need a bigger phone so you can hit it with 2 fingers instead of one :D

I need to drink water and have at least one meal a day. Big screen phone is a luxury that I can't afford

This could be really interesting. I don't personally see a use case for me to run Linux apps on Android. I could see myself running android apps on Linux though. Pretty happy to see this.

Chromebooks have the advantage of being mostly a laptop with a keyboard, mouse-analog and largish screen... Phones don't really have that, so it seems an odd choice to me. Especially for a platform which is hostile to giving users permissions to install software on their own devices.

I've been using Termux for years and there are a lot of nice things you can do. Also, a lot of nice tablets have good keyboards.

Yeah but to do that one thing that you really want to do, you need root and daddy says no.

I'm on GrapheneOS and step-daddy says no as well

You can root Graphene if you want to, right?

You can root any phone if you truely want to. I just do not yet have the skillset to do it.

If you know how to do it, I'm open for it :)

Honestly you don't need root. You can enable root (assuming you are already running a custom ROM) but that should not be needed.

But who decides what I need? For instance, I want to toggle airplane mode. Without root: not allowed.

You can toggle air plane mode

Incorrect. Wifi only without root.

Well then I guess my device is the exception then. I have an airplane mode toggle

Then your device must be powered by magic, or more likely it's not a recent Android version. That the toggle is there does not mean it works: it doesn't work without root.

I'm running almost the the latest version (Android 14) and the toggle works. Why wouldn't it work? People need to be able to put there devices in airplane mode when they get on an airplane.

1 more...
1 more...
1 more...
1 more...
1 more...
1 more...
1 more...

If it's anything like Chrome OS, you have full root in the VM.

Giving full admin privileges over device? Doubt it.

I mean if you want root, just buy an unlocked phone. You can run Lineage OS on the Pixel phones just fine. Full root access. This VM system has nothing to do with that.

1 more...
1 more...

Android runs on a LOT more then just phones, BlissOS/Android x86, Arcades, casinos, cars etc.

If you dock your phone it will run with display keyboard and mouse. Not all phones support it though

IIRC, Android has always had native support for keyboards and mice. I remember connecting a bluetooth mouse to my old Nexus 4 running...Android 4, maybe 5? It worked out of the box. Saved my butt when the touch screen broke. :)

Can't say I've tried this in recent years but I think it still works, yeah?

Yep OTG via usb. But only certain phones support secondaryvdisplay through USB

1 more...

This seems as much about converging Android and ChromeOS as anything.

Very exciting stuff, Really hope wayland gets hooked up. if not, well, we can make it work somehow

What do you mean? Wayland isn't "a thing".

Im not sure I understand

There's no app called "Wayland". So I'm not sure what you want "hooked up".

wayland support, the protocol?

I don't think you know what you're talking about... It's a protocol. A document. You need some application that implements it. Like KWin, or Gnome.

yeah, like virtio-wl which crosvm supports...

Which still needs a wayland compositor to work, but I get your meaning now. You simply want it to be possible for there to be GUI support with some sort of wayland compositor.

correct, or rather more specifically virtio-wl is a serialization protocol for wayland. You need a specific compositor that implements virtio-wl see https://github.com/talex5/wayland-proxy-virtwl and https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/sommelier/README.md

The ideal thing I would like to see is each application working as it's own window, This should be possible with A12 since they allowed multiple app instances. Though multiple app windows introduced in I think A9 would also be usable for this.

I don't really see the need. It would be nice to have KVM but other than that I don't see much point.

I personally really like runing full chroot on my device, this will fit a similar role with more security and convenience.

Smells like they might be preparing to make their own portable console running Android.