Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createdb is not available on Void Linux #1770

Open
notramo opened this issue Jan 3, 2023 · 4 comments
Open

createdb is not available on Void Linux #1770

notramo opened this issue Jan 3, 2023 · 4 comments
Labels
improve error experience Make errors nicer to deal with

Comments

@notramo
Copy link

notramo commented Jan 3, 2023

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.

@jwoertink
Copy link
Member

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.

@jwoertink jwoertink added the needs investigation A possible bug / better docs needed. Investigate further label Jan 3, 2023
@notramo
Copy link
Author

notramo commented Jan 3, 2023

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.

@jwoertink
Copy link
Member

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.

@jwoertink jwoertink added improve error experience Make errors nicer to deal with and removed needs investigation A possible bug / better docs needed. Investigate further labels Jan 3, 2023
@notramo
Copy link
Author

notramo commented Jan 3, 2023

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.”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improve error experience Make errors nicer to deal with
Projects
None yet
Development

No branches or pull requests

2 participants