Waydroid template

I want to update waydroid, so I’m launching Sway on the Template Qube but it stays forever at the “SWAY” Screen… Is this expected?

To update the waydroid in the template you need to run waydroid-upgrade command in the template’s terminal:

You don’t need to run the waydroid inside the template to update it.

Sorry, must have skipped this part… But is it normal behaviour that Sway doesn’t start from Template?

Yes:

1 Like

Sadly my Internet connection is bad, tried 5 times and always stopped download and so that hash error appears… Best I could get was 300MB out of 7xxMB… Is there a trick to resume or give a greater timeout?

Download the image then use it for init:
Using custom Waydroid images | Waydroid

1 Like

Is anyone else that’s using in-VM kernel having problems with Waydroid launching?

All was working well for months, but since several weeks ago Waydroid-Sway no longer wants to work. The Sway window appears and then just remains static there, never proceeding further into launching Waydroid.

It seems it’s an issue with setting the AppVM to use the in-VM kernel (pvgrub2-pvh), since as soon as the kernel is changed to use dom0-provided kernel Waydroid launches just fine again.

I’ve also tried changing the in-VM kernel itself, from the default 6.1 to 6.10 and 6.11, but it still doesn’t resolve the issue. Only changing from in-VM kernel to dom0-provided kernel seems to do the trick.

The debug output given when using the command under Troubleshooting Point 1 in apparatus’ first post also seems the same regardless of whether in-VM kernel or dom0-provided kernel is used, despite Waydroid not wanting to launch on the former but working just fine with the latter.

Is anyone else also having this issue?

EDIT: I have also tried in-VM kernel with a fresh Waydroid template set up using the latest instructions, made sure that Waydroid was updated, and also made sure to re-initialize Waydroid after each kernel change, still no luck.

It works for me in Debian with latest updates (kernel 6.1.0-26-amd64) and latest version of Waydroid image.
Are you launching the Waydroid in the app qube and not in the template?
What’s the output of this command in the app qube’s root terminal?

systemctl status waydroid-container -n1000

Waydroid is definitely being launched from the app qube, not template. I’ve also tried without the entry blocking Waydroid-startup-within-TemplateVM in waydroid-container.service.d but the result is the same. The only thing that allows it to work without fail is switching away from in-VM kernel and back to dom0-provided kernel.

Output from the command is:

● waydroid-container.service - Waydroid Container
     Loaded: loaded (/lib/systemd/system/waydroid-container.service; enabled; p>
    Drop-In: /etc/systemd/system/waydroid-container.service.d
             └─override.conf
     Active: active (running) since Tue 2024-11-05 10:20:12 +08; 30s ago
   Main PID: 797 (waydroid)
      Tasks: 2 (limit: 3457)
     Memory: 33.9M
        CPU: 210ms
     CGroup: /system.slice/waydroid-container.service
             └─797 /usr/bin/python3 /usr/bin/waydroid -w container start

Warning: some journal files were not opened due to insufficient permissions.

I’ve just realized that my Waydroid templates have all been using Kicksecure-17 minimal (debian 12 minimal distro-morphed to kicksecure-17 without additional recommended packages) as their base, not vanilla debian-12-minimal. Having said that, Kicksecure-17 as a base was working just fine before. Maybe an updated Kicksecure component is causing the breakage. Will try with a truly vanilla debian-12-minimal template again and see if that works. Will report back shortly.

EDIT: In-VM kernel works with debian-12-minimal, as expected. So it would appear that updated kicksecure-17 prevents Waydroid-Sway from launching. Unfortunately diagnosing the problem is beyond my remit. Will be switching back to debian-12-minimal for now.

@apparatus

There is an unofficial Android 13 Build:

Tried to Upgrade working Android 11 (installed from your Guide) but it won’t boot the GUI afterwards…

Check if it works on baremetal Debian before trying it in Qubes OS.

Okay, will try that later!

Hi, has anyone had issues with persistent waydroid updates not being persistent on reboot?

I updated waydroid in the system settings. I click on reboot waydroid to apply the update. It restarts and the update is applied. However, when i restart my VM, the waydroid update is gone and i have to download it again.

anyone else?

Yes, that’s expected.

The waydroid update should be done in the template, not in the app vm, as described in the first post.

1 Like

command not found for waydroid-upgrade in template vm

It seems links to hidden (collapsed) text don’t work so I’ll just quote the relevant part on how to create waydroid-upgrade:

Also here is a bit more context why the upgrade in the app qube doesn’t work:

Everything outside of /home and /rw is stored in the template, not in the app qube. Changes made in the app qube in /home and /rw are permanent but everything else will get lost when you shut down the app qube. To make changes outside of /home and /rw permanent you have to do them in the template.

1 Like

Hi I am sometimes getting the following message when installing waydroid:

I have not found out what triggers this. In some installs the SWAY background is visible and in some installs it shows this message.

Waydroid seems to be the only option for android simulation besides “native” x86 android, because inside a Qubes-VM one can only use “containers” (Linux kernel does not have containers!), meaning namespaces and some enforcements like cgroups, selinux.

Experiments?

Academically, we could try to go w/o XEN (yes security is important, but there are some (more academic) applications where one may want to trade security against flexibility - e.g. running a hypervisor to simulate an ARM machine (e.g. genymotion) as a guest of a virtualized machine (qubes app-vm) )
Here we might want to have some light weight “containerized” aka namespaced qubes which keeps some virtualization features intact for its guests. Have a look at proxmox ve which uses kvm as hypervisor and also provides LXC containers or KVM guests.

In the future a scale able approach using KVM and namespaces, cgroups2 of linux kernel may be used.

Who wants to discuss this with me?
(I am trying to do a phd on somehow scaleable virtualization and containerization as a hobby research project.)

Hi, is there a waydroid template for qubes available, may it be bad and insecure, just to give it a try.
If someone has a (bad and buggy) waydroid template please share it using archive.org or some other means. Google drive an the like are depreciated for privacy reasons.

When using the easy mode, how am I supposed to copy and paste all of these commands in the waydroid terminal:

apt install -y ca-certificates extrepo
https_proxy=http://127.0.0.1:8082 http_proxy=http://127.0.0.1:8082 extrepo enable waydroid
apt update
apt install -y sway qubes-core-agent-networking waydroid pipewire-qubes curl unzip build-essential libx11-dev libxtst-dev xclip wl-clipboard pip python3-venv x11-utils thunar qubes-core-agent-thunar
mkdir -p /etc/systemd/system/waydroid-container.service.d
cat << 'EOF' | tee /etc/systemd/system/waydroid-container.service.d/override.conf >/dev/null
[Unit]
ConditionPathExists=!/run/qubes/this-is-templatevm
EOF
curl --proxy http://127.0.0.1:8082/ --tlsv1.2 --proto =https --max-time 180 https://codeload.github.com/cdown/clipnotify/zip/refs/heads/master -o clipnotify-master.zip
unzip -j clipnotify-master.zip -d clipnotify
cd clipnotify
mkdir -p /opt/bin
sed -i "s|/usr/local|/opt|g" Makefile
make
make install
echo 'export PATH="/opt/bin:$PATH"' >> /etc/profile.d/opt-bin.sh
echo "exec /opt/bin/x11-wl-clip.sh" > /etc/sway/config.d/99-x11-wl-clip.conf
mkdir -p /opt/bin
cat << 'EOF' | tee /opt/bin/x11-wl-clip.sh >/dev/null
#!/bin/bash
x11_wl='while DISPLAY=":0" clipnotify -s clipboard; do xclip -d ":0" -selection clipboard -o | wl-copy; done'
wl_x11='wl-paste -nw xclip -d ":0" -selection clipboard'
eval "${x11_wl}" &>/dev/null &
eval "${wl_x11}" &>/dev/null
pstree -A -p $ | grep -Eow "[0-9]+" | xargs kill &>/dev/null
EOF
chmod +x /opt/bin/x11-wl-clip.sh
python3 -m venv /opt/venv/pyclip
source /opt/venv/pyclip/bin/activate
pip install --proxy http://127.0.0.1:8082 pyclip
deactivate
echo 'export PATH="$PATH:/opt/venv/pyclip/bin"' >> /etc/profile.d/python-venv.sh
echo 'export PYTHONPATH="$PYTHONPATH:/opt/venv/pyclip/lib/python3.11/site-packages"' >> /etc/profile.d/python-venv.sh
cat << 'EOF' | tee /etc/systemd/system/waydroid-firewall.service >/dev/null
[Unit]
ConditionPathExists=!/run/qubes/this-is-templatevm
PartOf=waydroid-container.service
After=waydroid-container.service
BindsTo=waydroid-container.service
Requires=qubes-iptables.service
After=qubes-iptables.service
BindsTo=qubes-iptables.service
[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c "if (nft create chain ip qubes waydroid-input) &>/dev/null; then nft add rule ip qubes custom-input jump waydroid-input; fi"
ExecStart=/usr/bin/bash -c "if (nft create chain ip qubes waydroid-forward) &>/dev/null; then nft add rule ip qubes custom-forward jump waydroid-forward; fi"
ExecStart=/usr/sbin/nft add rule ip qubes waydroid-input iifname "waydroid0" meta l4proto {tcp, udp} th dport { 53, 67 } accept
ExecStart=/usr/sbin/nft add rule ip qubes waydroid-forward iifname "waydroid0" oifgroup 1 accept
ExecStart=/usr/sbin/nft add rule ip qubes waydroid-forward oifname "waydroid0" iifgroup 1 accept
ExecStop=/usr/sbin/nft flush chain ip qubes waydroid-input
ExecStop=/usr/sbin/nft flush chain ip qubes waydroid-forward
RemainAfterExit=yes
[Install]
WantedBy=waydroid-container.service
EOF
systemctl daemon-reload
systemctl enable waydroid-firewall.service
echo "default_border none" > /etc/sway/config.d/94-disable-window-titlebar.conf
perl -0777 -i -pe 's/(^\h*bar\s*|\v\h*bar\s*)(\{(?:(?>[^{}]+)|(?-1))*\})//g' /etc/sway/config
cat << 'EOF' | tee /opt/bin/sway-waydroid.sh >/dev/null
#!/bin/bash
sway &>/dev/null &
WAYLAND_DISPLAY="wayland-1" XDG_SESSION_TYPE="wayland" DISPLAY=":1" waydroid first-launch &>/dev/null &
for i in $(seq 1 3);
do
    if xwininfo -name "wlroots - X11-1" &>/dev/null; then
        break
    fi
    sleep 1
done
while xwininfo -name "wlroots - X11-1" &>/dev/null; do
    sleep 2
done
WAYLAND_DISPLAY="wayland-1" XDG_SESSION_TYPE="wayland" DISPLAY=":1" waydroid session stop &>/dev/null
pstree -A -p $ | grep -Eow "[0-9]+" | xargs kill &>/dev/null
EOF
chmod +x /opt/bin/sway-waydroid.sh
cat << 'EOF' | tee /usr/share/applications/Waydroid-Sway.desktop >/dev/null
[Desktop Entry]
Type=Application
Name=Waydroid-Sway
Exec=/opt/bin/sway-waydroid.sh
Icon=waydroid
Categories=X-WayDroid-App;
X-Purism-FormFactor=Workstation;Mobile;
EOF
cat << 'EOF' | tee /opt/bin/waydroid-install-apk >/dev/null
#!/bin/sh
WAYLAND_DISPLAY="wayland-1" XDG_SESSION_TYPE="wayland" DISPLAY=":1" waydroid app install $1
EOF
chmod +x /opt/bin/waydroid-install-apk
cat << 'EOF' | tee /opt/bin/waydroid-upgrade >/dev/null
#!/bin/sh
https_proxy=http://127.0.0.1:8082 http_proxy=http://127.0.0.1:8082 waydroid upgrade
EOF
chmod +x /opt/bin/waydroid-upgrade

the copying and pasting using the global clipboard doesn’t work, and I can’t copy and paste anything directly from the waydroid terminal itself. Surely the author doesn’t expect me to manually type each line of the above into the terminal?

None of the above instructions that other posters have made seem to work.