Bug 53387 - Не разворачивается с postgresql
Summary: Не разворачивается с postgresql
Status: CLOSED NOTABUG
Alias: None
Product: Sisyphus
Classification: Development
Component: bacula15 (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Alexei Takaseev
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-10 18:40 MSK by Artem Varaksa
Modified: 2025-03-10 18:58 MSK (History)
1 user (show)

See Also:


Attachments
bacula15 + postgres14 (sisyphus) (22.88 KB, text/plain)
2025-03-10 18:40 MSK, Artem Varaksa
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Artem Varaksa 2025-03-10 18:40:56 MSK
Created attachment 17947 [details]
bacula15 + postgres14 (sisyphus)

Проверялось с postgresql 14, 15, 17.

С bacula 13 (p10, p11) + postgres 14 данные шаги работают, сервисы запускаются.

Шаги
====

> # export BACULA=15 POSTGRESQL=17
> # apt-get install -y mt-st postgresql$POSTGRESQL-server bacula$BACULA-{common,console,storage,client,director-{common,postgresql}}
> # /etc/init.d/postgresql initdb
> # echo "listen_addresses = 'localhost'" >> /var/lib/pgsql/data/postgresql.conf
> # systemctl enable --now postgresql
> # sleep 5
> # sed 's/^db_password=.*/db_password=sqlpass/' -i /usr/share/bacula/scripts/grant_postgresql_privileges
> # createuser -U postgres --superuser root -P
> # /usr/share/bacula/scripts/create_bacula_database
> # /usr/share/bacula/scripts/make_bacula_tables
> # /usr/share/bacula/scripts/grant_bacula_privileges
> # sed -i "s/password = \"Specify password for catalog here\"/password = \"sqlpass\"/" /etc/bacula/bacula-dir.conf
> # echo "Password = \"dirpass\"" > /etc/bacula/bacula-dir-password.conf
> # echo "Password = \"fdpass\"" > /etc/bacula/bacula-fd-password.conf
> # echo "Password = \"sdpass\"" > /etc/bacula/bacula-sd-password.conf
> # mkdir /srv/backup
> # chown bacula:bacula /srv/backup
> # sed -i "s/Address = 127.0.0.1/Address = $(hostname -i)/" /etc/bacula/storage.d/file.conf
> # systemctl enable --now bacula-dir.service
> # systemctl enable --now bacula-sd.service
> # systemctl enable --now bacula-fd.service

Одной строкой для удобства проверки:

> # export BACULA=15 POSTGRESQL=14 && apt-get install -y mt-st postgresql$POSTGRESQL-server bacula$BACULA-{common,console,storage,client,director-{common,postgresql}} && /etc/init.d/postgresql initdb && echo "listen_addresses = 'localhost'" >> /var/lib/pgsql/data/postgresql.conf && systemctl enable --now postgresql && sleep 5 && sed 's/^db_password=.*/db_password=sqlpass/' -i /usr/share/bacula/scripts/grant_postgresql_privileges && createuser -U postgres --superuser root -P && /usr/share/bacula/scripts/create_bacula_database && sleep 5 && /usr/share/bacula/scripts/make_bacula_tables && /usr/share/bacula/scripts/grant_bacula_privileges && sed -i "s/password = \"Specify password for catalog here\"/password = \"sqlpass\"/" /etc/bacula/bacula-dir.conf && echo "Password = \"dirpass\"" > /etc/bacula/bacula-dir-password.conf && echo "Password = \"fdpass\"" > /etc/bacula/bacula-fd-password.conf && echo "Password = \"sdpass\"" > /etc/bacula/bacula-sd-password.conf && mkdir /srv/backup && chown bacula:bacula /srv/backup && sed -i "s/Address = 127.0.0.1/Address = $(hostname -i)/" /etc/bacula/storage.d/file.conf && systemctl enable --now bacula-dir.service && systemctl enable --now bacula-sd.service && systemctl enable --now bacula-fd.service

(Примечание: в p10 данная команда завершает работу после неуспешного `systemctl enable --now bacula-dir.service`.)

Фактический результат
=====================

При выполнении `make_bacula_tables`, `grant_bacula_privileges` выводится (полный вывод см. в прикрепленном файле):

> Making postgresql tables
> Пароль пользователя postgres:
> BEGIN
> CREATE TABLE
> CREATE INDEX
>
> ...
>
> psql:<stdin>:73: OSHIBKA:  ne udalos` otkry`t` upravlyayushhij fajl rasshireniya "/usr/share/pgsql/extension/pg_trgm.control": Net takogo fajla ili kataloga
> КОНТЕКСТ:  SQL-operator: "CREATE EXTENSION pg_trgm"
> funkcziya PL/pgSQL inline_code_block, stroka 11, operator SQL-operator
> psql:<stdin>:75: OSHIBKA:  tekushhaya tranzakcziya prervana, komandy` do koncza bloka tranzakczii ignoriruyutsya
>
> ...
>
> ROLLBACK
> Creation of Bacula PostgreSQL tables succeeded.

> Granting postgresql privileges
> Пароль пользователя postgres:
> CREATE ROLE
> ALTER DATABASE
> GRANT
> psql:<stdin>:9: OSHIBKA:  otnoshenie "malwaremd5" ne sushhestvuet
>
> ...
>
> Privileges for user bacula granted on database bacula.

Сервис bacula-dir не запускается:

> Job for bacula-dir.service failed because the control process exited with error code.
> See "systemctl status bacula-dir.service" and "journalctl -xeu bacula-dir.service" for details.

> systemd[1]: Starting bacula-dir.service - Bacula-Director, the Backup-server...
> bacula-dir[12425]: bacula-dir: dird.c:1540-0 Could not open Catalog "MyCatalog", database "bacula".
> bacula-dir[12425]: bacula-dir: dird.c:1546-0 Query failed: SELECT VersionId FROM Version: ERR=OSHIBKA:  otnoshenie "version" ne sushhestvuet
> bacula-dir[12425]: СТРОКА 1: SELECT VersionId FROM Version
> bacula-dir[12425]:                                       ^
> bacula-dir[12425]: 10-мар 16:54 bacula-dir ERROR TERMINATION
> bacula-dir[12425]: Please correct configuration file: /etc/bacula/bacula-dir.conf
> systemd[1]: bacula-dir.service: Control process exited, code=exited, status=1/FAILURE
> systemd[1]: bacula-dir.service: Failed with result 'exit-code'.
> systemd[1]: Failed to start bacula-dir.service - Bacula-Director, the Backup-server.

Ожидаемый результат
===================

Отсутствие ошибок postgresql. Успешный запуск сервиса bacula-dir.

Дополнительно
=============

# cat /etc/bacula/bacula-dir.conf

> Director {                            # define myself
>   Name = dir
>   DIRport = 9101                # where we listen for UA connections
>   QueryFile = "/usr/share/bacula/scripts/query.sql"
>   WorkingDirectory = "/var/lib/bacula"
>   PidDirectory = "/var/run/bacula"
>   Maximum Concurrent Jobs = 1
> @/etc/bacula/bacula-dir-password.conf
>   Messages = Daemon
> }
>
> # Generic catalog service
> Catalog {
>   Name = MyCatalog
>   dbname = bacula
>   user = bacula
>   password = "sqlpass"
> }
>
> #
> # Restricted console used by tray-monitor to get the status of the director
> #
> #Console {
> #  Name = localhost-mon
> #  Password = "Specify restricted console password here"
> #  CommandACL = status, .status
> #}
>
> # Jobs
> @|"sh -c 'for f in /etc/bacula/job.d/*.conf ; do echo @${f} ; done'"
>
> # File Sets
> @|"sh -c 'for f in /etc/bacula/fileset.d/*.conf ; do echo @${f} ; done'"
>
> # Schedules
> @|"sh -c 'for f in /etc/bacula/schedule.d/*.conf ; do echo @${f} ; done'"
>
> # Clients
> @|"sh -c 'for f in /etc/bacula/client.d/*.conf ; do echo @${f} ; done'"
>
> # Storages
> @|"sh -c 'for f in /etc/bacula/storage.d/*.conf ; do echo @${f} ; done'"
>
> # Messages
> @|"sh -c 'for f in /etc/bacula/messages.d/*.conf ; do echo @${f} ; done'"
>
> # Pools
> @|"sh -c 'for f in /etc/bacula/pool.d/*.conf ; do echo @${f} ; done'"

Воспроизводимость
=================

Воспроизводится на виртуальных машинах:

[p11+375453] [sisyphus] ALT Server 11.0 beta20250213 x86_64
bacula15-common-15.0.2-alt2.x86_64
postgresql17-server-17.4-alt1.x86_64
postgresql15-server-15.12-alt1.x86_64
postgresql14-server-14.17-alt1.x86_64

[p10+375490] ALT Server 10.4 x86_64
bacula15-common-15.0.2-alt2.x86_64
postgresql17-server-17.4-alt0.p10.1.x86_64
postgresql15-server-15.12-alt0.p10.1.x86_64
postgresql14-server-14.17-alt0.p10.1.x86_64


Не воспроизводится на виртуальных машинах:

[p11] ALT Server 11.0 beta20250213 x86_64
bacula13-common-13.0.4-alt2.x86_64
postgresql14-server-14.17-alt1.x86_64

[p10] ALT Server 10.4 x86_64
bacula13-common-13.0.4-alt2.x86_64
postgresql14-server-14.17-alt0.p10.1.x86_64
Comment 1 Alexei Takaseev 2025-03-10 18:58:12 MSK
> psql:<stdin>:73: OSHIBKA:  ne udalos` otkry`t` upravlyayushhij fajl rasshireniya "/usr/share/pgsql/extension/pg_trgm.control": Net takogo fajla ili kataloga
> КОНТЕКСТ:  SQL-operator: "CREATE EXTENSION pg_trgm"
> funkcziya PL/pgSQL inline_code_block, stroka 11, operator SQL-operator
> psql:<stdin>:75: OSHIBKA:  tekushhaya tranzakcziya prervana, komandy` do koncza bloka tranzakczii ignoriruyutsya

bacula 15 использует серверное расширение постгреса pg_trgm, входящего в пакет postgresqlXY-contrib, требуется достуновка пакета