-2

I am trying to run an installation check for PostgreSQL using make PG_CONFIG=../postgresql-11.17/bin/pg_config installcheck in the age directory and I am getting an error message saying "pg_regress: initdb failed" with a DETAIL message saying that the data directory has invalid permissions. I have also checked the contents of the initdb.log file which says,

" running bootstrap script ... 2023-04-11 09:48:37.706 WAT [1262] FATAL: data directory "/mnt/c/Users/HP/documents/the_age_project/age/./regress/instance/data" has invalid permissions 2023-04-11 09:48:37.706 WAT [1262] DETAIL: Permissions should be u=rwx (0700) or u=rwx,g=rx (0750). child process exited with exit code 1 initdb: data directory "/mnt/c/Users/HP/documents/the_age_project/age/./regress/instance/data" not removed at user's request "

Can anyone suggest a solution or troubleshooting steps to resolve this issue? Any help would be greatly appreciated.

I have tried changing the permissions of the data directory to u=rwx and g=rx but the error persists. I have also checked the contents of the initdb.log file but could not identify the cause of the problem.

  • Remove the directory `C:\Users\HP\documents\the_age_project\age\regress\instance\data`, give the user permission to create files in `C:\Users\HP\documents\the_age_project\age\regress\instance` and try again. – Laurenz Albe Apr 11 '23 at 09:41
  • I keep running `chmod 0700 /mnt/c/Users/HP/documents/the_age_project/age/regress/instance/data` and `sudo chmod 0700 /mnt/c/Users/HP/documents/the_age_project/age/regress/instance/data` but it seems not to take effect as the directory remains `drwxrwxrwx 1 4096 Apr 11 10:52 the_age_project/age/regress/instance/` – Nnaemeka Daniel John Apr 11 '23 at 10:00
  • It seems like you are using WSL, I have encountered to similar problem and the solution was moving from the /mnt directory and work on a system directory like /home was a solution to me try that out on your side, checkout that blog for common issue at WSL installation https://dev.to/rrrokhtar/postgresql-age-installation-guide-for-wsl-and-common-issues-2l77 – Mohamed Mokhtar - rrrokhtar Apr 11 '23 at 16:12
  • Yeah your right I use WSL, I'll check that out – Nnaemeka Daniel John Apr 11 '23 at 23:55

5 Answers5

0

You may need to check if there is a postgreSQL process running in the background. Using ps -ef| grep postgres. Then try to stop and reinstall after changing the permission of thr file. You may need to use make not sudo make with install check.. And use sudo make install… one last thing make sure the permission is set correctly for linux

AmrShams07
  • 96
  • 1
  • 7
0

If you installed PostgreSQL successfully then I don't think there should be an issue. However, if you didn't then I suggest you run the following command sudo make PG_CONFIG=../postgreql-11.17/bin/pg_config installprior to that of installcheck (There's no need running this afterwards). If this issue persists, I guess you havebto start the process of installing AGE from the beginning.

Tito
  • 289
  • 8
  • You mean if `sudo make PG_CONFIG=../postgreql-11.17/bin/pg_config install` was successful then there is no need to run `make PG_CONFIG=../postgreql-11.17/bin/pg_config installcheck`? – Nnaemeka Daniel John Apr 11 '23 at 23:53
  • Yes, I encountered something similar and went through the [AGE GitHub Documentation](https://github.com/apache/age), it didn't state running the command with `installcheck`. – Tito Apr 12 '23 at 11:58
0

Thanks guys for the help, I found out that trying to change permissions in the Windows file system do not work because they do not retain Linux permissions by default. However, there's a way to enable that. By creating (using sudo) /etc/wsl.conf and adding the following lines:

[automount]
options = "metadata"

Source https://superuser.com/questions/1323645/unable-to-change-file-permissions-on-ubuntu-bash-for-windows-10

0

Try the following things:

  • Check the permission of postgresql directory using chmod and chown.
  • Check the permissions of WSL as well.
adil shahid
  • 125
  • 4
0

I am also using WSL2.

After this command sudo make PG_CONFIG=~/postgresql-11.18/bin/pg_config install, AGE was successfully running on my system.

Try these steps, might solve your problem.

  • Compatible Versions.
  • Required Permission to run.