Я выполняю эту команду для установки postgesql в моем Ubuntu. 14.04
sudo apt-get install postgresql postgresql-contrib
Я получаю ошибку во время установки:
Failed to issue method call: Unit postgresql@10-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@10-main.service' for details
Вот полные журналы:
Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
en_us
Removing obsolete dictionary files:
* No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postgresql-10 (10.1-1.pgdg14.04+1) ...
Creating new PostgreSQL cluster 10/main ...
/usr/lib/postgresql/10/bin/initdb -D /var/lib/postgresql/10/main --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_IN".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/10/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
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:
/usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
update-alternatives: using /usr/share/postgresql/10/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
* Starting PostgreSQL 10 database server * Failed to issue method call: Unit postgresql@10-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@10-main.service' for details.
[fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-10 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql:
postgresql depends on postgresql-10; however:
Package postgresql-10 is not configured yet.
dpkg: error processing package postgresql (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-contrib:
postgresql-contrib depends on postgresql-contrib-10; however:
Package postgresql-contrib-10 is not installed.
Package postgresql-10 which provides postgresql-contrib-10 is not configured yet.
dpkg: error processing package postgresql-contrib (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
postgresql-10
postgresql
postgresql-contrib
это вывод systemctl status postgresql@10-main.service
ajit@AjitSoman:~$ systemctl status postgresql@10-main.service
Failed to issue method call: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/systemd1/unit/postgresql_4010_2dmain_2eservice
Принятый ответ в postgresql-fail-to-re -stall-after-upgrade-ubuntu-12-04-to-14-04 работал для меня.
Для удобства я вставляю инструкции по этой ссылке ниже:
Проверяем файл
Файл/etc/init.d/postgresql
, который он использует/usr/share/postgresql-common/init.d-functions
. Этот файл выполняет/usr/bin/pg_ctlcluster
для запуска и остановки сервера postgresql.
if [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
ERRMSG=$(pg_ctlcluster --force "$2" "$name" $1 2>&1)
else
ERRMSG=$(pg_ctlcluster "$2" "$name" $1 2>&1)
fi
/usr/bin/pg_ctlcluster
принимает опцию--skip-systemctl-redirect
для запуска или остановки postgresql без systemctl. Поэтому вам нужно добавить функцию--skip-systemctl-redirect
в/usr/share/postgresql-common/init.d-functions
вdo_ctl_all()
. Так это будет выглядеть так.
if [ "$1" = "stop" ] || [ "$1" = "restart" ]; then
ERRMSG=$(pg_ctlcluster --skip-systemctl-redirect --force "$2" "$name" $1 2>&1)
else
ERRMSG=$(pg_ctlcluster --skip-systemctl-redirect "$2" "$name" $1 2>&1)
fi
Или вы можете добавить
$skip_systemctl_redirect = 1;
до того, как$skip_systemctl_redirect
будет проверено в/usr/bin/pg_ctlcluster
.