Waydroid 中没有网络:网络无法访问

Waydroid 中没有网络:网络无法访问

我已经关注了Waydroid arch-wiki 页面并已安装waydroidbinder_linux-dkmswaydroid-image-gapps

当我运行 waydroid 时,除了网络部分之外,它运行良好。

我在主机上确实有新的接口:

30: waydroid0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:00:00:02 brd ff:ff:ff:ff:ff:ff
    inet 192.168.240.1/24 brd 192.168.240.255 scope global waydroid0
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:fe00:1/64 scope link
       valid_lft forever preferred_lft forever
31: vethbrQLNw@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master waydroid0 state UP group default qlen 1000
    link/ether fe:3e:17:46:42:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::fc3e:17ff:fe47:4295/64 scope link
       valid_lft forever preferred_lft forever

但我没有正确配置网络接口waydroid shell

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
2: eth0@if31: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:f9:d3:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::fba7:3c32:8e2f:857/64 scope link stable-privacy
       valid_lft forever preferred_lft forever

因此,当我尝试 ping 时,1.1.1.1我发现一个错误:connect: Network is unreachable。而且我在 Wayland 内没有网络。

我没有安装 ufw 或 firewalld。

我试过了:

  1. 重新开始waydroid-container.service
  2. 停止nftables.service
  3. 重新开始iptables.service

PS我在journalctl中有以下内容:

окт 27 15:16:53 nous dnsmasq[139035]: started, version 2.87 cachesize 150
окт 27 15:16:53 nous dnsmasq[139035]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP con>
окт 27 15:16:53 nous dnsmasq-dhcp[139035]: DHCP, IP range 192.168.240.2 -- 192.168.240.254, lease time 1h
окт 27 15:16:53 nous dnsmasq-dhcp[139035]: DHCP, sockets bound exclusively to interface waydroid0
окт 27 15:16:53 nous dnsmasq[139035]: reading /etc/resolv.conf
окт 27 15:16:53 nous dnsmasq[139035]: using nameserver 127.0.0.1#53
окт 27 15:16:53 nous dnsmasq[139035]: read /etc/hosts - 148944 addresses

(127.0.0.1是因为我没有绑定安装)

waydroid log输出:

(138954) [15:16:45] % chmod 666 -R /dev/binder
(138954) [15:16:45] % chmod 666 -R /dev/anbox-vndbinder
(138954) [15:16:45] % chmod 666 -R /dev/anbox-hwbinder
(138954) [15:16:45] Container manager is waiting for session to load
(139008) [15:16:52] Save session config: /var/lib/waydroid/session.cfg
(139008) [15:16:52] UserMonitor service is not even started
(139008) [15:16:52] Clipboard service is not even started
(138954) [15:16:52] % /usr/lib/waydroid/data/scripts/waydroid-net.sh start
vnic is waydroid0
(138954) [15:16:53] % mount /usr/share/waydroid-extra/images/system.img /var/lib/waydroid/rootfs
(138954) [15:16:53] % mount -o remount,ro /usr/share/waydroid-extra/images/system.img /var/lib/waydroid/rootfs
(138954) [15:16:53] % mount /usr/share/waydroid-extra/images/vendor.img /var/lib/waydroid/rootfs/vendor
(138954) [15:16:53] % mount -o remount,ro /usr/share/waydroid-extra/images/vendor.img /var/lib/waydroid/rootfs/vendor
(138954) [15:16:53] % mount -o bind /var/lib/waydroid/waydroid.prop /var/lib/waydroid/rootfs/vendor/waydroid.prop
(138954) [15:16:53] Save config: /var/lib/waydroid/waydroid.cfg
(138954) [15:16:53] % mount -o bind /home/user/.local/share/waydroid/data /var/lib/waydroid/data
(138954) [15:16:53] % chmod 777 -R /dev/ashmem
(138954) [15:16:53] % chmod 777 -R /dev/dri
(138954) [15:16:53] % chmod 777 -R /dev/fb0
(138954) [15:16:53] % chmod 777 -R /dev/video3
(138954) [15:16:53] % chmod 777 -R /dev/video2
(138954) [15:16:53] % chmod 777 -R /dev/video1
(138954) [15:16:53] % chmod 777 -R /dev/video0
(138954) [15:16:53] % lxc-start -P /var/lib/waydroid/lxc -F -n waydroid -- /init
(138954) [15:16:53] New background process: pid=139115, output=background
(138954) [15:16:53] Save session config: /var/lib/waydroid/session.cfg
(139008) [15:17:02] waydroidusermonitor: Received transaction: 1
(139008) [15:17:02] Android with user 0 is ready
(146313) [15:40:48] % tail -n 60 -F /var/lib/waydroid/waydroid.log
(146313) [15:40:48] *** output passed to waydroid stdout, not to this log ***

答案1

作为一种解决方法,人们可以禁用 NFT 使用(否则网络将无法使用)。由于某种原因,默认情况下启用(而有一个犯罪并禁用它)。

如果是 Arch-linux,应该修改/usr/lib/waydroid/data/scripts/waydroid-net.sh并确保有一行:

LXC_USE_NFT=false

答案2

脚本waydroid-net.sh再次更改,因此需要更多补丁

  • 禁用nftables
  • 禁用iptables-legacyip6tables-legacy

可以使用如下命令来完成:

sudo sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' \
     /usr/lib/waydroid/data/scripts/waydroid-net.sh

您可能还需要重新启动服务

sudo systemctl restart waydroid-container.service 

在 Ubuntu 22.04 上使用 Waydroid 1.4.1 进行了测试。

相关内容