Running Garden Linux on a Phone

A month ago, I showed you in my article CAP in the pocket: Developing Java Applications on your Phone (a more concise version), how to run a CAP development environment on your phone. In this week’s short blog post, I use a different angle. I wanted to see whether I could run SAP’s Garden Linux on my phone.

If you’re waiting for my CPU time profiler blog post, it’ll come soon (hopefully on Monday).

Garden Linux is a Debian GNU/Linux derivate that aims to provide small, auditable Linux images for most cloud providers (e.g. AWS, Azure, GCP etc.) and bare-metal machines. Garden Linux is the best Linux for Gardener nodes. Garden Linux provides great possibilities for customizing that is made by a highly customizable feature set to fit your needs.

gardenlinux.io

TL;DR: Yes, you can install it. And it works somewhat.

Installation

Let me tell you now how this all works. Of course, it uses proot-distro running in Termux (see previous article). Multiple distributions are available, but sadly, no Garden Linux. But we can easily add our own. We only need a proper tar.xz file. We can get bare-metal Gardener releases from GitHub Releases.

But there is a problem, the downloadable tar.xz files are a collection of files, xzipped together:

metal-gardener_prod-arm64-1877.0-ddd04088.manifest
metal-gardener_prod-arm64-1877.0-ddd04088.manifest.log
metal-gardener_prod-arm64-1877.0-ddd04088.raw
metal-gardener_prod-arm64-1877.0-ddd04088.raw.log
metal-gardener_prod-arm64-1877.0-ddd04088.release
metal-gardener_prod-arm64-1877.0-ddd04088.release.log
metal-gardener_prod-arm64-1877.0-ddd04088.tar
metal-gardener_prod-arm64-1877.0-ddd04088.tar.log

But we’re only interested in metal-gardener_prod-arm64-1877.0-ddd04088.tar. I extracted and xzed the file for you. You can find it at http://mostlynerdless.de/files/metal.1877.tar.xz.

Now we can create a distro file for Garden Linux in our Termux shell:

cd "$PREFIX/etc/proot-distro"
cat <<EOF > garden.sh
DISTRO_NAME="Garden Linux"
DISTRO_COMMENT="Stable release."

TARBALL_URL['aarch64']="http://mostlynerdless.de/files/metal.1877.tar.xz"
TARBALL_SHA256['aarch64']="b358d7f933709f52937a84784d745d33a98f470714ab082029c2602c16153b2f"
EOF

This allows us to install Garden Linux via:

proot-distro install garden

Now we can launch it via

proot-distro login garden

But we need to fix some locale issues before proceeding:

apt install -y locales
nano /etc/locale.gen # uncomment this line (remove the # at the beginning): en_US.UTF-8 UTF-8
update-locale LANG=en_US.UTF-8

Now you have a proper Garden Linux running locally on your phone.

Sadly, I didn’t find a way to install VSCode (double free error message) properly, so you can’t directly use it for CAP development. However, you can, of course, install and run SapMachine (the best JDK):

Try it out and have some fun with it. Feel free to tell me interesting use cases; I’ll happily feature them in a follow-up.

Conclusion

It’s fun to explore what modern smartphones are capable of. They become a more and more capable playground and eventually a working environment to work on the go.

See you in a few days for a profiling-related blog post.

Author

  • Johannes Bechberger

    Johannes Bechberger is a JVM developer working on profilers and their underlying technology in the SapMachine team at SAP. This includes improvements to async-profiler and its ecosystem, a website to view the different JFR event types, and improvements to the FirefoxProfiler, making it usable in the Java world. He started at SAP in 2022 after two years of research studies at the KIT in the field of Java security analyses. His work today is comprised of many open-source contributions and his blog, where he writes regularly on in-depth profiling and debugging topics, and of working on his JEP Candidate 435 to add a new profiling API to the OpenJDK.

    View all posts

New posts like these come out at least every two weeks, to get notified about new posts, follow me on BlueSky, Twitter, Mastodon, or LinkedIn, or join the newsletter:

Leave a Reply

Your email address will not be published. Required fields are marked *