I'm running into the local run directory for process-compose that I set with dataDir
having the wrong permissions and its unable to initialize the database. Its possible the system has auto new directories having specific permissions, but I think we should check for that?
Maybe something here: https://github.com/juspay/services-flake/blob/main/nix/postgres.nix#L354-L357
What do you mean by "wrong permissions"? For reference, this is what I see on my local machine (which happens to be a mac) when I nix run
the example in the repo,
❯ ls -ld data/
drwxr-xr-x 4 srid staff 128 Nov 30 13:28 data/
❯ ls -ld data/pg1/global
drwx------ 63 srid staff 2016 Nov 30 13:28 data/pg1/global
And
❯ ls -dl data/pg1
drwx------ 25 srid staff 800 Nov 30 13:28 data/pg1
its unable to initialize the database
Could you post the error? Maybe initdb
requires data directory to not be world-readable.
Oh it is a locale related issue?
sorry, looks unrelated :sweat_smile: but this is the start of it. I am troubleshooting someone elses environment. when he goes to run the postgres init again, then its a permissions issue
By the way, you can also pass -t=false
arguments to get flat interleaved log output that is easier to copy-paste.
# Example
nix run . -- -t=false up
good to know. seems the selection mode in process-compose doesn't work well
There is also the log_location
(in #process-compose-flake) option to have it write to a log file
tgunnoe said:
Error in screenshot:
initdb: error: invalid locale settings: check LANG and LC_* environment variables
Perhaps services-flake
should explicitly set this env. cc @Shivaraj B H
Ref: https://stackoverflow.com/a/42111789/55246
tgunnoe said:
sorry, looks unrelated :sweat_smile: but this is the start of it. I am troubleshooting someone elses environment. when he goes to run the postgres init again, then its a permissions issue
What's the permission issue in particular?
Can this problem be reproduced in another system? Then we have a bug report as well.
What should services-flake set those vars to?
Probably the same as those in StackOverflow answer, so:
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
would setting them in the shell before running process compose not be the same result?
I'd think so, yes.
Here's another answer from Nix context which suggests adding the glibcLocales
package to the environment.
that's a good bet
image-6.png
well more logs in the latest, but still the same. i need to mess up my locales to solve this
because its using the nix devshell, something needs to be set properly there. ah
The "cannot change locale" warnings are concerning.
yeah. its trying to setlocale from within process compose in a nix shell :melting_face:
# https://github.com/NixOS/nixpkgs/issues/38991
# bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
env.LOCALE_ARCHIVE = lib.optionalString stdenv.hostPlatform.isLinux "${glibcLocales}/lib/locale/locale-archive";
would this be enough as an env in the shell? or i wonder, does nixpkgs glibc have a general issue
would this be enough as an env in the shell?
Probably.
We might even want to add this to service-flake.
I've had locale issues on emanote (which too uses Nix) as well:
https://github.com/srid/emanote/issues/125
So, certainly not limited to postgres here.
@tgunnoe Perhaps you can create an issue in services-flake and we can track it there?
I will. could it be something with lib.getExe?
could it be something with lib.getExe?
Not sure, but a way to reproduce would be great to debug
Last updated: Oct 12 2024 at 21:29 UTC