# Installing the EAC setup (runbook for agents) This runbook installs everything in this repository on the author's desktop, "lucifer". It is written for that machine; the values below are its values. For systemd systems see [the last section](#systemd-systems). **On any other machine:** the table below is an example. Before running anything, fill in each value for the machine at hand (ask the user for what cannot be read off the system), and check the limitations in [README.md](README.md#requirements-and-limitations): stop if one applies. Every `lucifer`-specific remark ("On lucifer ...") is only valid there. Read [README.md](README.md) first. When a step fails, look the message up in [docs/troubleshooting.md](docs/troubleshooting.md). ## Values for this machine | Item | Value | | --- | --- | | Host | `lucifer`, reached as `ssh -o BatchMode=yes fabian@192.168.2.169` | | Root | `doas -n` (no sudo) | | System | Gentoo, OpenRC, elogind, polkit, Hyprland 0.57 with Lua config in `~/.config/hypr/` | | User | `fabian`, uid 1000 | | Overlay | `febuild` at `/var/db/repos/febuild` (canonical, root-owned git); `overlay/` here is a snapshot | | ESP | `/efi` (vfat) | | Secure Boot keys | sbctl, keys in `/var/lib/sbctl/keys/`, PK/KEK/db enrolled | | Normal kernel | `sys-kernel/cachyos-kernel`, EFI stub in `/efi/EFI/Gentoo/`, signed with the sbctl db key by `USE=secureboot` | | EAC firmware entry | `Boot0201`, label `CachyOS EAC` | | iGPU | PCI `0000:00:02.0`: `xe` on the normal kernel, `i915` on the EAC kernel | | Windows | second disk, BitLocker | | This repository | `~/coding/misc/eac-gentoo-openrc` on lucifer; commands with `tools/` or `host/` paths run from there | ## Rules - Run read-only checks before each phase and show the user what will change. The user decides whether you run `emerge` or they do. - Never re-sign, strip or `sbctl sign` anything from CachyOS. Never use `sbctl enroll-keys --append`. - Never change firmware settings or write PK/KEK. Only the user toggles Secure Boot, in the firmware setup. - Never type a password. The polkit dialog on the first game launch is for the user. - Write probe scripts to a file and run them with `ssh ... bash -s < probe.sh > out.txt`; read `out.txt` afterwards. - Stop at an unexpected result and report it. Do not work around a failed check. Steps marked **(user)** need the person at the machine. ## 0. Preflight (read-only) ```sh cat /sys/class/tpm/tpm0/tpm_version_major # 2 ls /sys/kernel/iommu_groups | wc -l # > 0 doas -n sbctl status # Installed, Setup Mode disabled rc-service elogind status; pgrep -x polkitd df -h /efi # >= 200 MB free efibootmgr # note BootOrder and Boot0201 emerge -p sys-kernel/cachyos-eac-kernel-bin sys-apps/eac-openrc-compat \ games-util/epic-games-launcher-bin sys-auth/hyprpolkitagent ``` `emerge -p` must resolve the three packages from `febuild`. If `febuild` lacks them, add `overlay/` from this repository as a repository in `/etc/portage/repos.conf/eac-gentoo-openrc.conf` (`location` = absolute path of `overlay/`). Missing keywords: `~amd64` in `package.accept_keywords`. ## 1. Packages ```sh doas -n install -m644 host/portage/package.use/intel-microcode /etc/portage/package.use/ doas -n emerge sys-firmware/intel-microcode sys-kernel/cachyos-eac-kernel-bin \ sys-apps/eac-openrc-compat games-util/epic-games-launcher-bin sys-auth/hyprpolkitagent ``` The launcher package replaces a downloaded AppImage; delete `~/Downloads/EpicGamesLauncher-x86_64.AppImage` once the package works. Both use the same data directory (`~/.local/share/com.epicgames.eglv2`), so logins and installed games stay. On lucifer the USE flag already sits in `/etc/portage/package.use/sys-fimware`; skip the copy there. `intel-microcode` with `dist-kernel` reinstalls the normal kernel, which is harmless. Check: ```sh ls /lib/modules/*-cachyos-eac/vmlinuz /usr/lib/cachyos-eac/systemd-bootx64.efi.signed eac-boot esp; eac-boot kernel-dir; eac-boot loader # /efi, /efi//linux-cachyos-eac, /efi/EFI/cachyos-eac/... qfile /usr/bin/systemctl /usr/bin/systemd-run /usr/bin/eac-run /usr/lib64/libsystemd.so.0 ldd /opt/epic-games-launcher/bin/EpicGamesLauncher | grep 'not found' # empty ldd /usr/libexec/hyprpolkitagent | grep 'not found' # empty ``` lucifer uses every `eac-boot` default, so it has no `/etc/eac-boot.conf`; do not create one. Libraries reported "not found" for hyprpolkitagent mean a live (`9999`) Hyprland library changed its SONAME: rebuild the packages that link the old one (`emerge -1`), see troubleshooting. ## 2. Secure Boot db Back up first, then check that the enrolled KEK is sbctl's, so the db can be written without Setup Mode: ```sh V=/sys/firmware/efi/efivars; B=/root/secureboot-backup-$(date +%Y%m%d) doas -n mkdir -p $B for n in PK-8be4df61-93ca-11d2-aa0d-00e098032b8c KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c \ db-d719b2cb-3d3a-4596-a3bc-dad00e67656f dbx-d719b2cb-3d3a-4596-a3bc-dad00e67656f; do doas -n sh -c "cat $V/$n > $B/$n" # cp fails on efivarfs done doas -n openssl x509 -in /var/lib/sbctl/keys/KEK/KEK.pem -outform DER | sha256sum | cut -c1-12 doas -n python3 tools/efi-sig-list.py $V/KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c ``` The KEK fingerprint must appear in the script's list (`eac-boot enroll` checks this as well and refuses otherwise). List db before and after: ```sh doas -n python3 tools/efi-sig-list.py $V/db-d719b2cb-3d3a-4596-a3bc-dad00e67656f doas -n eac-boot enroll doas -n python3 tools/efi-sig-list.py $V/db-d719b2cb-3d3a-4596-a3bc-dad00e67656f ``` `enroll` only appends the CachyOS EAC CA: every entry from the first listing must still be there, plus the CA. When the CA is already enrolled it prints "nothing to do" and writes nothing. On lucifer the CA is enrolled; expected db: `7 entries, 7 unique`: Database Key (sbctl), Windows Production PCA 2011, Windows UEFI CA 2023, Microsoft Corporation UEFI CA 2011, Microsoft UEFI CA 2023, Microsoft Option ROM UEFI CA 2023, CachyOS EAC CA. Duplicates in the first listing are a separate problem: report them to the user, do not fix them here (see troubleshooting). `sbctl list-enrolled-keys` prints issuers, so two Microsoft names appear twice there; that is correct. ## 3. Normal kernel signature ```sh for f in /efi/EFI/Gentoo/*.efi; do doas -n sbverify --list "$f"; done ``` Each image needs exactly one signature, issued by the sbctl `Database Key`. Without it the normal boot stops once Secure Boot is on. Fix by re-emerging the kernel (secureboot.eclass falls back to `/var/lib/sbctl/keys/db/db.key`). ## 4. EAC boot entry ```sh doas -n eac-boot setup 0201 efibootmgr | grep -E '^Boot(Order|0201)' doas -n ls /efi/EFI/cachyos-eac /efi/$(cat /etc/machine-id)/linux-cachyos-eac eac-boot cmdline ``` Expected: `Boot0201* CachyOS EAC` with loader `\EFI\cachyos-eac\systemd-bootx64.efi`, and `0201` last in BootOrder. `setup 0201` replaces whatever entry has that number. From now on every update of the kernel package runs `eac-boot update` itself. ## 5. Enable Secure Boot (user) 1. **(user)** Have the BitLocker recovery key ready (aka.ms/myrecoverykey). 2. **(user)** Reboot into the firmware setup and enable Secure Boot. Change nothing else. 3. Back in Gentoo: `doas -n sbctl status` shows Secure Boot enabled. 4. **(user)** Check that Windows boots. ## 6. Desktop session GPU card numbers differ between the two kernels, so Hyprland must not name `/dev/dri/cardN`: ```sh doas -n install -m644 host/udev/61-dri-igpu.rules /etc/udev/rules.d/ doas -n udevadm control --reload doas -n udevadm trigger --subsystem-match=drm --action=change ls -l /dev/dri/igpu ``` In `~/.config/hypr/env.lua`: `hl.env("AQ_DRM_DEVICES", "/dev/dri/igpu")`. The polkit agent is the only addition to the session autostart. In `~/.config/hypr/autocmds.lua`, inside `hl.on("hyprland.start", function () ... end)`: ```lua hl.exec_cmd("/usr/libexec/hyprpolkitagent") ``` Do not autostart `systemd-run-agent` and do not add `socket-activate.easyanticheat_eos` to a runlevel: `eac-run` starts both when the launcher starts and stops them when it exits. Remove such lines if an older setup left them (`grep -n systemd-run-agent ~/.config/hypr/*.lua`, `rc-update show | grep socket-activate`). Start the polkit agent in the running session without a relogin, then test `eac-run` from the session (Hyprland's exec, not ssh, so polkit sees the active session): ```sh hyprctl -i 0 dispatch 'hl.dsp.exec_cmd("/usr/libexec/hyprpolkitagent")' hyprctl -i 0 dispatch 'hl.dsp.exec_cmd("eac-run sleep 20")' sleep 5 rc-service socket-activate.easyanticheat_eos status # started (once EAC is installed, step 8) systemd-run --user --wait --pipe cat /proc/self/sessionid # must equal the next line cat /proc/$(pgrep -x Hyprland)/sessionid sleep 20 rc-service socket-activate.easyanticheat_eos status # stopped pgrep -f systemd-run-agent # nothing ``` No password dialog may appear for `eac-run`: the polkit action `de.root64.engler-labs.eac-openrc-compat.socket-activate` is allowed for the active session (`pkcheck --action-id de.root64.engler-labs.eac-openrc-compat.socket-activate --process $(pgrep -x Hyprland)` exits 0). Polkit agent check, during the `eac-run` window: `systemd-run --user --wait --pipe pkexec --disable-internal-agent /usr/bin/true`. **(user)** A password dialog must appear; cancel it. "No authentication agent found" means hyprpolkitagent is not running. `pkttyagent` does not work for this. ## 7. Boot the EAC entry ```sh doas -n eac-boot boot # reboots; the ssh session drops ``` After the reboot: ```sh uname -r # 7.3.7-2-cachyos-eac (or the current version) doas -n eac-status # every line [ OK ] cat /proc/sys/kernel/tainted # 0 ``` The next normal reboot returns to Gentoo. ## 8. First game launch (user) 1. **(user)** Start the Epic Games Launcher from the application menu or as `EpicGamesLauncher` (the package's wrapper runs it through `eac-run`), then Fortnite. A launcher started any other way (an AppImage, a desktop file of its own) has to be started as `eac-run `. 2. **(user)** Answer "Easy Anti-Cheat service installation required. Install now?" with Yes and enter the password in the polkit dialog. Meanwhile watch `~/.cache/com.epicgames.easyanticheat/service.log` and syslog (`doas -n grep -E 'systemctl-compat|systemd-run-agent|socket-activate' /var/log/everything/current`). Expected: ``` Running install with pkexec. Writing /usr/local/bin/easyanticheat_eos.new. Running systemctl daemon-reload. Authorizing user 1000. Running systemctl start easyanticheat_eos.socket. Operation succeeded. ``` and `/var/lib/easyanticheat_eos/authorizedusers/1000` exists. ## 9. Check a protected game **(user)** Close the launcher, start it again the same way, join a match. `eac-run` starts the listener this time (the setup did it on the first launch). After the launch, `/var/log/socket-activate.easyanticheat_eos.log` shows `Running service, version ...`, and `.../AppData/Local/FortniteGame/Saved/Logs/FortniteGame.log` in the Proton prefix shows `[AntiCheatClient] [BeginSession-...]` when joining a match. After the launcher exits, `rc-service socket-activate.easyanticheat_eos status` is `stopped` again. Nothing EAC-related starts at boot. ## Updates - **Kernel:** CachyOS removes old versions from its mirror. Bump the ebuild as described in its README, commit to `febuild`, copy the package into `overlay/`. `pkg_postinst` runs `eac-boot update`. - **EAC setup:** EAC updates its service itself. The compatibility layer was written against setup 0.1.7. If a later setup fails, capture its calls with `tools/` and compare them with the mapping in the eac-openrc-compat README. ## Removal ```sh pkexec /usr/local/bin/easyanticheat_eos uninstall standalone doas -n efibootmgr -b 0201 -B doas -n emerge -C sys-apps/eac-openrc-compat sys-kernel/cachyos-eac-kernel-bin games-util/epic-games-launcher-bin ``` Then remove `/efi/EFI/cachyos-eac`, `/efi//linux-cachyos-eac` and `/efi/loader/entries/cachyos-eac.conf`. The CachyOS EAC CA can stay in db: it only lets CachyOS-signed binaries boot. Never remove it with `sbctl enroll-keys` (that rewrites db and drops every key sbctl does not manage). To remove it, ask the user, then write back the db backup from step 2, which predates the CA: the "Duplicate keys in db" recipe in troubleshooting, with the backup file as input instead of `efi-readvar`'s output. Keys enrolled after that backup are lost. ## systemd systems The compatibility layer exists only because this machine runs OpenRC. On a systemd system it may work without it (untested): - **Gentoo with systemd:** install only `cachyos-eac-kernel-bin` and `epic-games-launcher-bin` (`eac-openrc-compat` blocks `sys-apps/systemd`). Follow steps 0-5 and 7-9, with any polkit agent in the desktop session; skip the `eac-run` parts of step 6. EAC's own socket unit then starts at boot and starts the service on demand. - **Other distributions:** use the distribution's signed kernel if Epic trusts its key, or CachyOS's own packages and instructions (wiki.cachyos.org/configuration/easy_anti_cheat). `eac-boot` and the ebuild are Gentoo-specific.