Figured this out; the settings in System Settings
->Power
don’t seem to make any difference, at least on particular BIOS or motherboard or whatever. However, this command will fix the problem and prevent the machine from ever sleeping:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target