2

I installed xenial (Ubuntu 16.04) in a chroot on my Android device (using armhf architecture). Everything works just fine. All the local commands and wget and curl work fine. However, apt-get fails. Here is the issue:

  1. sudo apt-get update gives me an error: Temporary failure resolving ports.ubuntu.com (other programs such as wget and curl can access dns names successfully). I pinged the servers and obtained the IP so I edit the /etc/apt/sources.list to reflect this

  2. sudo apt-get update gives me another error: Could not create a socket for 91.189.88.150 (f=2 t=1 p=6) - socket (13: Permission denied)

  3. Alright, so then I suid all the apt-* programs: sudo chmod u+s /usr/bin/apt-*

To remove any questions about the specific apt-get version I have removed apt via apt-get itself and installed the apt.deb via dpkg successfully, however, the problem persists.

It's very surprising that this basic feature on Ubuntu seems to be broken, it could be specific to armhf packages. I can't seem to find the same problem reported on SO. However, I did find another user reporting something similar on reddit's /r/debian but it was not concluded.

Any suggestions?

2 Answers 2

3

I commented on https://www.reddit.com/r/debian/comments/503ja3/issues_with_debian_on_android_phone/d8j290s/ that I have solved this issue, and here's more details for you (as you pinged me on reddit):

AFAIK, setsid to root in debian chroot won't work, because of Android sepolicy. Maybe there's a rule in Android sepolicy, such as, “to use network, you must have gid of inet (which is 3003, as you can see from adb shell id)”. Maybe it also says, “having setsid root is useless”.

So to make it work, you must add a group (maybe named android_inet) with gid 3003 in the debian chroot: sudo addgroup --gid 3003 android_inet, and then, change _apt's main group id to android_inet: sudo usermod -g android_inet _apt.

Adding android_inet as a supplementary group for _apt won't work, because that's not what the Android Sepolicy wants.

1
  • usermod -g 3003 _apt worked for me. thank you.
    – kangear
    Oct 3, 2017 at 9:13
0

edit /etc/passwd look up "_apt", change the value of group from 65534 to 3003 enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .