Jami Kettunen [Mon, 16 Jan 2023 13:08:45 +0000 (15:08 +0200)]
net: Don't fail start when already running
After 85843da (container: Make "waydroid-net.sh start" failure fatal)
this could result always failing to start unless you ran
"waydroid-net.sh stop" manually first; perhaps this should always be
stopped upon encountering errors?
Jami Kettunen [Sun, 15 Jan 2023 19:05:09 +0000 (21:05 +0200)]
container: Make "waydroid-net.sh start" failure fatal
Failing the network setup will in 99% of all cases cause the lxc-start
to fail due to the waydroid0 bridge not existing, so we might as well
fail fast instead of polluting the "waydroid log" and doing a futile
attempt at booting the LXC container.
Jami Kettunen [Tue, 3 Jan 2023 23:54:29 +0000 (01:54 +0200)]
lxc: Only add /dev/ashmem to config_nodes when it exists
This hasn't existed in mainline Linux kernels since v5.18 and trying to
always mount it regardless just adds to the noise in "waydroid log" in
most cases, so simply don't add it to config_nodes unless it actually
exists.
Silences the following:
lxc-start: waydroid: ../src/lxc/utils.c: safe_mount: 1221 No such file or directory - Failed to mount "/dev/ashmem" onto "/usr/lib/lxc/rootfs/dev/ashmem"
Enough with not checking we actually have a Wayland compositor around at
all: start requiring the WAYLAND_DISPLAY socket actually exists as an
absolute path or relatively under XDG_RUNTIME_DIR.
Additionally if WAYLAND_DISPLAY isn't an absolute path to the socket
(most setups) ensure XDG_RUNTIME_DIR is set and error with a typically
appropriate message.
This allows the user to make modifications to the images that may persist
between image upgrades.
For both the system and vendor image there's a set of two overlays.
One, specified in config as "overlay", is a read-only persistent overlay
meant for stuff like installing privileged apps that should persist.
Second one, specified as "overlay-rw", is a read-write overlay that
stores the changes made by the user in case they remount the mount point
in read-write mode. This one is meant to be removed when performing
image upgrade to not carry on potentially incompatible changes between
images.
We were implicitly using proc:mixed to mount /proc/sys as read-only.
Without the automount the whole /proc was mounted as read-write which
we want to avoid.
I'm unable to replicate the proc:mixed logic with lxc.mount.entry
so revert this change until a solution is found.
Jami Kettunen [Tue, 13 Dec 2022 19:29:40 +0000 (21:29 +0200)]
session: warn about unset WAYLAND_DISPLAY instead of XDG_SESSION_TYPE
XDG_SESSION_TYPE isn't a reliable check for Wayland being present (e.g.
on Ubuntu Touch currently XDG_SESSION_TYPE is "mir" with WAYLAND_DISPLAY
set to "wayland-0" as it also provides Wayland windowing.
Also mention the behavior of defaulting WAYLAND_DISPLAY to "wayland-0"
in case it's not set.
Jami Kettunen [Wed, 7 Dec 2022 20:40:42 +0000 (22:40 +0200)]
net: Fix vnic name selection for LXC <=2
The "default to waydroid0" was broken as awk never returned a non-zero
exit code if the file exists but no match was found. Also account for
the key being named lxc.network.link on older LXC versions so one still
has the ability to have a flexible Waydroid network configuration.
hardware-manager: Optionally stop the session on suspend
This allows to use persist.waydroid.suspend as a way to automatically
stop the session after an inactivity timeout, as opposed to merely
freezing the container. Freeze still remains the default action.
app_manager: Don't rmdir /data/waydroid_tmp after install
Only user 1000 can create directories in /data, so this directory should
be created by android init.rc giving the host write permissions.
Don't remove it after installing so that it can be reused for a subsequent
installation.
When restarting the lxc container our binder services will receive a
binder_presence event and will try to re-register on the service manager.
If the service manager was created with aidl2 and the new android version
uses aidl3 this will fail with:
Failed to add service waydroidusermonitor: -2147483647
When that happens, try to restart the service by getting a new service
manager that can handle the new aidl protocol version.
Jami Kettunen [Sun, 10 Jul 2022 12:39:08 +0000 (15:39 +0300)]
container: Only umount /sys/fs/cgroup/schedtune if needed
Silences the following useless log from "waydroid log" outputs when the
directory either doesn't exist at all (mainline Linux devices), or when
it's not mounted on Halium:
(027693) [15:21:39] % umount -l /sys/fs/cgroup/schedtune
umount: /sys/fs/cgroup/schedtune: not mounted