Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/anbox: use mainline drivers when available #102341

Closed
wants to merge 4 commits into from

Conversation

mvnetbiz
Copy link
Contributor

@mvnetbiz mvnetbiz commented Nov 1, 2020

Motivation for this change

virtualisation.anbox is broken on Linux 5.x

Things done
  • updated Anbox package to latest version
  • marked anbox kernel modules broken for Linux >= 5.7. They do not build because Linux 5.7 unexported kallsyms_lookup_name()
  • enable CONFIG_ options for the mainline kernel drivers needed
  • change Anbox NixOS module to use the correct drivers if using Linux 5.x

I have confirmed this working with Linux 4.19, 5.4, 5.7

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mvnetbiz mvnetbiz changed the title Anbox linux pkgs.anbox: unstable-2019-11-15 -> unstable-2020-10-26, nixos/anbox: use mainline drivers when available Nov 1, 2020
@mvnetbiz mvnetbiz marked this pull request as ready for review November 3, 2020 05:27
@mvnetbiz
Copy link
Contributor Author

mvnetbiz commented Nov 3, 2020

I've fixed the build inputs, fixed up some stuff like .desktop file and app menu category, and added a test for the service module.

@mvnetbiz
Copy link
Contributor Author

Rebased and fixed the nixos test to be reliable. Are there any concerns since this changes the kernel?

@@ -130,7 +135,8 @@ in
--container-network-gateway=${cfg.ipv4.gateway.address} \
--container-network-dns-servers=${cfg.ipv4.dns} \
--use-rootfs-overlay \
--privileged
--privileged \
--daemon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you have to add Type=fork if you use daemon here?
You are adding it only to avoid the warning or any other reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did add it to avoid the warning but the process doesn't fork anyways, or at least doesn't exit.

@spinus
Copy link
Member

spinus commented Nov 28, 2020

@mvnetbiz thanks, that looks pretty good.

@mvnetbiz
Copy link
Contributor Author

mvnetbiz commented Dec 3, 2020

I don't know what considerations should be taken for adding drivers to the default kernel, or if there is an alternative option.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work!

Working as wellpoorly as upstream allows AFAICT. Tested on linux_zen 5.9. Networking works too.


services.udev.extraRules = ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this stay but put behind a conditional for useAnboxModules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell these rules don't do anything anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't recall but they either don't run or anbox works correctly with the default mode anyways.

virtualisation.anbox.enable = true;
virtualisation.memorySize = 1500;

programs.adb.enable = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nixpkgs' adb has a proprietary license, not sure whether we could run this test in hydra.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will that just cause an evaluation error or any other problems? I am assuming it is still okay to keep the test here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Will probably adapt to the new PR)

I think it's time we have a non-SDK package for adb, fastboot and friends.

And there is one!

This is currently in use by Alpine Linux

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bqv
Copy link
Contributor

bqv commented Jan 7, 2021

Ping @mvnetbiz

mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Nov 28, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from NixOS#102341
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Nov 29, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from NixOS#102341
github-actions bot pushed a commit that referenced this pull request Dec 3, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from #102341

(cherry picked from commit c2e142d)
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Dec 7, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from NixOS#102341
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Dec 12, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from NixOS#102341
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Dec 24, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from NixOS#102341
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Dec 25, 2021
This enables ashmem, binder so waydroid/anbox works with
the provided linux kernel

Cherry-picked from NixOS#102341
aKriJcz pushed a commit to aKriJcz/nixpkgs that referenced this pull request Feb 16, 2022
As noted in NixOS#102341 this is not
actually running as a forked process. It only tells the process that it
is running "as a daemon, so shut the warning up".

See `daemon_` here

 - https://github.com/anbox/anbox/blob/9de4e87cdd05135e1c71e6eadb68bf82719cebdf/src/anbox/cmds/container_manager.cpp#L38-L79

It is **strictly** used to hide that message.

Co-authored-by: Matt Votava <mvnetbiz@gmail.com>
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 31, 2022
@mvnetbiz mvnetbiz closed this Apr 7, 2023
rnhmjoj pushed a commit to rnhmjoj/nixpkgs that referenced this pull request Sep 3, 2023
As noted in NixOS#102341 this is not
actually running as a forked process. It only tells the process that it
is running "as a daemon, so shut the warning up".

See `daemon_` here

 - https://github.com/anbox/anbox/blob/9de4e87cdd05135e1c71e6eadb68bf82719cebdf/src/anbox/cmds/container_manager.cpp#L38-L79

It is **strictly** used to hide that message.

Co-authored-by: Matt Votava <mvnetbiz@gmail.com>
rnhmjoj pushed a commit to rnhmjoj/nixpkgs that referenced this pull request Sep 3, 2023
As noted in NixOS#102341 this is not
actually running as a forked process. It only tells the process that it
is running "as a daemon, so shut the warning up".

See `daemon_` here

 - https://github.com/anbox/anbox/blob/9de4e87cdd05135e1c71e6eadb68bf82719cebdf/src/anbox/cmds/container_manager.cpp#L38-L79

It is **strictly** used to hide that message.

Co-authored-by: Matt Votava <mvnetbiz@gmail.com>
rnhmjoj pushed a commit to rnhmjoj/nixpkgs that referenced this pull request Sep 4, 2023
As noted in NixOS#102341 this is not
actually running as a forked process. It only tells the process that it
is running "as a daemon, so shut the warning up".

See `daemon_` here

 - https://github.com/anbox/anbox/blob/9de4e87cdd05135e1c71e6eadb68bf82719cebdf/src/anbox/cmds/container_manager.cpp#L38-L79

It is **strictly** used to hide that message.

Co-authored-by: Matt Votava <mvnetbiz@gmail.com>
rnhmjoj pushed a commit to rnhmjoj/nixpkgs that referenced this pull request Sep 5, 2023
As noted in NixOS#102341 this is not
actually running as a forked process. It only tells the process that it
is running "as a daemon, so shut the warning up".

See `daemon_` here

 - https://github.com/anbox/anbox/blob/9de4e87cdd05135e1c71e6eadb68bf82719cebdf/src/anbox/cmds/container_manager.cpp#L38-L79

It is **strictly** used to hide that message.

Co-authored-by: Matt Votava <mvnetbiz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet