ReviewOS

pantry-pm/pantry

Linux: global packages carry RPATH /../lib, and the postgres user unit is malformed

#243
Open chris opened this 8 days ago ·
8 days ago

Found on Ubuntu 24.04 x86_64 (Hetzner cx23) with pantry 0.11.17 (823fa5b), setting up a CI runner box.

1. Installed binaries can't find their libraries

pantry install -g postgresql.org@17 (as root) puts real ELF binaries in /usr/local/bin and the libraries in /usr/local/packages/<pkg>/<version>/lib. But the binaries' RPATH is a literal /../lib:

$ readelf -d /usr/local/packages/postgresql.org/v17.10/bin/initdb | grep -i rpath
 0x000000000000000f (RPATH)  Library rpath: [/../lib]
$ initdb --version
initdb: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory

The intended value is presumably $ORIGIN/../lib; /../lib is just /lib. Every package with its own shared libraries breaks the same way. An older pantry on another box wrote /usr/local/bin shims that export LD_LIBRARY_PATH instead, and those work, so this looks like a regression.

pantry install -u printed "Packages installed to: /usr/local" too, rather than ~/.local/share/pantry/global.

2. pantry start postgres writes a systemd unit with broken escaping

As a non-root user with lingering enabled, pantry start postgres writes ~/.config/systemd/user/pantry-postgres.service. systemd refuses parts of its ExecStart:

pantry-postgres.service:6: Ignoring unknown escape sequences: "D="/home/runner/.local/share/pantry/data/postgres"; L="$(find /opt/pantry/pantry -maxdepth 6 -type d -path "*/v*/lib" 2>/dev/null | tr "...
pantry-postgres.service: Main process exited, code=exited, status=127/n/a

There are two problems here:

  • The inline shell needs systemd escaping, or better, a wrapper script.
  • It searches /opt/pantry/pantry for libraries, which doesn't exist on this machine.

After a successful pantry install -g, initdb also failed with FileNotFound during pantry start postgres. That's issue 1 again.

Earlier, without lingering (su - user), it failed with Failed to connect to bus: No medium found. A clearer error would help: the user service manager needs loginctl enable-linger <user>.

Impact

On Linux, services: in ReviewOS's runner relies on pantry start <service>, so a self-hosted runner there can't start Postgres. We fell back to a distribution Postgres on that box.

Sign in to comment on this issue.