Postgresql ошибка postgresql conf

I have Windows Server 2003 machine on which I tried to install Postgres 9.2. At the end of the installation it pops a warning saying

Problem running post-install step. Installation may not complete
correctly. Error reading file C:\Program Files\PostgreSQL\9.2\data\postgresql.conf

I checked for the file postgresql.conf in C:\Program Files\PostgreSQL\9.2\data and found that it does not exist.

I also found that there is not much under the data folder except for pg_log folder which is also empty.

Any ideas on what I may be doing wrong?

Cœur's user avatar

Cœur

37.3k25 gold badges196 silver badges267 bronze badges

asked May 24, 2013 at 8:07

Fawad Shah's user avatar

I recommend you to try following, it worked for me:

Make sure that the user that is logged in to the server has full control permissions for the postgres folder and it’s sub-folders.

Run:

initdb -D <your new data folder>

and then:

pg_ctl -D <your new data folder> -l logfile start

If the problem continues, and postgres is installed under «Program Files», or the installation path contains a space character, try using a relative path for the data folder argument of pg_ctl. Such as: «..\data»

answered Jun 22, 2013 at 10:10

eaykin's user avatar

eaykineaykin

3,7131 gold badge37 silver badges33 bronze badges

1

I just stumbled over another issue: If the user name of the currently active user contains a space character, postgres will fail to install its services to begin with, which results in the same error message. Be careful about changing the user name, as this might brick your windows installation. Instead, create a new user with admin privileges and install postgres from there, and everything will work smoothly.

On top of that, you will have to use a «runas /user:postgres cmd» to get a command window that’s any good, or else initdb won’t work either.

I realize this answer is months late, but it might help someone else!

answered Nov 17, 2013 at 17:56

Kajetan Abt's user avatar

Kajetan AbtKajetan Abt

1,5053 gold badges15 silver badges28 bronze badges

1

Had this problem on Windows 10. For me the solution was to choose a locale different from [Default Locale] during install.

answered Jan 14, 2019 at 0:13

Vlad's user avatar

VladVlad

8441 gold badge12 silver badges22 bronze badges

0

I was trying to install PostgreSQL v15.3.1 x64 on my company windows laptop and I was continuously getting below errors, even after multiple attempts of uninstalling and downgrading the software.

  1. Failed to load SQL modules into the database cluster.
  2. Problem running post-install step. Installation may not complete correctly Error reading file C:/Program
    Files/PostgreSQL/15/data/postgresql.conf

I could not find a C:/Program Files/PostgreSQL/15/data created after the installation is complete, hence I could not use the Postgres services.

Steps I used to resolve the issue.

  1. I was saving the installer into a oneDrive folder. Which I changed to C:/Postgres15 folder where I have admin privileges.
  2. Downloaded the installer exe, started the installer via CMD as admin

This resolved the issue! Now, I see the ‘data’ folder got created and I am able to start the service. Only warning I found this time is:

Problem running post-install step. Installation may not complete correctly
The database cluster initialisation failed.

But now the services are starting.

warning 1 screenshot

Warning 2 Screenshot

Warning 3 Screenshot

answered May 26 at 6:29

Lal Krishna's user avatar

I am generating postgresql configuration files via ansible, and putting them in /etc/postgresql/XX/main/conf.d/whatever.conf. I accidentally made a syntax error and broke my postgresql, requiring manual fixing.

Is there any postgresql command to validate that a file is a valid postgresql.conf file?

sudoers files can be validates with /usr/sbin/visudo -cf path/to/file. Is there anything for postgresql?

I’m currently running Ubuntu 18.04 & 20.04, with PostgreSQL 10, 12 etc (yes several different versions).

asked Jan 17, 2022 at 15:03

Amandasaurus's user avatar

Yes.

At least as of version 10 there is a mechanism to check the config file from within postgres.

This is the result of adding a fubar to my config file, didn’t reload it.

postgres=# select sourcefile, name, sourceline, error from 
           pg_file_settings where error is not null;
               sourcefile                | name | sourceline |    error
-----------------------------------------+------+------------+--------------
 /etc/postgresql/12/main/postgresql.conf |      |         33 | syntax error
(1 row)

Docs will be: https://www.postgresql.org/docs/10/view-pg-file-settings.html, also, you might be interested in https://www.postgresql.org/docs/10/view-pg-hba-file-rules.html

answered Jan 17, 2022 at 15:38

pobk's user avatar

pobkpobk

1412 bronze badges

4

The only program that I know is postgres, the database server.

I have two approaches to deal with that problem:

  • After you edit postgresql.conf and reload, examine the PostgreSQL log file. If there was a problem, you will see that in the log, an the server will keep running with the previous configuration (no outage). Fix the file and try again until it the reload is successful.

  • Use ALTER SYSTEM rather than postgresql.conf to change configuration parameters. That works just as well, and ALTER SYSTEM will catch most of the possible syntax errors. Of course, you should still look at the PostgreSQL log after reloading.

As an alternative to checking the log file, you may use the pg_file_settings view as described in the other answer.

answered Jan 17, 2022 at 15:11

Laurenz Albe's user avatar

Laurenz AlbeLaurenz Albe

45.4k4 gold badges37 silver badges62 bronze badges

3

With the command postgres (see man postgres for details) you can query a config parameter and if something in one of the config files is invalid, it shows an error.

Example Postgresql version 12 on Debian as user postgres:

$ /usr/lib/postgresql/12/bin/postgres --config-file=/etc/postgresql/12/main/postgresql.conf -C data_directory
/var/lib/postgresql/13/main
$ echo $?
0

now with an error in the config:

$ /usr/lib/postgresql/12/bin/postgres --config-file=/etc/postgresql/12/main/postgresql.conf -C data_directory
2023-03-31 11:15:22.550 [5041] LOG:  unrecognized configuration parameter "unknown" in file "/etc/postgresql/12/main/conf.d/example_error.conf" line 2
2023-03-31 11:15:22.550 [5041] FATAL:  configuration file "/etc/postgresql/12/main/conf.d/example_error.conf" contains errors
$ echo $?
1

answered Mar 31 at 11:23

Marco's user avatar

MarcoMarco

1112 bronze badges

1

Всем привет
Ситуация следующая: мне требуется поднять две базы для двух разных приложений. Вот кусочек .yml где я поднимаю базы:

services:
   db1:
       image: some_image
       volumes:
         - ./configs/postgresql_1.conf:/etc/postgresql/postgresql_1.conf
       command:  postgres -c config_file=/etc/postgresql/postgresql_1.conf
   db2:
       image: some_image
       volumes:
         - ./configs/postgresql_2.conf:/etc/postgresql/postgresql_2.conf
       command:  postgres -c config_file=/etc/postgresql/postgresql_2.conf

В конфигурационных файла по две строчки:
postgresql_1.conf:
listen_adress = “localhost”
port = 15432

postgresql_2.conf:
listen_adress = “localhost”
port = 5432

Когда я пытаюсь поднять любую из баз командой docker-compose up db1 я вижу следующую ошибку:

LOG: input in flex scanner failed at file «/etc/postgresql/postgresql_1.conf» line 1
FATAL: configuration file «/etc/postgresql/postgresql_1.conf» contains errors

Подскажите пожалуйста, что я делаю не так?

db_1   |
db_1   | /docker-entrypoint.sh: running /docker-entrypoint-initdb.d/make_db.sh
db_1   | CREATE DATABASE
db_1   | CREATE ROLE
db_1   | GRANT
db_1   |
db_1   | /docker-entrypoint.sh: running /docker-entrypoint-initdb.d/setup-wale.sh
db_1   |
db_1   | LOG:  received fast shutdown request
db_1   | LOG:  aborting any active transactions
db_1   | waiting for server to shut down....LOG:  autovacuum launcher shutting down
db_1   | LOG:  shutting down
db_1   | LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   |
db_1   | PostgreSQL init process complete; ready for start up.
db_1   |
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 609, near end of line
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 610, near end of line
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | LOG:  syntax error in file "/var/lib/postgresql/data/postgresql.conf" line 612, near end of line
db_1   | FATAL:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors```

Error reading file PostgreSQL/9.1/data/postgresql.conf
Наверное много народу с этой ошибкой столкнулось, а сколько нервов потрачено на её устранение, вообще не счесть!!!
Я так же как и все столкнулся с этой ПРОБЛЕМОЙ! И вот как я её решил:
1) Устанавливаем PostgreSQL и как только появляется эта ошибка- Error reading file PostgreSQL/9.1/data/postgresql.conf жмём ОК и СРАЗУ жмём ОТМЕНУ установки!!! Программа должна себя ДЕИНСТАЛИРОВАТЬ!!! Либо идём в саму прогу и жмем uniinstal.
2) Идём сюда http://www.fayloobmennik.net/1557320 и качаем этот самый файл postgresql.conf
3) Копируем этот файл в C:\Program Files\PostgreSQL\9.1\data
4) Теперь САМОЕ ИНТЕРЕСНОЕ — удаляем ПАПКУ (data)
5) Снова запускаем установку PostgreSQL и как только вы прошли ввод ПАРОЛЯ открываем содержимое КОРЗИНЫ, находим нашу папку (data) жмём правую кнопку мышки, выбираем (ВОССТАНОВИТЬ) и возвращаемся к установке PostgreSQL жмём далее и т.д
ВСЁ!!! У ВАС РАБОЧАЯ ПОСТРИГА!!!
ВСЕМ, НЕРВЫ ПОТРЕПАВШИМ ПОСВЕЩАЕТСЯ )))

Понравилась статья? Поделить с друзьями:
  • Postgresql ошибка 28p01
  • Postcard коды ошибок
  • Postgresql обработка ошибок внутри запроса
  • Postal 3 ошибка при запуске приложения 0xc0000142
  • Postal 2 ошибка при запуске 0xc000007b