- Automatic login: sysadminctl set autoLoginUser but left the previous user's password in /etc/kcpassword (macOS 27), so the machine stopped at the login screen. Write and verify /etc/kcpassword ourselves, and treat automatic login as working only if the stored password authenticates (probe-user.sh, verify). - Command Line Tools: move to a separate "clt" step, which also updates outdated tools after a macOS upgrade (Homebrew refuses to build squid with them). softwareupdate offers them even when current, so the step reinstalls every time; add --skip to leave it out. - Xcode: accept an .xip already on the runner (--xcode-xip-on-runner / XCODE_XIP_ON_RUNNER) and delete the .xip only once the whole step succeeds. - Squid: remove a leftover sh.brew.squid LaunchAgent (Homebrew 7 label) and check for the patch without a pipefail-unsafe pipe. Update squid-patch. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
6.9 KiB
Operations
Common tasks on a runner that is already set up. Everything assumes you are in
a checkout of this repository with config.env matching the machine.
Health check
./bootstrap.sh verify
Read-only. Checks sudo, sshd, the Squid daemon, proxying through it (bumped
and spliced), the Xcode selection and components, automatic login, the
packages, and every runner's registration, .env, LaunchAgent and listener.
Then confirm the runners show as Idle on GitHub (organization settings →
Actions → Runners).
Backing up secrets
./backup.sh
Run it before a re-image, and again after anything changes a secret: the
runner password, runners re-registered with --reconfigure-runners, a new
Squid CA, or the first run of this setup. On the old machine automatic login was
administrator, so its first backup has no usable runner password. What's
in the backup and how it is restored is described in the
README.
If a backup must not be used (e.g. you want a fresh CA), run
./bootstrap.sh --no-restore, or move secrets/ aside.
Installing a new Xcode
tools/latest-xcode.sh # newest one this macOS supports
./bootstrap.sh --xcode-xip ~/Downloads/Xcode_26.3_Apple_silicon.xip xcode verify
# or, if the .xip is already on the runner (path relative to administrator's home):
./bootstrap.sh --xcode-xip-on-runner Downloads/Xcode_26.3_Apple_silicon.xip xcode verify
Once the step succeeds, the .xip is deleted from the runner, whether it was
uploaded, downloaded or already there (set XCODE_DELETE_XIP=0 to keep it). If
the step fails, the .xip stays, so you can re-run without copying it again.
The old Xcode is kept. Afterwards:
- Set the Actions variable
HOST_XCODE_PATHto the new app, in theutmapporganization or UTM repository settings. - Once no branch needs the old one, delete it:
ssh administrator@<host> sudo rm -rf /Applications/Xcode_<old>.app, and remove its simulator runtimes withxcrun simctl runtime delete <id>.
If the new Xcode needs a newer macOS, the step stops before installing.
Upgrade macOS first (sudo softwareupdate -l, then -i <label> --restart), or
re-image with a newer macOS.
Updating squid-patch
squid-patch is a git submodule pointing at the gist. It is maintained
separately, but this runner is where it's deployed, so keep them in step:
cd squid-patch
git pull # or commit your own changes and push them
cd ..
git add squid-patch && git commit -m "Update squid-patch"
./bootstrap.sh squid verify
remote/30-squid.sh rebuilds Squid only when squid.rb changed. Otherwise it
refreshes the helper, certificates bundle and services. A changed squid.conf
is not overwritten on the machine (deploy.sh keeps local edits and saves a
.bak). To force it, set SQUID_DEPLOY_ARGS="--force-config" in
config.local.env for that run.
To check the machine hasn't drifted from the submodule:
ssh administrator@<host> 'cat /opt/homebrew/etc/squid.conf' | diff squid-patch/squid.conf -
ssh administrator@<host> 'cat /opt/homebrew/etc/squid/github_store_id_helper.py' | diff squid-patch/github_store_id_helper.py -
ssh administrator@<host> 'cat /opt/homebrew/Library/Taps/osy/homebrew-local/Formula/squid.rb' | diff squid-patch/squid.rb -
Useful on the machine:
sudo launchctl kickstart -k system/org.squid-cache.squid # restart
squid -k parse # check the config
tail -f /opt/homebrew/var/logs/access.log
awk '{print $4}' /opt/homebrew/var/logs/access.log | sort | uniq -c | sort -rn | head
After a macOS upgrade
A macOS upgrade leaves the Command Line Tools at the old version, and Homebrew
refuses to build from source with them ("Your Command Line Tools are too
outdated"). Building the patched Squid is exactly that. The clt step
installs the newest Command Line Tools that softwareupdate offers, so run:
./bootstrap.sh clt verify
softwareupdate keeps offering the tools even when they are current, so clt
reinstalls them on every run, which takes several minutes. When they are
current, leave it out of full runs: ./bootstrap.sh --skip clt.
Because the Actions runners are LaunchAgents of the auto-logged-in runner
account, they come back by themselves after the upgrade's reboot, as long as
automatic login is runner.
Adding, removing or re-registering runners
- More runners: raise
RUNNER_COUNT, then./bootstrap.sh runners activate verify. - Fewer runners: lower
RUNNER_COUNT. For each runner being removed, run asrunneron the machine:cd ~/actions/runner-N && ./svc.sh uninstall && ./config.sh remove --token <token>. The runners step warns about directories beyond the count. - Re-register all (e.g. after moving to another org or group):
./bootstrap.sh --reconfigure-runners runners activate verify.
A registration token comes from gh (with admin:org: gh auth refresh -s admin:org),
from GITHUB_RUNNER_TOKEN, or from New runner on the GitHub settings page.
Restart a runner after changing its .env. The restart kills the job it's
running, so check the Actions page first:
ssh administrator@<host> 'sudo launchctl kickstart -k gui/$(id -u runner)/actions.runner.utmapp.macstadium-1'
Changing settings
Edit config.env (or config.local.env) and re-run the step that uses the
setting. The step for each setting is in reference.md. For
example, screen sharing is ./bootstrap.sh system, and Python packages
are ./bootstrap.sh user.
Troubleshooting
Runners offline after a reboot. Check ./bootstrap.sh verify. If
"runner has a GUI session" fails, automatic login didn't happen. The usual
cause is a changed runner password, which leaves the stored autologin
password stale. Re-run ./bootstrap.sh user with the current password
(RUNNER_USER_PASSWORD=...). A macOS update can also stop at a login prompt:
look through Screen Sharing.
Jobs fail with certificate errors. Some tool isn't using the variables in
.env. Point it at /opt/homebrew/etc/squid/ca-bundle.pem. If a host
shouldn't be intercepted, add it to the ssl_bump splice rules in
squid-patch/squid.conf.
Everything is a cache miss. See "Checking that it works" in squid-patch/README.md.
bootstrap.sh says the host key changed. Expected after a re-image:
ssh-keygen -R <host>. If the machine was not re-imaged, find out why
before you do that. With a backup, the system step restores the old host
keys and fixes known_hosts for you.
A restored runner stays offline. Its registration was probably removed on
GitHub, which happens after about 14 days offline.
~runner/Library/Logs/actions.runner.*/stdout.log will say so. Register it
again with ./bootstrap.sh --reconfigure-runners runners activate verify,
then run ./backup.sh.