[App Server] Failed to start built-in Postgres database

I am running Anvil on the Ubuntu service on Windows. My error is a tiny bit different from the one described previously

`Found Anvil App Server JAR in package directory                                 Failed to start built-in Postgres database: java.io.IOException: Gave up waiting for server to start after 10000ms                                              More logs are available in .anvil-data/postgres.log.                            Some common causes of this problem:                                              - Are you launching this server as 'root' on a UNIX system?                       Postgres will not run as root; try launching the server as an ordinary user.  - Are you running this server on an unusual architecture or OS? (Linux/amd64)`

I have opened the postgres.log file adn there i can see this:

This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory .anvil-data/db ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Europe/Kiev
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

.anvil-data/db-bin/PG-a8263178df5b3591feca6b619939c2bb/bin/pg_ctl -D .anvil-data/db -l logfile start

waiting for server to start....2021-01-21 01:34:23.667 EET [1666] FATAL:  data directory "/mnt/c/users/patri/.anvil-data/db" has group or world access
2021-01-21 01:34:23.667 EET [1666] DETAIL:  Permissions should be u=rwx (0700).
 stopped waiting
pg_ctl: could not start server
Examine the log output.
pg_ctl: PID file ".anvil-data/db/postmaster.pid" does not exist
Is server running?
waiting for server to start....2021-01-21 01:35:21.998 EET [1708] FATAL:  data directory "/mnt/c/users/patri/.anvil-data/db" has group or world access
2021-01-21 01:35:21.998 EET [1708] DETAIL:  Permissions should be u=rwx (0700).
 stopped waiting
pg_ctl: could not start server
Examine the log output.
pg_ctl: PID file ".anvil-data/db/postmaster.pid" does not exist
Is server running?
waiting for server to start....2021-01-21 01:36:28.344 EET [1750] FATAL:  data directory "/mnt/c/users/patri/.anvil-data/db" has group or world access
2021-01-21 01:36:28.344 EET [1750] DETAIL:  Permissions should be u=rwx (0700).
 stopped waiting
pg_ctl: could not start server
Examine the log output.
pg_ctl: PID file ".anvil-data/db/postmaster.pid" does not exist
Is server running?

Please let me know if you have any advice on this matter. Thanks again

The log file describes a permissions problem on the .anvil-data/db directory ā€œPermissions should be u=rwx (0700)ā€.
Are you able to use chmod to change the permissions on that directory?

So I found the issue. I looked at the permissions and they were all open. But then I noticed that since I am running this Linux emulator on windows the file permissions and other from Linux and windows are different. Having saved the files in a windows directory this caused and opening it with a Linux it was creating this problem. I simply ran the app in the Linux space and not under the mnt directory I was in

2 Likes

I faced a similar issue. Postgre logs below

Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.

What worked for me was run my IDE in ā€˜non-administrator’ mode. I imagine fix will be the same for when running power shell and command prompt.

Hope it helps.

Apologies for the necro, couldn’t find any further support on my thread - Running Anvil Locally as Administrator Account - Anvil Q&A - Anvil Community Forum

How did you start your IDE in non-administrator mode? I’m using VS Code v1.82 on Windows 10. Have WSL installed, but not really sure how to use this.