每次我重新启动我的 Kali 机器时,我的 postgresql 服务都无法正常启动。有一段时间我不知道它是什么,但我很快发现这个目录和文件一直被删除。
/var/run/postgresql/10-main.pg_stat_tmp/global.stat
跑完之后,
mkdir /var/run/postgresql/10-main.pg_stat_tmp
touch global.stat
我现在可以成功启动服务了。
但是,这是我的 postgresql.log 的输出。
2018-01-29 16:46:03.278 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.289 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.299 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.310 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.322 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.333 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:03.343 UTC [1890] LOG: using stale statistics instead of
current ones because stats collector is not responding
2018-01-29 16:46:03.343 UTC [1890] WARNING: corrupted statistics file
"/var/run/postgresql/10-main.pg_stat_tmp/global.stat"
2018-01-29 16:46:35.896 UTC [1885] LOG: received smart shutdown request
2018-01-29 16:46:38.988 UTC [1885] LOG: worker process: logical replication
launcher (PID 1892) exited with exit code 1
2018-01-29 16:46:38.990 UTC [1887] LOG: shutting down
2018-01-29 16:46:39.125 UTC [1885] LOG: database system is shut down
这就是 postgresql.conf 里面的内容
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
data_directory = '/var/lib/postgresql/10/main' # use data in another
directory
# (change requires restart)
hba_file = '/etc/postgresql/10/main/pg_hba.conf' # host-based
authentication file
# (change requires restart)
ident_file = '/etc/postgresql/10/main/pg_ident.conf' # ident
configuration file
# (change requires restart)
这是 Postgres 版本 10。
在 VMware 上运行的 Linux Kali 4.14.0-kali3-686-pae (2018-01-25) i686 GNU/Linux
/var/run
是指向 的符号链接/run
。你可以通过运行看到这一点ls -l
。您还可以将 Postgresql 服务设置为依赖于另一个目录,您可以在其中存储它所依赖的文件。
这是我想出的解决方案。
其次是
当我重新启动我的电脑时,一切都很好,准备好了!
您似乎已经下载了 2018-01-25,这是用于测试发行版本身的 Kali的潜在不稳定版本。
扔掉那个版本,从https://www.kali.org/downloads/官方发布的下载页面获取一份副本。