Linux on android hardware

Linux on your smartphone: everything you need to know in 2021

Raffaele T.

One of the main issues with modern smartphones is the extremely short lifespan of this category of devices, which makes even high-end ones painfully slow within years. In fact, studies have shown that it takes the average European, American or Asian user less than two years to dump their old smartphone and buy a newer, more powerful (yet arguably very similar feature-wise) model.

This, however, is quickly changing thanks to projects like postmarketOS, bringing potentially lightweight Linux environments to new and old (also very old) mobile devices. While it is still early, in most cases, to have an usable Linux «daily driver» smartphone, this page should answer some of your questions regarding how Linux on smartphones work, whether your phone is likely to boot it properly and, if it does, how to choose a Linux distribution and whether it’s the case to switch now or to wait some months.

Do not forget that most of the procedures below might void warranty or cause temporary or permanent damage. Any content of this page is to be performed at your own risk.

2009 Nokia N900 running postmarketOS

Buying a Linux smartphone

Thankfully, getting your hands on a Linux smartphone in 2021 is much easier than it used to be. Many Librem 5s and PinePhones have already been shipped, and mature releases will probably be available for sale within this summer. We maintain a small list of native Linux smartphones that might be a good starting point if you are willing to buy one.

If, however, you are not ready to go for a full Linux smartphone yet, Can My Phone Run Linux? is a search engine for most known smartphones that can boot Linux. Make sure, however, to check the support level on the distro page in detail before getting one, as most features, like mainline kernel, modem and hardware acceleration are still not supported by most devices.

Hardware requirements

Sure, a lightweight Linux desktop environment might be much faster than most heavily manufacturer-customized Android spins, but there’s no black magic in «pure» Linux either. Which means that expecting to achieve more with your device than what the manufacturer initially designed it to is possible, but not very realistic. Especially if we consider that most smartphones are sadly not designed to be future-proof when it comes to their technical specifications, with tough competition for higher specifications every year leading to progressively heavier and slower OS releases.

Therefore, if your smartphone isn’t equipped with at least 1GB of RAM, 8GB of ROM (SD cards also count, but might be less reliable and slower especially on newer devices) and a 32-bit, 1GHz ARM CPU, the device will probably boot, but still be unsuitable for most kinds of smartphone features, such as desktop-like web browsing. In other words, anything older than 2012 will probably not render modern websites faster or more accurately than it did on its original OS. In case you are not willing to sacrifice Android applications, you should as well consider the relevant overhead of Android abstraction layers like Anbox.

In addition, you should make sure that your device’s mobile modem, GPU, power management and all kinds of hardware drivers you need are available on Linux. This step requires a minimum level of hardware and Linux knowledge, but for most users checking «what works» and «what doesn’t» from the wiki page of your device for the distribution you would like to install should already give a basic idea of the usability status.

If there is already a mature Android port for your smartphone, however, libhybris might allow Android drivers to run on Linux and get a GUI running quickly over it.

Software requirements

Another thing to remember is that running Linux on an iPhone or iOS device is almost impossible. Apart from the work-in-progress Project Sandcastle, there is currently no usable Linux distribution or porting for modern iDevices. Windows Phone devices that already received unofficial Android support, such as the Lumia 520, 525 and 720, might be able to run Linux with full hardware drivers in the future. In general, if you can find an open source Android kernel (e.g. via LineageOS) for your device, booting Linux on it will be much easier.

If your device is SIM-locked, you might want to unlock your device if possible before flashing Linux on it, as in some cases the necessary proprietary software handles for modem unlock codes might not be implemented in Linux.

Читайте также:  Linux задание переменных окружения

You should also check if the bootloader for your device is unlocked, and if it isn’t, how the bootloader unlock procedure works, preferably from an official source (which means avoiding shady paid «unlocking services» unless you really have no other choice). If it is permanently locked by a carrier or manufacturer, or can’t be unlocked for whatever reason, you will not be able to run Linux or any other unsigned custom kernel on it, with the exception of limited chroot subsystems.

What are the Linux distributions for smartphones, and how should I choose one?

Several Linux distributions are specifically designed for smartphones, tablets and wearables, the most relevant of which are also listed on a dedicated page.

  • Your best bet at the moment would surely be Ubuntu Touch by Ubports, which is the only distribution to provide a fully-functional Linux desktop environment with a relatively large app ecosystem. To check if your device is one of the lucky ones to be actively (and officially) maintained, you can check the Ubuntu Touch Devices section.

  • Another Linux distribution which is currently in very active development is postmarketOS, which can boast a wide community of users and developers and over 250 booting devices (including smartwatches, x86 tablets and Raspberry Pi boards) at the time of writing. KDE enthusiasts will be happy to hear that postmarketOS is officially recommended by the Plasma Mobile website, and some of its main developers are also active members of its community. This, however, does not mean that postmarketOS is primarily KDE oriented: several Gtk desktops, including Purism Librem 5’s «Phosh«, are already fully working in postmarketOS on several devices.
    Also the pmbootstrap tool makes porting postmarketOS to new smartphones easier than ever.

  • Last but not least, if your device is one of the few supported ones (spoiler: few Xiaomi and Nexus phones only), you might consider trying LuneOS, a project that brings new life to HP WebOS, the futuristic HTML5-based, open-source iOS competitor that didn’t truly make it against the Android hegemony in the first 2010s. Still, chances are it’ll be lighter than most Android versions, while open source and fully respectful of your privacy.

Porting Linux to your device

postmarketOS live porting to Nokia 1

If your device is currently not supported by any of the distros mentioned above, porting postmarketOS to it might be a relatively easy task, provided you have experience with compiling Android and Linux kernels, and possibly some minimal knowledge of the C programming language. And, of course, provided that there is already one stable Android or Linux kernel you can find the source code for. If you feel brave enough, you can check this guide from the postmarketOS wiki and start getting your hands dirty. And if you ever get stuck, you can always ask their community for help and guidance.

And if, by chance, you arrive to the point of getting the real, «mainline» Linux kernel and the device modem (calls, SMS, mobile data. ) to fully work on your phone, you might have just created one of the very few modern «true Linux» smartphones. But that’s clearly beyond the point of this article.

Live porting of Ubuntu Touch to Fairphone2

Conclusion

As the brightest reader might have noticed, «real» Linux on most smartphones isn’t exactly mature yet. So is it worth installing on your daily driver? Probably not, unless it’s one of the few Ubuntu Touch or postmarketOS officially supported devices. But if you’ve got an older device that’s been sitting idle for years, why not experiment with software that might give it new life, without the limits of the OS it was originally released with? Testing and development is essential at a stage where Linux for smartphones is being more actively developed than ever.

You can follow TuxPhones on Twitter and Mastodon.

Источник

Convert an Android Device to Linux

Linux on a Droid

If you want to install Linux on an Android device, you have several options. We examine some of the possibilities.

Installing a regular Linux distribution on an Android device opens a whole new world of possibilities. You can turn your Android device into a full-blown Linux/Apache/MySQL/PHP server and run web-based applications on it, install and use your favorite Linux tools, and even run a graphical desktop environment. In short, having a Linux distro on an Android device can come in handy in many situations. You can install Linux on an Android device in several ways, and I’ll look at some of the available options.

KBOX: No Root Required

In many cases, installing Linux on Android usually means going through the rigmarole of rooting the Android system with the risk of bricking your Android device. If you don’t find this idea all that appealing, then you might appreciate KBOX. This miniature single-user Linux distribution is integrated directly into a terminal emulator, and it can be installed on non-rooted Android devices (Figure 1).

Читайте также:  Просмотр больших файлов windows

KBOX is not available in the Google Play Store, so you have to download the APK package from the project’s website and install it manually. By the way, the author of KBOX provides not only the ready-to-use package but also some technical descriptions of KBOX’s inner workings.

KBOX comes with an assortment of BusyBox utilities (find, grep, tar, vi, etc.), an SSH server and client, and the scp tool. A handful of other packages are available as separate downloads, including vim and rsync. Rsync can act both as a client and server. Installing packages on KBOX is done using the dpkg tool. To install, for example, the rsync package, grab it from the project’s website and use the following command:

Obviously, KBOX is not a replacement for a full-blown Linux distribution, but it can be useful in certain situations. If you install rsync, for example, you can use this powerful and flexible tool to back up files on your Android device to a remote server, and thanks to the supplied SSH server, you can access your Android device via an SSH connection.

Going the chroot Root: Linux Deploy

Although KBOX offers a straightforward way to install Linux on an Android device, you might find it too limited for your needs. In this case, you should consider installing a regular Linux distribution, but to do this, you must root your Android device first. The exact rooting procedure depends on your particular Android device, and it can be tricky at times. However, plenty of rooting guides are available online to help you along the way.

When it comes to installing Linux on a rooted Android device, one option is Linux Deploy. This open source app offers an easy way to install and run a supported Linux distribution in a chroot environment, which is basically a special directory that acts as a temporary root directory. Because the root directory is the top of the filesystem hierarchy, applications running in the chroot environment don’t access directories higher up than the root directory. In other words, chroot creates an isolated environment that doesn’t interfere with the rest of the system. The good news is that Linux Deploy hides all the gory technical details behind a user-friendly interface, so you don’t need to know all the nitty-gritty to be able to install and run Linux on your rooted Android device.

Before you proceed with installing Linux on Android using Linux Deploy, you need to install two additional apps on your device: a terminal emulator and a VNC client. Although several terminal emulator and VNC client apps are available in the Google Play Store, you can’t go wrong with VX ConnectBot and MultiVNC. Both are capable open source apps available free of charge.

To install one of the supported Linux distributions using Linux Deploy, launch the app, and tap the Properties button. The Properties window contains a list of configurable options. Start by choosing the desired Linux distribution from the Distribution list in the Deploy section. Linux Deploy supports many popular distros, including Debian, Ubuntu, Arch Linux, Fedora, and openSUSE. For certain distributions, you can also select a specific version. Choose Debian, for example, and you can pick the desired version (stable, testing, unstable, etc.) in the Distribution suite list.

By default, Linux Deploy uses a mirror based in Russia, but you can specify a mirror closer to you by editing the Mirror URL setting. If you are installing Debian, you can find a list of mirrors online. Pick the mirror closest to you and enter its URL as follows:

Linux Deploy can install Linux into an image file, a specific folder, or a separate partition, and you can choose the desired option in the Installation type list. In most cases, installing Linux as a single image file makes most sense, especially on devices that don’t support additional storage. If your Android device has an SD card slot, you can install Linux on a storage card or use just a partition on the card for that purpose.

You can choose the desired installation option from the Installation type list (Figure 2). If needed, you can also use the appropriate options to change the default installation path, specify the desired image size, choose the filesystem, and change the default android username.

Linux Deploy lets you install a graphical desktop environment, too, and the app supports several popular graphical desktops, including LXDE, Xfce, Gnome, and KDE. To install a desktop environment, pick the desired desktop from the Desktop environment list and enable the Install GUI option.

Читайте также:  Qualcomm atheros ��� mac os

The next stop is the Startup section. To start, make sure the SSH option is enabled; otherwise, you won’t be able to connect to the running Linux instance. If you chose to install a graphical desktop environment, you will have to enable the VNC option as well, so you can connect to the desktop using a VNC client app. Next, scroll down to the VNC section and configure the VNC settings, such as color depth and resolution as well as desktop dimensions.

Once you’re done tweaking settings and specifying options, you can tap the Install item and wait until Linux Deploy finishes the installation (Figure 3).

When the installation operation is completed, you should see the following status message:

Then, tap the Start button to boot the installed Linux distro. Note the IP address of the running Linux instance and launch the terminal emulator app (Figure 4).

Establish an SSH connection to the running Linux instance using its IP address and the default android username (or the username you specified in the Properties window). When prompted, enter the default changeme password.

The first thing you might want to do is change the default passwords. Issue the passwd command to change the user password and run sudo passwd root to assign root password. Accessing the graphical desktop environment is equally easy: Launch the VNC client app and connect to the running VNC server using the default changeme password (Figures 5 and 6).

Limbo PC Emulator

Limbo PC Emulator provides yet another way to run Linux on an Android device. This little app is a port of the popular Qemu emulator, and it allows you to run a handful of lightweight Linux distributions. Before you give Limbo a try, be aware that it’s not particularly fast. This is not a big surprise, considering that it emulates the x86 architecture on the ARM-based platform. Limbo’s sluggishness is one of the reasons why you should use it with a nimble Linux distribution like Damn Small Linux and Debian sans a graphical desktop environment. On the positive side, running Linux inside Limbo PC Emulator doesn’t require rooting, and the app is very straightforward to use.

Start by downloading the ISO image or the HDD file of the desired Linux distro. You can find the list of supported distros and links to ISO images and HDD files on the project’s website. Launch the Limbo app on the Android device, choose New from the Load VM drop-down list, and give the new virtual machine (VM) a name (Figure 7).

Assuming you want to boot the VM from an ISO image, you can use the CDROM option to select the downloaded .iso file. Use the Hard Disk A option to create an empty hard disk image for use with the VM. Then, select User from the Network Configuration drop-down list to enable networking in the NAT mode. Finally, you can enable the External VNC option if you want to access the graphical desktop from a remote machine via VNC. Next, tap the Start button to launch the created VM.

Although Limbo is relatively slow, the app has two features that can improve the emulator’s performance. Enabling the High Priority option can speed up the VM, but it can also make the Android device less responsive. A feature that lets you save the VM state won’t directly improve the performance, but it can help to avoid lengthy boot sequences by saving the VM in its current state. Note that this feature requires a hard disk file. Additionally, the project’s website offers a few tips on improving the performance of specific distros. For example, you can use the following boot parameters:

to speed up Damn Small Linux (Figure 8).

The apps I’ve described are not your only options for running Linux on an Android device. The Complete Linux Installer and Linux Installer apps, for example, let you install a Linux distribution on a rooted Android device. If you own a Google Nexus 7 device, you can replace Android with Ubuntu by following the instructions on the Ubuntu wiki. The described solutions have their advantages and drawbacks, but because they are all available free of charge, you can try them all and pick the one that best fits your needs.

Dmitri Popov has been writing exclusively about Linux and open source software for many years, and his articles have appeared in Danish, British, US, German, Spanish, and Russian magazines and websites. Dmitri is an amateur photographer, and he writes about open source photography tools on his Scribbles and Snaps blog at scribblesandsnaps.com.

If you want to install Linux on an Android device, you have several options. We examine some of the possibilities.

Источник

Оцените статью