power: keep wayback awake lid-closed (never-sleep)
wayback runs as an always-on router living lid-closed in the van, but stock logind HandleLidSwitch=suspend would sleep it on lid close (even on AC). Add a logind drop-in that ignores the lid in all states and mask every sleep target so idle/GUI/stray `systemctl suspend` can't suspend it either. - power/10-vanlink-nolid.conf -> /etc/systemd/logind.conf.d/ - deploy.sh: install drop-in, mask sleep/suspend/hibernate/hybrid-sleep, restart systemd-logind - README: power/ layout row, never-sleep operation notes + reversal recipe Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
387375de1e
commit
35466f0141
@@ -90,6 +90,14 @@ This directory is the source of truth. The live system files live under `/etc`,
|
||||
### `cockpit/vanrouter/` — web UI
|
||||
`manifest.json`, `index.html`, `vanrouter.css`, `vanrouter.js` → `/usr/share/cockpit/vanrouter/`.
|
||||
|
||||
### `power/` — never sleep
|
||||
| file | → installs to | purpose |
|
||||
|---|---|---|
|
||||
| `10-vanlink-nolid.conf` | `/etc/systemd/logind.conf.d/10-vanlink-nolid.conf` | logind ignores the lid in all states (closed / on AC / docked) |
|
||||
|
||||
`deploy.sh` additionally **masks** `sleep.target suspend.target hibernate.target hybrid-sleep.target`
|
||||
(no repo file — symlinks to `/dev/null` under `/etc/systemd/system/`) so nothing else can suspend either.
|
||||
|
||||
---
|
||||
|
||||
## 3. Components & how to operate
|
||||
@@ -131,6 +139,17 @@ This directory is the source of truth. The live system files live under `/etc`,
|
||||
- Read-only status works as any user; Prefer/Up/Down/Restart need *Administrative access* (polkit).
|
||||
- **Prefer** sets the manual WAN preference (see *Manual preference* above); **Up/Down** connect/disconnect the NM device; **Restart** restarts hostapd.
|
||||
|
||||
### Never sleep (lid-closed operation)
|
||||
- wayback lives lid-closed in the van and must stay up. Stock logind `HandleLidSwitch=suspend` would sleep it on lid close (even on AC). The `power/10-vanlink-nolid.conf` drop-in sets all three lid actions to `ignore`; `deploy.sh` also masks every sleep target so idle / GUI / a stray `systemctl suspend` can't suspend it.
|
||||
- Verify: `busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager HandleLidSwitch` → `"ignore"`, and `systemctl is-enabled suspend.target` → `masked`. `busctl call ... CanSuspend` should return `"no"`.
|
||||
- **To re-enable sleep** (e.g. if wayback is ever a laptop again):
|
||||
```bash
|
||||
sudo rm /etc/systemd/logind.conf.d/10-vanlink-nolid.conf
|
||||
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
|
||||
sudo systemctl restart systemd-logind
|
||||
```
|
||||
(then remove the `power/` block from `deploy.sh`, or the next deploy re-applies it).
|
||||
|
||||
---
|
||||
|
||||
## 4. Deploy / rebuild
|
||||
|
||||
@@ -33,6 +33,11 @@ echo "== cockpit plugin =="
|
||||
install -d /usr/share/cockpit/vanrouter
|
||||
install -m0644 cockpit/vanrouter/* /usr/share/cockpit/vanrouter/
|
||||
|
||||
echo "== power / never-sleep =="
|
||||
install -D -m0644 power/10-vanlink-nolid.conf /etc/systemd/logind.conf.d/10-vanlink-nolid.conf
|
||||
# Belt-and-suspenders: a router must never suspend from idle, GUI, or a stray `systemctl suspend`.
|
||||
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target >/dev/null 2>&1 || true
|
||||
|
||||
echo "== apply =="
|
||||
sysctl --system >/dev/null
|
||||
systemctl daemon-reload
|
||||
@@ -40,6 +45,8 @@ systemctl daemon-reload
|
||||
# can never satisfy "online" and just burns its 120s timeout, stalling network-online.target
|
||||
# and ZeroTier by ~2min every boot. Real uplink readiness is covered by NetworkManager-wait-online.
|
||||
systemctl mask systemd-networkd-wait-online.service >/dev/null 2>&1 || true
|
||||
# pick up the lid drop-in (re-execs logind; does NOT drop the network)
|
||||
systemctl restart systemd-logind >/dev/null 2>&1 || true
|
||||
systemctl unmask hostapd >/dev/null 2>&1 || true
|
||||
systemctl enable regdomain.service hostapd van-ap-dnsmasq nftables systemd-networkd van-failover >/dev/null 2>&1 || true
|
||||
# restart in dependency order; AP iface IP first, then hostapd/dnsmasq, then NAT/failover
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[Login]
|
||||
# wayback is an always-on router living lid-closed in the van.
|
||||
# Default logind suspends on lid close (incl. on AC); ignore the lid in every state.
|
||||
HandleLidSwitch=ignore
|
||||
HandleLidSwitchExternalPower=ignore
|
||||
HandleLidSwitchDocked=ignore
|
||||
Reference in New Issue
Block a user