Postgres 没有这样的接口 'org.freedesktop.DBus.Properties'

Dom*_* M. 6 postgresql ubuntu

Postgres 数据库在重启后崩溃,尝试了几乎所有的方法,包括重新安装 postgres。它不会在 ubuntu 14.04 上启动,

$ systemctl status postgresql@9.6-main.service

Failed to issue method call: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/systemd1/unit/postgresql_409_2e6_2dmain_2eservice
Run Code Online (Sandbox Code Playgroud)

$ pg_lsclusters

Ver Cluster Port Status Owner    Data directory               Log file
9.6 main    5432 down   postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
Run Code Online (Sandbox Code Playgroud)

$ sudo 服务 postgresql 启动

* Starting PostgreSQL 9.6 database server                                                                                                                                  
* Failed to issue method call: Unit postgresql@9.6-main.service failed to 
load: No such file or directory. See system logs and 'systemctl status 
postgresql@9.6-main.service' for details.
Run Code Online (Sandbox Code Playgroud)

$ ps uxa|grep dbus 守护进程

message+   751  0.0  0.0  40812  4064 ?        Ss   18:39   0:03 dbus-daemon --system --fork
dominic   3058  0.0  0.0  40840  4252 ?        Ss   18:40   0:02 dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-S1LhlCDwl2
dominic   3145  0.0  0.0  39400  3536 ?        S    18:40   0:00 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
dominic  17462  0.0  0.0  15956  2244 pts/4    S+   21:45   0:00 grep --color=auto dbus-daemon
Run Code Online (Sandbox Code Playgroud)

Postgres 日志文件为空。

Gri*_*y K 12

在 Ubuntu 14.04 上安装 snap 后,我遇到了同样的错误。它是从 systemd 安装一些部分并破坏了 postgresql init 脚本。

您需要--skip-systemctl-redirect在文件中向 pg_ctlcluster添加参数/usr/share/postgresql-common/init.d-functions

您需要更改的功能:

    do_ctl_all() {
      ...
      # --skip-systemctl-redirect fix postgresql No such interface 'org.freedesktop.DBus.Properties'
      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
      ...
    }
Run Code Online (Sandbox Code Playgroud)

  • 救命的答案就在这里,我需要花费无限的时间才能弄清楚(完全相同的问题:我安装了 snap,但没有意识到它破坏了 postgres init 脚本)谢谢! (4认同)

Ole*_*huk 1

Ubuntu 14.04 还没有切换到systemd。我强烈建议升级到16.04甚至更好,18.04.