`createdb` is not available on Void Linux
notramo opened this issue · 4 comments
On Void Linux, the initdb
, createdb
, and other tools are installed to /usr/lib/psql14/bin
, which is only added to the path of the postgres
user. This means that script/setup
fails on any default Void Linux installation.
Interesting! I've never heard of Void before. Sounds like maybe we should add some documentation that says you'll need to add shims or something to get access to those utilities if you're developing on that OS locally. Those would never be ran in production, so this is most likely just a user specific setup issue that may need docs.
Upon further investigation, it seems like there are multiple Postgres versions in the repository, e.g. postgresql13
, postgresql14
, which can be installed side by side. Because each server version has its collection of compatible CLI programs, it is namespaced, so it's not installed in /usr/bin
, but in /usr/lib/pgsql{14,13,etc}/bin
. This is added automatically to the $PATH
of the postgres
user, but requires manually appending for other users.
So it's more a system configuration problem rather than a bug in the setup script.
What the script could do, is to check for the XBPS package manager (e.g. which xbps-install
or which xbps-query
), and maybe link to this issue, or provide instructions on appending /usr/lib/pgsql*/bin
to PATH
. Only downside could be that XBPS is also shipped in the AUR, for bootstrapping a Void Linux installation to another partition from inside an Arch Linux system. So the XBPS executables may be available on Arch based systems too. This can be worked around by checking for the lack of pacman
. Also, if Postgres is installed from pacman
, then this whole issue is irrelevant, because the CLI tools are available. So the full logic is: if we can't find createdb
, and have XBPS installed, but not pacman
, then notify the user.
Ah, ok. The only thing I'm worried about would be falling in to the rabbit hole of trying to manage all the possible combinations of distros out there. Like, this is also sort of an issue on Alpine, or even on Ubuntu if you're using pg in a Docker, etc... It'll also become a big issues once Windows is 100% native 😬
It sounds like the best way to handle it really is a better error message of
Looks like you don't have the postgres CLI tools installed, or linked... Make sure you have access to .....
Instead of just blowing up, we can help point the user as to what they need access to, and then just leave it up to each user to decide.
Maybe add the following: “On some systems, like Void Linux, or Alpine Linux, these tools are not automatically added to $PATH. Make sure that the installation directory is included in $PATH.”