From e76396acad4d74a8120b9f9323338620d2340b29 Mon Sep 17 00:00:00 2001 From: Santiago Osorio Date: Thu, 14 May 2026 00:52:35 -0500 Subject: [PATCH] feat(iso): add Gamescope session and systemd user units MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Creates the complete systemd unit set for the MinecrarchOS session layer. These units define the boot flow: autologin → gamescope-session → minecrarch-shell → services iso/airootfs/etc/systemd/user/: - gamescope-session.service: launches Gamescope --fullscreen with minecrarch-shell as child; RestartSec=3s, StartLimitBurst=3 to prevent boot loops on repeated Gamescope failures - minecrarch-shell.service: Requires=modpack-manager, starts after logging + modpack-manager are on D-Bus - minecrarch-modpack-manager.service: Type=dbus with BusName so systemd knows the service is ready when it registers on the bus - minecrarch-logging.service: starts first (no After= other than dbus) - minecrarch-overlay.service: non-critical, After=logging - minecrarch-updater.service: non-critical, After=logging, RestartSec=5s - default.target.wants/gamescope-session.service: symlink for autostart iso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf: - autologin for 'minecrarch' user; double ExecStart= pattern clears the default before setting the autologin variant (systemd override convention) Service startup order per docs/session-model.md: logging → [modpack-manager, overlay, updater] in parallel → shell ADR-0005 (Gamescope), ADR-0006 (no DE), ADR-0009 (shell orchestration) --- .../getty@tty1.service.d/autologin.conf | 6 +++++ .../gamescope-session.service | 1 + .../systemd/user/gamescope-session.service | 25 +++++++++++++++++++ .../systemd/user/minecrarch-logging.service | 19 ++++++++++++++ .../user/minecrarch-modpack-manager.service | 23 +++++++++++++++++ .../systemd/user/minecrarch-overlay.service | 19 ++++++++++++++ .../etc/systemd/user/minecrarch-shell.service | 21 ++++++++++++++++ .../systemd/user/minecrarch-updater.service | 19 ++++++++++++++ 8 files changed, 133 insertions(+) create mode 100644 iso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf create mode 120000 iso/airootfs/etc/systemd/user/default.target.wants/gamescope-session.service create mode 100644 iso/airootfs/etc/systemd/user/gamescope-session.service create mode 100644 iso/airootfs/etc/systemd/user/minecrarch-logging.service create mode 100644 iso/airootfs/etc/systemd/user/minecrarch-modpack-manager.service create mode 100644 iso/airootfs/etc/systemd/user/minecrarch-overlay.service create mode 100644 iso/airootfs/etc/systemd/user/minecrarch-shell.service create mode 100644 iso/airootfs/etc/systemd/user/minecrarch-updater.service diff --git a/iso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf b/iso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf new file mode 100644 index 0000000..143e98e --- /dev/null +++ b/iso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf @@ -0,0 +1,6 @@ +[Service] +# Override getty to autologin the minecrarch user without password. +# This is intentional for an appliance-style system (ADR-0006: no desktop, +# no login screen — boot goes directly to Gamescope session). +ExecStart= +ExecStart=-/sbin/agetty --autologin minecrarch --noclear %I $TERM diff --git a/iso/airootfs/etc/systemd/user/default.target.wants/gamescope-session.service b/iso/airootfs/etc/systemd/user/default.target.wants/gamescope-session.service new file mode 120000 index 0000000..4b7fa72 --- /dev/null +++ b/iso/airootfs/etc/systemd/user/default.target.wants/gamescope-session.service @@ -0,0 +1 @@ +../gamescope-session.service \ No newline at end of file diff --git a/iso/airootfs/etc/systemd/user/gamescope-session.service b/iso/airootfs/etc/systemd/user/gamescope-session.service new file mode 100644 index 0000000..f920a74 --- /dev/null +++ b/iso/airootfs/etc/systemd/user/gamescope-session.service @@ -0,0 +1,25 @@ +[Unit] +Description=Gamescope Session (Minecrarch) +Documentation=https://github.com/ValveSoftware/gamescope +After=dbus.service +Wants=dbus.service + +[Service] +Type=simple +# Gamescope runs the shell as a nested Wayland compositor. +# --fullscreen: take ownership of the display +# --xwayland-count 1: spawn one XWayland instance for compatibility +# --: separator; everything after is the child process (the shell) +ExecStart=gamescope \ + --fullscreen \ + --xwayland-count 1 \ + -- \ + /usr/bin/minecrarch-shell +Restart=on-failure +RestartSec=3s +# If Gamescope crashes repeatedly, stop trying (prevents boot loop) +StartLimitBurst=3 +StartLimitIntervalSec=60 + +[Install] +WantedBy=default.target diff --git a/iso/airootfs/etc/systemd/user/minecrarch-logging.service b/iso/airootfs/etc/systemd/user/minecrarch-logging.service new file mode 100644 index 0000000..9bc540a --- /dev/null +++ b/iso/airootfs/etc/systemd/user/minecrarch-logging.service @@ -0,0 +1,19 @@ +[Unit] +Description=Minecrarch Logging Service +Documentation=https://github.com/Count-I/MinecrarchOS +After=dbus.service +Requires=dbus.service + +[Service] +Type=dbus +BusName=org.minecrarch.Logging +ExecStart=/usr/bin/minecrarch-logging +Restart=on-failure +RestartSec=2s +StandardOutput=journal +StandardError=journal +SyslogIdentifier=minecrarch-logging +Environment=MINECRARCH_COMPONENT=logging + +[Install] +WantedBy=default.target diff --git a/iso/airootfs/etc/systemd/user/minecrarch-modpack-manager.service b/iso/airootfs/etc/systemd/user/minecrarch-modpack-manager.service new file mode 100644 index 0000000..71fbab9 --- /dev/null +++ b/iso/airootfs/etc/systemd/user/minecrarch-modpack-manager.service @@ -0,0 +1,23 @@ +[Unit] +Description=Minecrarch Modpack Manager +Documentation=https://github.com/Count-I/MinecrarchOS +After=minecrarch-logging.service +Requires=dbus.service +After=dbus.service + +[Service] +Type=dbus +BusName=org.minecrarch.ModpackManager +ExecStart=/usr/bin/minecrarch-modpack-manager +Restart=on-failure +RestartSec=2s +# Maximum 5 restarts in 60s before giving up +StartLimitBurst=5 +StartLimitIntervalSec=60 +StandardOutput=journal +StandardError=journal +SyslogIdentifier=minecrarch-modpack-manager +Environment=MINECRARCH_COMPONENT=modpack-manager + +[Install] +WantedBy=default.target diff --git a/iso/airootfs/etc/systemd/user/minecrarch-overlay.service b/iso/airootfs/etc/systemd/user/minecrarch-overlay.service new file mode 100644 index 0000000..470493b --- /dev/null +++ b/iso/airootfs/etc/systemd/user/minecrarch-overlay.service @@ -0,0 +1,19 @@ +[Unit] +Description=Minecrarch Overlay Service +Documentation=https://github.com/Count-I/MinecrarchOS +After=dbus.service minecrarch-logging.service +Requires=dbus.service + +[Service] +Type=dbus +BusName=org.minecrarch.Overlay +ExecStart=/usr/bin/minecrarch-overlay +Restart=on-failure +RestartSec=2s +StandardOutput=journal +StandardError=journal +SyslogIdentifier=minecrarch-overlay +Environment=MINECRARCH_COMPONENT=overlay + +[Install] +WantedBy=default.target diff --git a/iso/airootfs/etc/systemd/user/minecrarch-shell.service b/iso/airootfs/etc/systemd/user/minecrarch-shell.service new file mode 100644 index 0000000..1ab7caa --- /dev/null +++ b/iso/airootfs/etc/systemd/user/minecrarch-shell.service @@ -0,0 +1,21 @@ +[Unit] +Description=Minecrarch Shell +Documentation=https://github.com/Count-I/MinecrarchOS +# Shell starts after critical services are registered on D-Bus +After=minecrarch-logging.service minecrarch-modpack-manager.service +Requires=minecrarch-modpack-manager.service +# Shell is managed by Gamescope — not installed directly +# (gamescope-session.service launches the shell as its child process) + +[Service] +Type=simple +ExecStart=/usr/bin/minecrarch-shell +Restart=on-failure +RestartSec=2s +StandardOutput=journal +StandardError=journal +SyslogIdentifier=minecrarch-shell +Environment=MINECRARCH_COMPONENT=shell + +[Install] +WantedBy=default.target diff --git a/iso/airootfs/etc/systemd/user/minecrarch-updater.service b/iso/airootfs/etc/systemd/user/minecrarch-updater.service new file mode 100644 index 0000000..44918f0 --- /dev/null +++ b/iso/airootfs/etc/systemd/user/minecrarch-updater.service @@ -0,0 +1,19 @@ +[Unit] +Description=Minecrarch Update Orchestrator +Documentation=https://github.com/Count-I/MinecrarchOS +After=dbus.service minecrarch-logging.service +Requires=dbus.service + +[Service] +Type=dbus +BusName=org.minecrarch.Updater +ExecStart=/usr/bin/minecrarch-updater +Restart=on-failure +RestartSec=5s +StandardOutput=journal +StandardError=journal +SyslogIdentifier=minecrarch-updater +Environment=MINECRARCH_COMPONENT=updater + +[Install] +WantedBy=default.target