Nixpkgs: Anbox not working : session-manager, network connectivity

Created on 5 Feb 2020  Â·  32Comments  Â·  Source: NixOS/nixpkgs

Describe the bug
Running anbox session-manager just hangs showing nothing

To Reproduce

{
  virtualisation.anbox.enable = true;
}

Rebuild then reboot
Run

anbox session-manager

Expected behavior
Showing session-manager

Metadata

these paths will be fetched (0.05 MiB download, 0.28 MiB unpacked):
  /nix/store/h3iim69ysaha4v7lgk6s26i57vmwffaw-bash-interactive-4.4-p23-dev
copying path '/nix/store/h3iim69ysaha4v7lgk6s26i57vmwffaw-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.100, NixOS, 20.03pre211190.a21c2fa3ea2 (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.2`
 - channels(root): `"nixos-20.03pre211190.a21c2fa3ea2"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: virtualisation.anbox

I will create a wiki page for this

bug regression nixos module (update) package (update)

Most helpful comment

Adapted https://github.com/geeks-r-us/anbox-playstore-installer
To NixOS -> https://github.com/eoli3n/anbox-playstore-installer-nixos

It would be great to be able to add virtualisation.anbox.gapps options and to add anbox-bridge script in the package.

All 32 comments

I would ping https://github.com/NixOS/nixpkgs/commits/master/pkgs/os-specific/linux/anbox/default.nix
https://github.com/NixOS/nixpkgs/pull/57826 authors. I believe it used to work.

I'd also prefer if this issue could not handle the documentation issue, note that the wiki isn't official so you can only request official NixOS documentation in the NixOS manual here.

@gebner @Mic92 @edwtjo @Infinisil ?

I used it in the past but not recently, so it definitely used to work.

Just retried and running "launch" opens application manager

$ anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity

Session-manager gives me a weird warning

$ anbox session-manager
[ 2020-02-07 10:05:26] [daemon.cpp:61@Run] bind: Address already in use

Another problem is that anbox can't connect to network.

$ adb shell
x86_64:/ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
11: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d6:e6:63:9c:d2:d7 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.250.2/24 brd 192.168.250.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::d4e6:63ff:fe9c:d2d7/64 scope link 
       valid_lft forever preferred_lft forever
x86_64:/ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.250.2: icmp_seq=1 Destination Host Unreachable
From 192.168.250.2: icmp_seq=2 Destination Host Unreachable
From 192.168.250.2: icmp_seq=3 Destination Host Unreachable
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5131ms
pipe 4
1|x86_64:/ $ ip route
192.168.250.0/24 dev eth0  proto kernel  scope link  src 192.168.250.2 

It seems that we need to add manually default gateway, but i can't su
https://github.com/anbox/anbox/issues/443#issuecomment-345449671

x86_64:/ $ su 
/system/bin/sh: su: can't execute: Permission denied

Another problem is that anbox can't connect to network.

This used to work. Note that the routing is not visible with ip route, you need to run ip route show table 0: https://github.com/NixOS/nixpkgs/pull/57826#issuecomment-474339514

Right, thx

x86_64:/ $ ip route show table 0
default via 192.168.250.1 dev eth0  table eth0  proto static 
192.168.250.0/24 dev eth0  table eth0  proto static  scope link 
192.168.250.0/24 dev eth0  proto kernel  scope link  src 192.168.250.2 
broadcast 127.0.0.0 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
local 127.0.0.0/8 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
local 127.0.0.1 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
broadcast 127.255.255.255 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
broadcast 192.168.250.0 dev eth0  table local  proto kernel  scope link  src 192.168.250.2 
local 192.168.250.2 dev eth0  table local  proto kernel  scope host  src 192.168.250.2 
broadcast 192.168.250.255 dev eth0  table local  proto kernel  scope link  src 192.168.250.2 
fe80::/64 as to ::7400:0:1800:200:197c:3d5e dev eth0  proto kernel  metric 256 
local ::1 as to ::7400:0:1800:200:197c:3d5e dev lo  table local  proto kernel  metric 0 
local fe80::d4e6:63ff:fe9c:d2d7 as to ::7400:0:1800:200:197c:3d5e dev eth0  table local  proto kernel  metric 0 
ff00::/8 as to ::3c00:0:1800:200:197c:3d5e dev eth0  table local  metric 256 

So i don't understand why it's not working, i don't know how to debug this

Archlinux has a way to install an image with googleapps : https://aur.archlinux.org/packages/anbox-image-gapps/
It would be great

Here's the script which provides network connectivity : https://github.com/anbox/anbox/blob/master/scripts/anbox-bridge.sh

$ sudo ./anbox-bridge.sh start
$ adb shell ping www.google.fr
PING www.google.fr (172.217.22.131) 56(84) bytes of data.
64 bytes from par21s12-in-f3.1e100.net (172.217.22.131): icmp_seq=1 ttl=49 time=13.5 ms
64 bytes from par21s12-in-f3.1e100.net (172.217.22.131): icmp_seq=2 ttl=49 time=13.4 ms
64 bytes from par21s12-in-f3.1e100.net (172.217.22.131): icmp_seq=3 ttl=49 time=13.4 ms

Adapted https://github.com/geeks-r-us/anbox-playstore-installer
To NixOS -> https://github.com/eoli3n/anbox-playstore-installer-nixos

It would be great to be able to add virtualisation.anbox.gapps options and to add anbox-bridge script in the package.

Here's the script which provides network connectivity : https://github.com/anbox/anbox/blob/master/scripts/anbox-bridge.sh

this relies on snap...?

Anbox as a whole heavily relies on Snap.

Even something as essential as activating verbose logging is hidden behind an obscure environment variable which gets set by a script Snap initialises its container with when snap is run in a certain way instead of providing a cli flag.

Snap is the only distribution the upstream devs care to support. It's reasonable from a dev perspective but...ugh

Fwiw I got Anbox to work* in unstable (and on 20.03 with #88437) with networking and everything, so I think this issue is resolved.
Could anyone confirm whether it works on their machine aswell? I use Networkmanager though, so it'd probably be useful to get at least one report from someone who uses a different method of network configuration.

* It doesn't work well but I think that's an upstream issue, not a Nix one.

Is this issue resolved?

Is this issue resolved?

Nope

What part specifically? It works on my machine.

What part specifically? It works on my machine.

Network, it doesn't work here,
i do virtualization.anbox enable and install anbox via nix-env -iA nixos.anbox(the anbox-unstable-2019 one),

how did u install and configure the anbox ?

Which method of network configuration do you use? I use NetworkManager, that might be why it works for me.

Which method of network configuration do you use? I use NetworkManager, that might be why it works for me.

I do use NetworkManager too,

checkout https://github.com/fnlaai/nixconf/blob/master/networking.nix

is it because I combine it with dnscrypt?

https://github.com/fnlaai/nixconf/blob/master/services.nix

Nope, I use dnscrypt-proxy aswell. I have told NetworkManager to not manage anbox0 though.

Are you on 20.03 or unstable?

Nope, I use dnscrypt-proxy aswell. I have told NetworkManager to not manage anbox0 though.

Are you on 20.03 or unstable?

I'm on 20.03.2107.70717a337f7 (Markhor), may I look into your NetworkManager conf the way it doesn't manage anbox0 ??

Sure, my entire config is in the open: https://github.com/Atemu/nixos-config

Be warned though, it's not meant to be browsed easily by anyone but me ;)
desktop.nix and PLATON-config.nix are what you probably want to be looking at.

Sure, my entire config is in the open: https://github.com/Atemu/nixos-config

Be warned though, it's not meant to be browsed easily by anyone but me ;)
desktop.nix and PLATON-config.nix are what you probably want to be looking at.

dang, still can't make it work haha. but it's ok, I'll drop my willing to use it.

 ✘ asbachb@nixos  ~  systemctl status anbox-container-manager.service
...
Aug 18 12:35:22 nixos anbox[706]: You are running the container manager manually which is most likely not
Aug 18 12:35:22 nixos anbox[706]: what you want. The container manager is normally started by systemd or
Aug 18 12:35:22 nixos anbox[706]: another init system. If you still want to run the container-manager
Aug 18 12:35:22 nixos anbox[706]: you can get rid of this warning by starting with the --daemon option.

Might that be part of the problem as well?

It prints the same on my machine.

Is networking borked on your machine too?

I don't get it running at all tbh.

Error(s)?

Ok. It seems to work with networking as well:

anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivit
 ✘ asbachb@nixos  ~  anbox wait-ready
[ 2020-08-18 11:02:43] [daemon.cpp:61@Run] Application manager service is not running yet

Which method of network management do you use?

Basically I use only NetworkManager with no further configuration:

networking.networkmanager.enable = true;

Ohh, my bad, my config must be conflict with the dnscrypt one.

@fnlaai as I said, dnscrypt works for me but it likely is a configuration issue on your end. Definitely investigate it though, you might not be the only person to have it.

Since Anbox and networking seem to be working (at least with the networking manager you're most likely to use on a GUI machine) I think we can close this issue.
If anyone finds a configuration where it doesn't work, please open a new issue. This one has bloated past usefulness I think.

@fnlaai as I said, dnscrypt works for me but it likely is a configuration issue on your end. Definitely investigate it though, you might not be the only person to have it.

Since Anbox and networking seem to be working (at least with the networking manager you're most likely to use on a GUI machine) I think we can close this issue.
If anyone finds a configuration where it doesn't work, please open a new issue. This one has bloated past usefulness I think.

Right, it was my fault, I'll do further check. Sure close this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomberek picture tomberek  Â·  3Comments

matthiasbeyer picture matthiasbeyer  Â·  3Comments

retrry picture retrry  Â·  3Comments

chris-martin picture chris-martin  Â·  3Comments

spacekitteh picture spacekitteh  Â·  3Comments