{"record":{"id":"07f025265f69e247","repo":"kovidgoyal/kitty","slug":"could-not-move-child-process-into-a-systemd-scope","errorCode":null,"errorMessage":"Could not move child process into a systemd scope: ","messagePattern":"Could not move child process into a systemd scope: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/child.py","lineNumber":530,"sourceCode":"        )\n        os.close(slave)\n        self.pid = pid\n        self.child_fd = master\n        if stdin is not None:\n            os.close(stdin_read_fd)\n            fast_data_types.thread_write(stdin_write_fd, stdin)\n        os.close(ready_read_fd)\n        self.terminal_ready_fd = ready_write_fd\n        if self.child_fd is not None:\n            os.set_blocking(self.child_fd, False)\n        if not is_macos:\n            ppid = getpid()\n            try:\n                fast_data_types.systemd_move_pid_into_new_scope(pid, f'kitty-{ppid}-{self.id}.scope', f'kitty child process: {pid} launched by: {ppid}')\n            except NotImplementedError:\n                pass\n            except OSError as err:\n                log_error('Could not move child process into a systemd scope: ' + str(err))\n        return pid\n\n    def __del__(self) -> None:\n        fd = getattr(self, 'terminal_ready_fd', -1)\n        if fd > -1:\n            os.close(fd)\n        self.terminal_ready_fd = -1\n\n    def mark_terminal_ready(self) -> None:\n        os.close(self.terminal_ready_fd)\n        self.terminal_ready_fd = -1\n\n    def cmdline_of_pid(self, pid: int) -> list[str]:\n        try:\n            ans = cmdline_of_pid(pid)\n        except Exception:\n            ans = []\n        if pid == self.pid and (not ans):","sourceCodeStart":512,"sourceCodeEnd":548,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/child.py#L512-L548","documentation":"kitty tries to place each spawned child into its own systemd scope (so systemd doesn't kill or misattribute it); if the D-Bus/systemd call fails with OSError it logs this and continues normally.","triggerScenarios":"`systemd_move_pid_into_new_scope` fails: no systemd user session, older systemd without the API, cgroup filesystem read-only (containers), or dbus-broker mismatch. NotImplementedError is silently ignored; only OSError is logged.","commonSituations":"Running kitty inside Docker/other containers, on non-systemd init systems, or over odd session setups where the user manager is unavailable.","solutions":["Ignore — cosmetic; the child still runs, just outside its own scope","Ensure a proper systemd user session (loginctl show-user $USER)","In containers, no action is possible/needed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import subprocess\nhas_systemd = subprocess.run(['systemctl','--user','is-system-running'], capture_output=True).returncode == 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Accept the warning in containers/non-systemd environments","Run kitty in a proper systemd user session to get per-child scopes"],"tags":["kitty","systemd","cgroup","child-process","containers"],"backgroundTag":"systemd-scope-creation-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}