Skip to content

Wiki

Extended functions

About 7 min read

Existing English translations were reused. 1 current source blocks remain in Simplified Chinese, without triggering paid translation.

1.Wine

2.Android

2.1.Intel cards, AMD cards

  1. Wayland + Waydroid (superb experience)

Official website:

https://waydro.id/

Waydroid runs the Android system on Linux through a container. For users with Intel integrated graphics or AMD integrated graphics, together with a Wayland desktop environment, the overall experience is very good, and window display, input, and performance are all fairly natural.

On Fedora KDE Wayland, the Waydroid desktop experience will be relatively close to that of a native application.


If Waydroid shows that it is already connected to the Internet but in reality cannot get online, it is most likely not that Waydroid itself is broken, but rather that there is a problem with the host machine's network forwarding.

This problem is more common especially when Docker has been previously installed on the computer. Docker modifies the host's iptables / firewalld forwarding rules, which may cause the FORWARD default policy to become DROP. As a result, Waydroid's waydroid0 bridge traffic cannot be forwarded to the actual external network interface.

This is exactly the problem I encountered this time.


2.1.1.Phenomenon

In Waydroid, it shows that the Internet is already connected, but applications cannot access the network.

Enter Waydroid shell to test:

sudo waydroid shell

Then ping the external IP:

ping -c 3 223.5.5.5

If it displays:

3 packets transmitted, 0 received, 100% packet loss

Note that Waydroid does not actually have normal network access.

However, the host machine itself can access the network normally:

ping -c 3 223.5.5.5

If the host machine can ping successfully but ping fails inside Waydroid, this indicates the problem is not with the hotspot, not with Wi-Fi, and not with the host machine's network, but rather with Waydroid's NAT / FORWARD forwarding.


2.1.2.Troubleshoot

First, check Waydroid's virtual network bridge:

ip -4 addr show waydroid0

Normally, you will see something like:

inet 192.168.240.1/24

Then enter Waydroid:

sudo waydroid shell

Test whether the host's waydroid0 gateway can be pinged:

ping -c 3 192.168.240.1

If 192.168.240.1 can be pinged, but the public IP cannot be pinged:

ping -c 3 223.5.5.5

That means:

Waydroid 容器到宿主机是通的,
但是宿主机没有把 Waydroid 的流量转发到外网。

2.1.3.Check whether it is a Docker / firewalld forwarding issue

View the current firewalld zone:

sudo firewall-cmd --get-active-zones

If you see something like:

FedoraWorkstation (default)
  interfaces: wlp0s20f3
docker
  interfaces: docker0
trusted
  interfaces: waydroid0

Note that on the computer there is both Docker's network bridge docker0 and Waydroid's network bridge waydroid0.

Now look at the FORWARD rule:

sudo iptables --list-rules | grep FORWARD

If you see something like:

-P FORWARD DROP
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-FORWARD

Then it can basically be determined that Docker / firewalld is blocking Waydroid's forwarding.

At this point Waydroid can connect to the host machine, but it cannot reach the external network through host machine NAT.


2.1.4.Solution

First check the network interface that is actually connected:

ip route | grep default

For example, the output contains:

default via 192.168.xx.xx dev wlp0s20f3

Here, wlp0s20f3 is the network interface card that is actually connected to the external network.

Then add a persistence rule:

sudo firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i waydroid0 -o wlp0s20f3 -j ACCEPT
sudo firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i wlp0s20f3 -o waydroid0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -s 192.168.240.0/24 -o wlp0s20f3 -j MASQUERADE
sudo firewall-cmd --reload

Note: Replace wlp0s20f3 here with the actual name of the currently connected network adapter on your computer.

Then restart Waydroid:

sudo systemctl restart waydroid-container
waydroid session stop

Test after reopening Waydroid:

sudo waydroid shell
ping -c 3 223.5.5.5
ping -c 3 baidu.com

If it can be pinged, it means the Waydroid network has been fixed.


2.1.5.Summary

This problem is essentially not an issue with Clash, nor with the hotspot, but rather caused by conflicting Docker / firewalld / iptables forwarding rules.

Simply put:

Waydroid 可以连接到宿主机的 waydroid0 网桥,
但是 Docker / firewalld 导致 FORWARD 转发被 DROP,
所以 Waydroid 的流量无法 NAT 到外网网卡。

This can be resolved by adding persistent FORWARD / MASQUERADE rules for waydroid0 and the external network interface.

2.2.N card (So Nvidia Fxxk U!)

  1. QEMU-KVM虚拟机 + BlissOS-X86

    https://www.bilibili.com/video/BV1aS411P7Wh

    1. 比较推荐的配置
    qemu-system-x86_64 \
            -M q35,vmport=off \
            -accel kvm \
            -cpu qemu64,+sse3,+sse4.2 \
            -smp 8,cores=4 \
            -m 6G \
            -usb \
            -device virtio-tablet \
            -device virtio-keyboard \
            -device usb-tablet \
            -bios OVMF-pure-efi64.fd \
            -net user,hostfwd=tcp::5555-:5555,hostfwd=tcp::8022-:8022 \
            -net nic,model=virtio \
            -audio sdl,model=hda \
            -display sdl,gl=on,show-cursor=on \
            -device virtio-vga-gl,xres=1920,yres=1080 \
            -drive file=disk.qcow2,media=disk,if=virtio,cache=writeback \
            -drive file=Bliss-v16.9.7-x86_64-OFFICIAL-gapps-20240911.iso,media=cdrom \
            -monitor stdio \
            -serial none
    1. 常用操作:

      1. 全屏:Ctrl+Alt+F

      2. adb调试

        1. 使Linux与Android用ADB连接。
        
        # 连接安卓
        adb connect 127.0.0.1
        
        # 打开shell
        adb -s 127.0.0.1:5555 shell
        
        # 使用root权限
        su
      3. 中文输入法

        1. 可以下载google输入法:按Shift+space进行中英文切换(这样有效防止与linux本机的中英文切换冲突)