|
post_install() {
|
|
post_upgrade
|
|
}
|
|
|
|
post_upgrade() {
|
|
|
|
# Provided by anbox-modules-dkms-git
|
|
modprobe binder_linux ashmem_linux
|
|
|
|
# Required by Anbox network bridge
|
|
systemctl restart systemd-networkd
|
|
|
|
systemctl enable lxc.service
|
|
systemctl start lxc.service
|
|
systemctl enable anbox-container-manager.service
|
|
systemctl start anbox-container-manager.service
|
|
|
|
echo "
|
|
Add the following lines to /etc/subuid and /etc/subgid:
|
|
|
|
root:100000:65536
|
|
root:1000:2
|
|
root:101001:99999
|
|
|
|
This ensures that Android LXC container user & group mappings are isolated
|
|
from the main OS.
|
|
|
|
Enable Anbox for the current user by issuing:
|
|
|
|
systemctl --user enable anbox-session-manager.service
|
|
systemctl --user start anbox-session-manager.service
|
|
|
|
- You must have kernel modules 'binder_linux' and 'ashmem_linux' enabled and in-use (provided by anbox-modules-dkms-git)
|
|
- You must have proper 'android.img' Android image file for Anbox container manager system service (provided by anbox-image)
|
|
- Default location: /var/lib/anbox/android.img
|
|
|
|
- You find logs at /var/lib/anbox/logs/ folder for debugging
|
|
- Also consider running Anbox managers with env var ANBOX_LOG_LEVEL=debug
|
|
"
|
|
|
|
}
|
|
|
|
post_remove() {
|
|
|
|
# Ensure Anbox network bridge is removed
|
|
systemctl restart systemd-networkd
|
|
|
|
# Delete LXC user & group mappings
|
|
for file in subuid subgid; do
|
|
sed -i 's/root:100000:65536//; s/root:1000:2//; s/root:101001:99999//' /etc/${file}
|
|
done
|
|
systemctl restart lxc.service
|
|
|
|
echo "
|
|
LXC service is still running. You may want to disable it by issuing
|
|
|
|
sudo systemctl stop lxc.service && sudo systemctl disable lxc.service
|
|
"
|
|
}
|