How to install ubuntu server for lxc on a smartphone (ARM or x86, bare metal)?

As of May 2019 what are the options (if any) to install Ubuntu server on a smartphone device?

I don't need much of the smartphone functionality, I don't need desktop and touchscreen blows and whistles at all (the phone will be accessed mostly through SSH and USB, it would be nice to have a working terminal on the phone).

I intend to use my old device (originally Android, Nexus 4 or BQ Aquaris E5 or ASUS ZenFone 2) as a mobile LAMP server and run lxc containers on it (serving the apps).

Does anybody have any experience / ideas?

I looked at Ubuntu Touch / UBports solution, but it focuses mostly on smartphone functionality (supporting all hardware, installing Android apps, nice touch desktop etc.). I need more of a server - less of a smartphone... Not only me, perhaps.

BTW the most detailed answers related to Ubuntu Touch (for those who are interested) are gathered here: What hardware does Ubuntu Touch support?

Links to related questions / discussions:

  1. How to use Android SDK and smartphone vendor tools to boot another kernel?

  2. Ubuntu Touch (UBports) and Android support for LXC/LXD containers (for running Ubuntu): current state


Solution 1:

{{ UPDATE 2 }}

The second part of the answer with more details on research path is given here:

How to use Android SDK and smartphone vendor tools to boot another kernel?.

{{ UPDATE 1 }}

AFTER A MORE DETAILED RESEARCH THE CONCLUSION IS SIMPLE:

MISSION IMPOSSIBLE

As of May-2019 it is impossible to install any of the mainstream linux server distros on smartphones (listed in the question and most likely any other) in a feasible way. If you have a decent 2-3 year old hardware (like ZenFone2 with 4-core 2.3Ghz 22nm 64bit Intel Atom CPU, 4Gb RAM and 64Gb flash drive and with scratched screen), just sell it for nothing, give it away or break it. The hardware you paid for has a very limited usage (compared to a PC).

There seem to be some initiatives but they are so weak and marginal that are barely worth mentioning. Only one link is enough to understand the situation: https://en.wikipedia.org/wiki/List_of_open-source_mobile_phones

Only ONE phone in the list (a honeypot? or a carrot? or both?) which is even not available at the moment have 'multiple community-driven' in the OS column. To me the situation is clear. No way guys)))

{{ ORIGINAL ANSWER }}

After a small research I found out that things are not as good as they could be.

Debian community instructions could be found here:

https://www.debian.org/releases/stable/armhf/ch02s01.html.en#armhf-armmp-supported-platforms

Section 2.1.3. Variations in ARM CPU designs and support complexity gives general view of the problem and possible solutions to it. It seems to be possible to install Debian server on a smartphone, but the process is rather painful.

Some examples:

1) http://julianwi.square7.ch/debian-on-smartphone/

2) http://bonedaddy.net/pabs3/log/2012/12/03/debian-mobile/

Ubuntu:

I managed to install UBports / Ubuntu Touch on Nexus 4 (ARMv7-A CPU) easily with the help of their wonderful user friendly ubports-installer (https://ubuntu-touch.io/get-ut). The process took 5 minutes or so (I had to activate developer mode on the phone and restart it 2 times), all things were handled automatically, the phone booted into working Ubuntu Touch OS nice and smoothly. However that was not the task. I needed ubuntu-server.

Then I found mentioning of another tool on UBports site (FAQ section), namely MDT (https://github.com/MariusQuabeck/magic-device-tool). It is no longer supported but its purpose is much closer - it was supporting various OS images (including Ubuntu Desktop 13.04!) and various smartphone models. Very sad that this tool is no longer maintained. It would solve the problem if ubuntu-server image for arm devices was supported. I am wondering whether the maintainers of UBports could extend their tool (ubports-installer) and add support of server images (perhaps use MDT tool codebase)...

I will try to install ubuntu-sever (or debian) manually, but unfortunately this is going to take more research / time than it could (if we had a working / maintained version of the installer). We don't need a gui version like ubports-installer, just a CLI version which would bundle working scripts maintained by people behind MDT project and UBports team.