# 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). 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 sys-auth/hyprpolkitagent ``` `emerge -p` must resolve both 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 sys-auth/hyprpolkitagent ``` 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 # /efi qfile /usr/bin/systemctl /usr/bin/systemd-run /usr/lib64/libsystemd.so.0 ldd /usr/libexec/hyprpolkitagent | grep 'not found' # empty ``` 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. Then: ```sh doas -n eac-boot enroll doas -n python3 tools/efi-sig-list.py $V/db-d719b2cb-3d3a-4596-a3bc-dad00e67656f ``` Expected: `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. `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")`. In `~/.config/hypr/autocmds.lua`, inside `hl.on("hyprland.start", function () ... end)`: ```lua hl.exec_cmd("/usr/libexec/hyprpolkitagent") hl.exec_cmd("/usr/libexec/eac-openrc-compat/systemd-run-agent") ``` Start both in the running session without a relogin: ```sh hyprctl -i 0 dispatch 'hl.dsp.exec_cmd("/usr/libexec/hyprpolkitagent")' hyprctl -i 0 dispatch 'hl.dsp.exec_cmd("/usr/libexec/eac-openrc-compat/systemd-run-agent")' ls -l /run/user/1000/systemd-run-agent.sock systemd-run --user --wait --pipe cat /proc/self/sessionid # must equal the next line cat /proc/$(pgrep -x Hyprland)/sessionid ``` Polkit check: `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.5-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 (AppImage) and Fortnite. 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. Start the service at boot EAC only runs `systemctl start`; on systemd its `sockets.target.d` drop-in starts the socket at boot, which OpenRC does not read. Add it to the runlevel: ```sh doas -n rc-update add socket-activate.easyanticheat_eos default rc-service socket-activate.easyanticheat_eos status # started ``` ## 10. Check a protected game After the next 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. ## 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 rc-update del socket-activate.easyanticheat_eos default doas -n efibootmgr -b 0201 -B doas -n emerge -C sys-apps/eac-openrc-compat sys-kernel/cachyos-eac-kernel-bin ``` Then remove `/efi/EFI/cachyos-eac`, `/efi//linux-cachyos-eac` and `/efi/loader/entries/cachyos-eac.conf`. The unmerge also removed the CA from `/var/lib/sbctl/keys/custom/db/`; to drop it from the firmware db too, run `doas -n sbctl enroll-keys --partial db --microsoft --ignore-immutable`. ## 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` (`eac-openrc-compat` blocks `sys-apps/systemd`). Follow steps 0-5, 7 and 8, with any polkit agent in the desktop session. Skip the `systemd-run-agent` lines in step 6 and all of step 9. - **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.