我喜欢能够在 Ubuntu 上安装 PlayStore 应用的想法,但我在安装 Anbox 时遇到了错误。我对分步解答感兴趣(考虑到任何故障排除),这样像我这样的普通 Ubuntu 用户就可以从可行的解决方案中受益。
这可能是以下问题的重复,但不同之处在于我要求的答案是针对 Ubuntu 19.10 的普通用户的答案:可能重复
故障排除
由于下面的故障排除评论,该教程似乎引导我同时安装 deb 和 snap 安装。所以我将它们分开以分别进行故障排除。
通过 Deb 安装:
这里我通过 deb 安装了 Anbox:
max@msi:~$ sudo apt-get install anbox
[sudo] password for max:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
bridge-utils libboost-log1.67.0 libboost-program-options1.67.0
libboost-regex1.67.0 liblxc-common liblxc1 libpam-cgfs libprotobuf-lite17
libsdl2-2.0-0 libsdl2-image-2.0-0 lxc lxc-utils lxcfs uidmap
Suggested packages:
ifupdown btrfs-tools lvm2 lxc-templates lxctl
The following NEW packages will be installed:
anbox bridge-utils libboost-log1.67.0 libboost-program-options1.67.0
libboost-regex1.67.0 liblxc-common liblxc1 libpam-cgfs libprotobuf-lite17
libsdl2-2.0-0 libsdl2-image-2.0-0 lxc lxc-utils lxcfs uidmap
0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,844 kB of archives.
After this operation, 18.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 lxcfs amd64 3.0.4-2 [40.7 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libboost-regex1.67.0 amd64 1.67.0-13ubuntu1 [458 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libboost-log1.67.0 amd64 1.67.0-13ubuntu1 [584 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu eoan/main amd64 libboost-program-options1.67.0 amd64 1.67.0-13ubuntu1 [333 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 liblxc-common amd64 3.0.4-0ubuntu1 [440 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 liblxc1 amd64 3.0.4-0ubuntu1 [257 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu eoan/main amd64 libprotobuf-lite17 amd64 3.6.1.3-2 [129 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libsdl2-2.0-0 amd64 2.0.10+dfsg1-1ubuntu1 [405 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libsdl2-image-2.0-0 amd64 2.0.5+dfsg1-1 [63.7 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu eoan/main amd64 bridge-utils amd64 1.6-2ubuntu1 [30.5 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 lxc-utils amd64 3.0.4-0ubuntu1 [354 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 lxc all 3.0.4-0ubuntu1 [2,960 B]
Get:13 http://us.archive.ubuntu.com/ubuntu eoan/multiverse amd64 anbox amd64 0.0~git20190124-1 [651 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 libpam-cgfs amd64 3.0.4-0ubuntu1 [30.8 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu eoan/universe amd64 uidmap amd64 1:4.5-1.1ubuntu4 [65.7 kB]
Fetched 3,844 kB in 2s (1,655 kB/s)
Selecting previously unselected package lxcfs.
(Reading database ... 198438 files and directories currently installed.)
Preparing to unpack .../00-lxcfs_3.0.4-2_amd64.deb ...
Unpacking lxcfs (3.0.4-2) ...
Selecting previously unselected package libboost-regex1.67.0:amd64.
Preparing to unpack .../01-libboost-regex1.67.0_1.67.0-13ubuntu1_amd64.deb ...
Unpacking libboost-regex1.67.0:amd64 (1.67.0-13ubuntu1) ...
Selecting previously unselected package libboost-log1.67.0.
Preparing to unpack .../02-libboost-log1.67.0_1.67.0-13ubuntu1_amd64.deb ...
Unpacking libboost-log1.67.0 (1.67.0-13ubuntu1) ...
Selecting previously unselected package libboost-program-options1.67.0:amd64.
Preparing to unpack .../03-libboost-program-options1.67.0_1.67.0-13ubuntu1_amd64.deb ...
Unpacking libboost-program-options1.67.0:amd64 (1.67.0-13ubuntu1) ...
Selecting previously unselected package liblxc-common.
Preparing to unpack .../04-liblxc-common_3.0.4-0ubuntu1_amd64.deb ...
Unpacking liblxc-common (3.0.4-0ubuntu1) ...
Selecting previously unselected package liblxc1.
Preparing to unpack .../05-liblxc1_3.0.4-0ubuntu1_amd64.deb ...
Unpacking liblxc1 (3.0.4-0ubuntu1) ...
Selecting previously unselected package libprotobuf-lite17:amd64.
Preparing to unpack .../06-libprotobuf-lite17_3.6.1.3-2_amd64.deb ...
Unpacking libprotobuf-lite17:amd64 (3.6.1.3-2) ...
Selecting previously unselected package libsdl2-2.0-0:amd64.
Preparing to unpack .../07-libsdl2-2.0-0_2.0.10+dfsg1-1ubuntu1_amd64.deb ...
Unpacking libsdl2-2.0-0:amd64 (2.0.10+dfsg1-1ubuntu1) ...
Selecting previously unselected package libsdl2-image-2.0-0:amd64.
Preparing to unpack .../08-libsdl2-image-2.0-0_2.0.5+dfsg1-1_amd64.deb ...
Unpacking libsdl2-image-2.0-0:amd64 (2.0.5+dfsg1-1) ...
Selecting previously unselected package bridge-utils.
Preparing to unpack .../09-bridge-utils_1.6-2ubuntu1_amd64.deb ...
Unpacking bridge-utils (1.6-2ubuntu1) ...
Selecting previously unselected package lxc-utils.
Preparing to unpack .../10-lxc-utils_3.0.4-0ubuntu1_amd64.deb ...
Unpacking lxc-utils (3.0.4-0ubuntu1) ...
Selecting previously unselected package lxc.
Preparing to unpack .../11-lxc_3.0.4-0ubuntu1_all.deb ...
Unpacking lxc (3.0.4-0ubuntu1) ...
Selecting previously unselected package anbox.
Preparing to unpack .../12-anbox_0.0~git20190124-1_amd64.deb ...
Unpacking anbox (0.0~git20190124-1) ...
Selecting previously unselected package libpam-cgfs.
Preparing to unpack .../13-libpam-cgfs_3.0.4-0ubuntu1_amd64.deb ...
Unpacking libpam-cgfs (3.0.4-0ubuntu1) ...
Selecting previously unselected package uidmap.
Preparing to unpack .../14-uidmap_1%3a4.5-1.1ubuntu4_amd64.deb ...
Unpacking uidmap (1:4.5-1.1ubuntu4) ...
Setting up libboost-program-options1.67.0:amd64 (1.67.0-13ubuntu1) ...
Setting up libboost-regex1.67.0:amd64 (1.67.0-13ubuntu1) ...
Setting up libpam-cgfs (3.0.4-0ubuntu1) ...
Setting up lxcfs (3.0.4-2) ...
Created symlink /etc/systemd/system/multi-user.target.wants/lxcfs.service → /lib/systemd/system/lxcfs.service.
Setting up libprotobuf-lite17:amd64 (3.6.1.3-2) ...
Setting up uidmap (1:4.5-1.1ubuntu4) ...
Setting up libboost-log1.67.0 (1.67.0-13ubuntu1) ...
Setting up bridge-utils (1.6-2ubuntu1) ...
Setting up libsdl2-2.0-0:amd64 (2.0.10+dfsg1-1ubuntu1) ...
Setting up libsdl2-image-2.0-0:amd64 (2.0.5+dfsg1-1) ...
Setting up liblxc1 (3.0.4-0ubuntu1) ...
Setting up lxc-utils (3.0.4-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/lxc-net.service → /lib/systemd/system/lxc-net.service.
Created symlink /etc/systemd/system/multi-user.target.wants/lxc.service → /lib/systemd/system/lxc.service.
Setting up lxc dnsmasq configuration.
Setting up lxc (3.0.4-0ubuntu1) ...
Setting up liblxc-common (3.0.4-0ubuntu1) ...
Setting up anbox (0.0~git20190124-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/anbox-container-manager.service → /lib/systemd/system/anbox-container-manager.service.
Processing triggers for desktop-file-utils (0.24-1ubuntu1) ...
Processing triggers for mime-support (3.63ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for libc-bin (2.30-0ubuntu2) ...
Processing triggers for systemd (242-7ubuntu3.7) ...
Processing triggers for man-db (2.8.7-3) ...
此时我重新启动并尝试运行 Anbox,发现此错误:
max@msi:~$ anbox session-manager
[ 2020-02-19 15:01:01] [session_manager.cpp:130@operator()] Failed to start as either binder or ashmem kernel drivers are not loaded
max@msi:~$
我可以通过以下方法解决此错误:
我下载了 anbox-modules这里按下“克隆/下载”按钮:
我提取并使用终端导航到 anbox-modules-master 目录:
cd anbox-modules-master/
我运行了以下命令:
sudo cp anbox.conf /etc/modules-load.d/
sudo cp 99-anbox.rules /lib/udev/rules.d/
sudo cp -rT ashmem /usr/src/anbox-ashmem-1
sudo cp -rT binder /usr/src/anbox-binder-1
sudo dkms install anbox-ashmem/1
sudo dkms install anbox-binder/1
我在这里加载了模块:
sudo modprobe ashmem_linux
sudo modprobe binder_linux
我验证了这个命令一切正常:
lsmod | grep -e ashmem_linux -e binder_linux
输出如下所示:
binder_linux 163840 0
ashmem_linux 20480 0
我也用这个命令进行了验证:
ls -alh /dev/binder /dev/ashmem
我得到了这个输出:
ls: cannot access '/dev/binder': No such file or directory
crw------- 1 root root 10, 55 Feb 19 15:54 /dev/ashmem
现在我不知道该做什么,因为 anbox 无法启动:
max@msi:~/anbox-modules-master$ anbox session-manager
[ 2020-02-20 00:38:23] [session_manager.cpp:130@operator()] Failed to start as either binder or ashmem kernel drivers are not loaded
答案1
我已经安装并测试了边缘从 snap 中发布,它就成功了。可以使用以下命令从 snap 安装 Anbox,并从 GUI 应用程序运行:
sudo snap install --devmode --edge anbox
重要的:
请阅读并理解边缘在安装之前释放意味着。
边缘:适合想要密切跟踪开发情况的用户。
边缘版本通常包含一系列变化,没有 QA 或审核承诺,并且通常由 CI 流程从任意源代码快照自动构建。通常 CI 只会在某种自动 QA 通过后才发布,代码审核仍然是一种很好的做法,但这些都是针对特定项目的。假设边缘版本可能经常中断。