Author Topic: How to run Linux userland under Android  (Read 13260 times)

candlerb

  • Newbie
  • *
  • Posts: 8
    • View Profile
How to run Linux userland under Android
« on: February 23, 2018, 09:38:09 am »
Hello,

I am expecting my Gemini to arrive shortly - out of the blue I got a tracking number from MyHermes :-) So before it does, I'd like to raise a few questions.

My planned use of Gemini is with a Linux userland - e.g. I want to be able to do "apt-get install XXX" and use Linux CLI tools - but I'd like that userland to be running on top of Android, so the Gemini continues to work as a phone and run Android apps like WhatsApp and Google Maps.  (Doing this means I don't need to carry a separate phone around).  I saw Gemini working this way a few months ago.

I note that Planetcom have announced https://www.indiegogo.com/projects/gemini-p...one#/updates/49 that there will be a reflashing/repartitioning tool; however their announced Linux support page http://support.planetcom.co.uk/index.php/Linux_Support is currently empty.  There's some more info at GKA https://github.com/gemian/gemini-keyboard-apps/wiki but this seems to be about dual-booting.

So my questions are about how I go about running a Linux userland and/or X desktop while the phone is running Android.

1. Does it require reflashing?  If so, should I reflash my device as soon as it arrives in preparation?

(I am concerned that if I spend a lot of time setting it all up under Android, I am going to lose all that work when I add Linux)

2. Does running Linux under Android use the same Linux partition as if I dual-booted into Linux?

(Maybe it work *better* to boot directly into Linux?  But I am guessing I would lose at least voice calling, if not SMS and data as well)

3. Does it require rooting, and if so how do I go about that?

4. I believe I would also need an Android X server app to get a GUI desktop - what app would I require?

Any clues gratefully received!   Thanks... Brian.

Murple2

  • Full Member
  • ***
  • Posts: 137
    • View Profile
How to run Linux userland under Android
« Reply #1 on: February 23, 2018, 12:37:40 pm »
Quote from: candlerb
Hello,

I am expecting my Gemini to arrive shortly - out of the blue I got a tracking number from MyHermes :-) So before it does, I'd like to raise a few questions.

My planned use of Gemini is with a Linux userland - e.g. I want to be able to do "apt-get install XXX" and use Linux CLI tools - but I'd like that userland to be running on top of Android, so the Gemini continues to work as a phone and run Android apps like WhatsApp and Google Maps.  (Doing this means I don't need to carry a separate phone around).  I saw Gemini working this way a few months ago.

I note that Planetcom have announced https://www.indiegogo.com/projects/gemini-p...one#/updates/49 that there will be a reflashing/repartitioning tool; however their announced Linux support page http://support.planetcom.co.uk/index.php/Linux_Support is currently empty.  There's some more info at GKA https://github.com/gemian/gemini-keyboard-apps/wiki but this seems to be about dual-booting.

So my questions are about how I go about running a Linux userland and/or X desktop while the phone is running Android.

1. Does it require reflashing?  If so, should I reflash my device as soon as it arrives in preparation?

(I am concerned that if I spend a lot of time setting it all up under Android, I am going to lose all that work when I add Linux)

2. Does running Linux under Android use the same Linux partition as if I dual-booted into Linux?

(Maybe it work *better* to boot directly into Linux?  But I am guessing I would lose at least voice calling, if not SMS and data as well)

3. Does it require rooting, and if so how do I go about that?

4. I believe I would also need an Android X server app to get a GUI desktop - what app would I require?

Any clues gratefully received!   Thanks... Brian.

I use Linux Deploy (in play store) on android for running linux. It can install and run linux from a file container, or from a dedicated partition.  It does need root however, which would require you to reflash your device, but...

there are now ways of running linux without root - (I haven't tried it)
https://fossbytes.com/how-to-install-a-linu...ithout-rooting/

For the X server I use XServer XSDL https://play.google.com/store/apps/details?...erver&hl=en

In theory you could chroot into the same linux install that you dual boot into. There may be some caveats to this, and would probably require a little more configuring.  I'd be happy to post some howtos once I get my device (not soon unfortunately!)

Murple2

  • Full Member
  • ***
  • Posts: 137
    • View Profile
How to run Linux userland under Android
« Reply #2 on: February 23, 2018, 12:59:25 pm »
To be honest it may be that Sailfish will meet your needs nicely.  I guess it depends on the android app support - you mention whatsapp etc. I'm sure we'll get a better picture when they showcase at MWC this month

candlerb

  • Newbie
  • *
  • Posts: 8
    • View Profile
How to run Linux userland under Android
« Reply #3 on: February 25, 2018, 05:08:03 am »
Quote from: Murple2
there are now ways of running linux without root - (I haven't tried it)
https://fossbytes.com/how-to-install-a-linu...ithout-rooting/

That looks neat - thanks!  I wonder what the limitations of this approach are?  Presumably anything running setuid root isn't really running as root - meaning presumably no direct access to /dev devices, unable to mount filesystems etc.

Murple2

  • Full Member
  • ***
  • Posts: 137
    • View Profile
How to run Linux userland under Android
« Reply #4 on: February 25, 2018, 06:59:37 am »
Quote from: candlerb
Quote from: Murple2
there are now ways of running linux without root - (I haven't tried it)
https://fossbytes.com/how-to-install-a-linu...ithout-rooting/

That looks neat - thanks!  I wonder what the limitations of this approach are?  Presumably anything running setuid root isn't really running as root - meaning presumably no direct access to /dev devices, unable to mount filesystems etc.

Yeah that sounds about right. You'lll be able to use root with the context of the Linux userland, but you won't be able to do anything that needs root permissions in android.

Found this useful link covering the topic at large: https://wiki.debian.org/ChrootOnAndroid

candlerb

  • Newbie
  • *
  • Posts: 8
    • View Profile
How to run Linux userland under Android
« Reply #5 on: February 26, 2018, 04:42:16 pm »
Quote from: Murple2
Found this useful link covering the topic at large: https://wiki.debian.org/ChrootOnAndroid

Thanks.

It looks like GNUroot hasn't been updated since Feb/March 2014: https://github.com/corbinlc/gnuroot https://www.dropbox.com/sh/blwlhsb986xv5hg/7VPnQZZ_fj?lst= - but there is a more recent version called GNUroot Debian https://github.com/corbinlc/GNURootDebian


Termux https://github.com/termux/termux-packages looks better maintained, but as far as I can see it has its own packages, it's not an Debian/Ubuntu.

candlerb

  • Newbie
  • *
  • Posts: 8
    • View Profile
How to run Linux userland under Android
« Reply #6 on: March 04, 2018, 03:59:00 pm »
Replying to myself... GNUroot is a very cut down Debian Jessie. It starts to look a bit normal when you do:

Code: [Select]
apt-get update
apt-get install apt-utils iputils-ping openssh-client

(Aside: having the minus sign as a Fn-combination really is painful - nut maybe I'll be able to train myself into this)

The fakeness of the root is immediately apparent, as for example

Code: [Select]
# ping 8.8.8.8
ping: icmp open socket: Operation not permitted

GNUroot lets you start an Xterm in a VNC X session - but once I'd started it, I could find no way to stop it other than reboot the phone.

So I'm not sure that GNUroot is actually useful other than as a cool toy.

TheKit

  • Newbie
  • *
  • Posts: 28
    • View Profile
How to run Linux userland under Android
« Reply #7 on: March 05, 2018, 09:52:42 am »
I'd suggest to simply root it with Magisk (extract boot.img, modify it through Magisk Manager and flash it back via FlashTool) and use Linux Deploy. As a bonus, if you flash Linux dualboot, you can configure Linux Deploy to mount Linux partition and chroot there.

AndyM

  • Newbie
  • *
  • Posts: 6
    • View Profile
How to run Linux userland under Android
« Reply #8 on: March 07, 2018, 06:52:41 am »
Quote from: TheKit
I'd suggest to simply root it with Magisk (extract boot.img, modify it through Magisk Manager and flash it back via FlashTool) and use Linux Deploy. As a bonus, if you flash Linux dualboot, you can configure Linux Deploy to mount Linux partition and chroot there.

Looks as though the Planet guys have just done this for us. Rooted bootloader now available on Android support page.
« Last Edit: March 18, 2018, 04:07:27 pm by AndyM »

graynada

  • Full Member
  • ***
  • Posts: 117
    • View Profile
How to run Linux userland under Android
« Reply #9 on: July 27, 2018, 03:18:03 pm »
I'm using UserLAnd and it's pretty good. No need for a separate partition so keeps maximum flexibility on storage and all tteh Android stuff running too. Suits my needs nicely

peter

  • Newbie
  • *
  • Posts: 17
    • View Profile
How to run Linux userland under Android
« Reply #10 on: August 04, 2018, 01:31:10 pm »
Quote from: TheKit
As a bonus, if you flash Linux dualboot, you can configure Linux Deploy to mount Linux partition and chroot there.

I've installed Linux Deploy, but I have no idea how to mount my dualboot image as you suggest.  Any hints?

Murple2

  • Full Member
  • ***
  • Posts: 137
    • View Profile
How to run Linux userland under Android
« Reply #11 on: August 04, 2018, 02:56:03 pm »
Quote from: peter
Quote from: TheKit
As a bonus, if you flash Linux dualboot, you can configure Linux Deploy to mount Linux partition and chroot there.

I've installed Linux Deploy, but I have no idea how to mount my dualboot image as you suggest.  Any hints?
Create a new profile and then in the settings for that profile select 'installation type: partition' and 'installation path: /dev/block/mmcblk0p29'. Select debian for your distro. Don't 'install' as linux is already on the partition. If you look around the forum you'll find some instructions for setting up the networking. otherwise you are pretty much golden.

peter

  • Newbie
  • *
  • Posts: 17
    • View Profile
How to run Linux userland under Android
« Reply #12 on: August 04, 2018, 06:53:01 pm »
Quote from: Murple2
Create a new profile and then in the settings for that profile select 'installation type: partition' and 'installation path: /dev/block/mmcblk0p29'. Select debian for your distro. Don't 'install' as linux is already on the partition. If you look around the forum you'll find some instructions for setting up the networking. otherwise you are pretty much golden.

Thank you!

graynada

  • Full Member
  • ***
  • Posts: 117
    • View Profile
How to run Linux userland under Android
« Reply #13 on: August 11, 2018, 09:45:19 pm »
The advantages I see from using an in Android partition (only the one Android partion as when received) over having a separate partion are:

   1. You should still be able to use OTA updates.
   2. Maximum flexibility with storage. When setting up a separate partition you have to take a punt at how much you want for each. With the Android solution you can just use all your 64Gb as it suits you at the time between Linux and Android.

Murple2

  • Full Member
  • ***
  • Posts: 137
    • View Profile
How to run Linux userland under Android
« Reply #14 on: August 12, 2018, 02:50:06 am »
Quote from: graynada
The advantages I see from using an in Android partition (only the one Android partion as when received) over having a separate partion are:

   1. You should still be able to use OTA updates.
   2. Maximum flexibility with storage. When setting up a separate partition you have to take a punt at how much you want for each. With the Android solution you can just use all your 64Gb as it suits you at the time between Linux and Android.

Yeah, unless you want to dualboot (or multiboot) there is little advantage to using a separate partition for linux. Although OTA's should still work so long as you have left enough space for Android!