Skip to content

Commit 14af6e9

Browse files
committed
add LXC deploy instructions
1 parent 74d1ebf commit 14af6e9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

deploy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ resort, it's always capable via customizing Linux kernel.
2828
- [Fedora](fedora.md)
2929
- [Gentoo](gentoo.md)
3030
- [Kubernetes](kubernetes.md)
31+
- [LXC](lxc.md)
3132
- [Mint](mint.md)
3233
- [OpenEuler](openeuler.md)
3334
- [PopOS](pop_os.md)

deploy/lxc.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Deploy redroid via LXC
2+
3+
```
4+
## take Ubuntu 22.04 as example here
5+
## adjust for other Linux distros
6+
7+
## install required kernel modules
8+
apt install linux-modules-extra-`uname -r`
9+
modprobe binder_linux devices="binder,hwbinder,vndbinder"
10+
11+
## install lxc tools
12+
apt install lxc-utils
13+
14+
## check lxc netowrking
15+
systemctl --no-pager status lxc-net
16+
17+
## adjust oci template
18+
sed -i 's/set -eu/set -u/g' /usr/share/lxc/templates/lxc-oci
19+
20+
## install required tools
21+
apt install skopeo umoci jq
22+
23+
## create redroid container
24+
lxc-create -n redroid11 -t oci -- -u docker://docker.io/redroid/redroid:11.0.0-latest
25+
26+
## adjust container config
27+
mkdir $HOME/data-redroid11
28+
sed -i '/lxc.include/d' /var/lib/lxc/redroid11/config
29+
<<EOF cat >> /var/lib/lxc/redroid11/config
30+
### hacked
31+
lxc.init.cmd = /init androidboot.hardware=redroid androidboot.redroid_gpu_mode=guest
32+
lxc.apparmor.profile = unconfined
33+
lxc.autodev = 1
34+
lxc.autodev.tmpfs.size = 25000000
35+
lxc.mount.entry = $HOME/data-redroid11 data none bind 0 0
36+
EOF
37+
38+
## [workaround] for redroid networking
39+
rm /var/lib/lxc/redroid11/rootfs/vendor/bin/ipconfigstore
40+
41+
## start redroid container
42+
lxc-start -l debug -o redroid11.log -n redroid11
43+
44+
## check container info
45+
lxc-info redroid11
46+
47+
## grab adb shell
48+
adb connect `lxc-info redroid11 -i | awk '{print $2}'`:5555
49+
50+
## or execute sh directly
51+
nsenter -t `lxc-info redroid11 -p | awk '{print $2}'` -a sh
52+
53+
## stop redroid container
54+
lxc-stop -k redroid11
55+
```

0 commit comments

Comments
 (0)