From d2ebb7709eac8e75bfe60af86bc1a5992194e253 Mon Sep 17 00:00:00 2001 From: xXJsonDeruloXx Date: Fri, 25 Sep 2026 00:48:03 -0400 Subject: [PATCH] Set PRoot guest hostname to DroidDeck --- .../com/droiddeck/launcher/runtime/LinuxRuntime.java | 11 +++++++++++ .../com/droiddeck/launcher/session/SessionService.kt | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java index b0d9adb89..816d7c3ad 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java +++ b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java @@ -5,6 +5,7 @@ import android.os.Process; import android.system.ErrnoException; import android.system.Os; import android.system.StructStat; +import android.system.StructUtsname; import java.io.File; @@ -32,6 +33,7 @@ public final class LinuxRuntime { /** Shortcut extra naming which of the modes above a Linux entry launches. */ public static final String EXTRA_LINUX_MODE = "linux_mode"; private static final String KGSL_DEVICE = "/dev/kgsl-3d0"; + private static final String GUEST_HOSTNAME = "DroidDeck"; /** Where every Linux session's debug log lands: public, so a user can just hand the folder over. */ public static final String DEBUG_LOG_DIR = "DroidDeck"; @@ -116,6 +118,8 @@ public final class LinuxRuntime { List cmd = new ArrayList<>(); cmd.add(prootBinary(context).getPath()); cmd.add("--kill-on-exit"); + // Preserve the host kernel identity while giving the guest the app's branded host name. + cmd.add("--kernel-release=" + guestUtsname()); // Android's app seccomp policy traps the whole set*id family. Xwayland's Popen() calls // setgid()/setuid() before it execs xkbcomp and _exit(127)s when they fail, so without // this the keymap never compiles and Xwayland dies. -i makes proot answer those calls @@ -245,6 +249,13 @@ public final class LinuxRuntime { cmd.add(spec); } + /** PRoot's complex -k format: sysname, nodename, release, version, machine, domain, HWCAP. */ + private static String guestUtsname() { + StructUtsname host = Os.uname(); + return "\\" + host.sysname + "\\" + GUEST_HOSTNAME + "\\" + host.release + + "\\" + host.version + "\\" + host.machine + "\\localdomain\\-1\\"; + } + /** X access control and Steam look the session user up by uid: the app uid is root inside. */ public static void writeAccounts(Context context) throws IOException { File root = rootDir(context); diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 9357991ea..11b87b05b 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -601,7 +601,9 @@ class SessionService : Service() { components.add(networkLink) components.forEach { it.start() } - val line = command.joinToString(" ") { it.replace(" ", "\\ ") } + val line = command.joinToString(" ") { + it.replace("\\", "\\\\").replace(" ", "\\ ") + } watchLaunchRequests(sessionRoot) // One session replacing another (the desktop's Steam launchers): the old proot is killed // by the teardown a second after the new one has started, and its exit used to arrive