[BUG]: Uninstall leaves orphan rootfs when NixOS `/var/empty` has the immutable flag
Kernel Version
6.6.144-4k (LineageOS/robotnix build; Droidspaces GKI kABI patch applied; KernelSU Next and CFS_BANDWIDTH/CGROUP_PIDS enabled with all kernel modules rebuilt from the same tree)
Kernel Source Link (REQUIRED)
https://github.com/LineageOS/android_kernel_oneplus_sm8750 (Base tree; the build uses robotnix/Nix patches and the Neveark sm8750 modules tree.)
Droidspaces Version
7.2.0 (APK versionCode 72001606)
Rooting Method
KernelSU Next v3.4.2 (built-in, GK12)
Device OEM & Model
OnePlus 13T (PKX110 / pagani / OP60F5L1)
Android Version & ROM
LineageOS 23.2 (Android 16), build 2026110816, user / release-keys
Execution Mode
DAEMON
Networking Mode
NAT
Describe the Bug
Uninstalling a stopped NixOS container fails. The app deletes container.config first, then runs rm -rf on the container directory; the rootfs contains a NixOS /var/empty directory with the immutable flag, so rm/rmdir fails and the rootfs is left behind as an orphan.
Observed result:
- The container disappears from the Droidspaces container list.
container.configis gone.rootfs/var/emptyremains.- The app reports the uninstall as failed.
- No process, mount, or open file descriptor is holding the container; the failure is the immutable inode flag.
Evidence:
$ lsattr /data/local/Droidspaces/Containers/<container>/rootfs/var/empty
----i----E-I-----N-- /data/local/Droidspaces/Containers/<container>/rootfs/var/empty
$ rmdir /data/local/Droidspaces/Containers/<container>/rootfs/var/empty
rmdir: .../rootfs/var/empty: Operation not permitted
The leftover rootfs after the failed uninstall:
$ ls -la /data/local/Droidspaces/Containers/<container>
total 9
drwxr-xr-x 3 root root 3452 .
drwxr-xr-x 4 root root 3452 ..
drwxr-xr-x 3 root root 3452 rootfs
$ find /data/local/Droidspaces/Containers/<container>/rootfs
.../rootfs
.../rootfs/var
.../rootfs/var/empty
$ du -sh /data/local/Droidspaces/Containers/<container>/rootfs
11K
container.config was already removed, so the orphan directory cannot be managed by the app anymore.
Manual cleanup works only after clearing the immutable flag:
chattr -i /data/local/Droidspaces/Containers/<container>/rootfs/var/empty
rm -rf /data/local/Droidspaces/Containers/<container>
The NixOS tarball was built from the upstream flake with --override-input nixpkgs github:NixOS/nixpkgs/nixos-unstable and installed as a Directory rootfs (no sparse image). The container was stopped before uninstalling. The uninstall path is mode-independent; DAEMON was used, and the same filesystem operation is performed after the container is stopped.
Steps to Reproduce
-
Install a NixOS rootfs tarball in Droidspaces using Directory storage.
- The tarball is the NixOS LXC image from
system.build.tarball(NixOS 26.11 / nixos-unstable).
- The tarball is the NixOS LXC image from
-
Start the container, then stop it.
-
Long-press the container → Uninstall Container → type the name to confirm.
-
The app reports failure and the container disappears from the list.
-
Inspect the leftover directory:
ls -la /data/local/Droidspaces/Containers/<container> lsattr /data/local/Droidspaces/Containers/<container>/rootfs/var/empty -
Confirm there is no mount/process/open fd holding it:
mount | grep -F /data/local/Droidspaces/Containers/<container> ps -A | grep -E 'systemd|nixos|<container>'Both are empty.
Logs / Screenshots
App/daemon log around the uninstall:
I/ContainerLogger: Container path: /data/local/Droidspaces/Containers/<container>
I/ContainerLogger: Executing: rm -rf '/data/local/Droidspaces/Containers/<container>' 2>&1
The daemon's droidspacesd.log shows the same rm -rf command but no specific error; the filesystem evidence identifies the cause:
lsattr: ----i----E-I-----N-- .../rootfs/var/empty
rmdir: Operation not permitted
Container state after failure:
Containers/<container>/rootfs/var/empty (immutable, 11K total leftover)
No container.config
No mount
No process
Suggested fix: before removing the container directory, clear immutable flags recursively:
chattr -R -i /data/local/Droidspaces/Containers/<container> 2>/dev/null || true
rm -rf /data/local/Droidspaces/Containers/<container>
or remove the rootfs before deleting container.config, so a failed removal can be retried from the app.
Required Acknowledgments
- [x] I have verified this is not a duplicate issue.
- [x] I am using a kernel compiled strictly according to Droidspaces' official documentation.
- [x] I am NOT using a kernel with 69+ random configs, CRC nukes, or a broken ABI.
- [x] I have confirmed this issue persists in both Daemon and Direct modes.
- [ ] I admit that I am a clown for checking this box, confirming I have NOT read these rules.
- [ ] I admit I did zero research, didn't ask my AI waifu for a fix, and am dropping this here because I'm 100% sure the fault lies with Droidspaces.
That's a known issue with NixOS when you use it via directory based mode. Use NixOS via sparse image mode or don't use NixOS at all. Some things come with trade-off's.
Thanks for replying. But is it possible to chattr before removing the directory? I mean, this can also happen if a user runs something that does similar. And generally speaking this is one of the few things that can block a rm -rf. Thanks.
Maybe you can try it manually first??