OOM issue even with swap ram added

You might be interested in https://fly.io/terminal (announcement); not sure how well it works on mobile though.

[Edit: see simpler approach below] Another idea is to deploy an app running a full SSH server, and connect to it from your Ubuntu proot using the native SSH client; that way you get to use Termux, and you can use volumes for persistent storage. Unfortunately, non-HTTP apps require a dedicated IPv4 address or IPv6, and dedicated IPv4 addresses will cost $2/month. If this is an issue, you can tunnel TCP over HTTP; this will involve running a small script on both the client and the app. Let me know if you want details!

Edit: @lubien suggested a simpler approach: Install a native WireGuard app instead of using flyctl’s userspace WireGuard implementation (which doesn’t seem to work with Ubuntu on Android). Once you create a WireGuard tunnel, you’ll be able to connect using fly ssh issue --agent and ssh root@<app>.internal.