openship
openship copied to clipboard
server install: openresty/certbot recipes run apt without sudo (fails for non-root SSH user)
Bug
When a server is registered with a non-root SSH user (e.g. ubuntu with passwordless sudo — the default on Tencent Cloud / AWS Ubuntu images), openship server install -c openresty and -c certbot fail:
[openresty] Installing OpenResty...
[openresty] E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
The apt invocation is not elevated with sudo. -c docker on the same server succeeds (its recipe does escalate), which makes the failure look confusing — possibly what #36 is hitting.
Repro
- Ubuntu 24.04 VM, SSH user
ubuntu(passwordless sudo, not root) openship server add --host <ip> --user ubuntu --auth-method key --key-path <key>openship server install <id> -c docker openresty certbot --follow- docker ✔ installs; openresty ✖ and certbot ✖ fail at the apt lock
Expected
All install recipes should elevate via sudo when the SSH user is not root (or document that root is required for component installs).
Two side observations
- The openresty recipe runs
Stopping existing OpenResty...(via sudo, which works) before the failing apt step, so a previously running openresty is left stopped after the failed install. - After the component is installed some other way,
server checkreports itinstalled / unhealthy("analytics scripts are not deployed - reinstall to fix"), but reinstalling is impossible for non-root users because of this bug — a dead end.
Environment
- CLI + desktop app v0.2.1 (macOS arm64)
- Target: Ubuntu 24.04 (noble), Tencent Cloud
fixed in next update, thank you