Jackson123
@Jackson123

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

Posgresqlの起動時のエラーが解決できません

※Postgre初心者です。HEROKUにデプロイしていたRailsアプリをAWSに移行しようとしている時にエラーが出ました

Postgresqlの起動時にエラーが発生し、解決できません。
エラーの解決方法をご教授いただきたいです。

versionは以下になります

$ psql --version
psql (PostgreSQL) 11.5

なぜ起こったか

$ sudo amazon-linux-extras install postgresql11を実行しPostgre11をインストールした後に起こったエラーです。前は9.2以下のversionが入っていました。

起きているエラー

[ryogo@ip-10-0-0-246 travelour]$ service postgresql start
Redirecting to /bin/systemctl start postgresql.service
Failed to start postgresql.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status postgresql.service' for details.

[ryogo@ip-10-0-0-246 travelour]$ systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2021-04-22 18:22:55 UTC; 14min ago
  Process: 30910 ExecStartPre=/usr/libexec/postgresql-check-db-dir %N (code=exited, status=1/FAILURE)
 Main PID: 17793 (code=exited, status=0/SUCCESS)

関係あるかわかりませんがこちらも記載しておきます

[ryogo@ip-10-0-0-246 travelour]$ journalctl -xe
-- Logs begin at Wed 2021-04-21 14:37:58 UTC, end at Wed 2021-04-21 23:29:08 UTC. --
Apr 21 14:37:58 ip-10-0-0-246.ap-northeast-1.compute.internal sudo[15587]: pam_unix(sudo:aut
Apr 21 17:21:22 ip-10-0-0-246.ap-northeast-1.compute.internal su[18751]: pam_unix(su-l:auth)
Apr 21 17:21:25 ip-10-0-0-246.ap-northeast-1.compute.internal su[18751]: FAILED SU (to root)
Apr 21 17:21:35 ip-10-0-0-246.ap-northeast-1.compute.internal su[18752]: pam_unix(su-l:auth)
Apr 21 17:21:37 ip-10-0-0-246.ap-northeast-1.compute.internal su[18752]: FAILED SU (to root)
Apr 21 17:24:29 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: (to root) ec2-user 
Apr 21 17:24:29 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: pam_unix(su-l:sessi
Apr 21 18:19:59 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: (to ryogo) ryogo on
Apr 21 18:19:59 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: pam_unix(su-l:sessi
Apr 21 22:32:20 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: pam_unix(su-l:sessi
Apr 21 23:29:08 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: pam_unix(su-l:sessi
lines 1-12/12 (END)...skipping...
-- Logs begin at Wed 2021-04-21 14:37:58 UTC, end at Wed 2021-04-21 23:29:08 UTC. --
Apr 21 14:37:58 ip-10-0-0-246.ap-northeast-1.compute.internal sudo[15587]: pam_unix(sudo:aut
Apr 21 17:21:22 ip-10-0-0-246.ap-northeast-1.compute.internal su[18751]: pam_unix(su-l:auth)
Apr 21 17:21:25 ip-10-0-0-246.ap-northeast-1.compute.internal su[18751]: FAILED SU (to root)
Apr 21 17:21:35 ip-10-0-0-246.ap-northeast-1.compute.internal su[18752]: pam_unix(su-l:auth)
Apr 21 17:21:37 ip-10-0-0-246.ap-northeast-1.compute.internal su[18752]: FAILED SU (to root)
Apr 21 17:24:29 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: (to root) ec2-user 
Apr 21 17:24:29 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: pam_unix(su-l:sessi
Apr 21 18:19:59 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: (to ryogo) ryogo on
Apr 21 18:19:59 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: pam_unix(su-l:sessi
Apr 21 22:32:20 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: pam_unix(su-l:sessi
Apr 21 23:29:08 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: pam_unix(su-l:sessi

lines 1-12/12 (END)...skipping...
-- Logs begin at Wed 2021-04-21 14:37:58 UTC, end at Wed 2021-04-21 23:29:08 UTC. --
Apr 21 14:37:58 ip-10-0-0-246.ap-northeast-1.compute.internal sudo[15587]: pam_unix(sudo:auth): authentication failure; logname=ryogo uid=1001 euid=0 tty=/dev/pts/1 ruser=ryogo rhos
Apr 21 17:21:22 ip-10-0-0-246.ap-northeast-1.compute.internal su[18751]: pam_unix(su-l:auth): authentication failure; logname=ec2-user uid=1001 euid=0 tty=pts/0 ruser=ryogo rhost=  
Apr 21 17:21:25 ip-10-0-0-246.ap-northeast-1.compute.internal su[18751]: FAILED SU (to root) ec2-user on pts/0
Apr 21 17:21:35 ip-10-0-0-246.ap-northeast-1.compute.internal su[18752]: pam_unix(su-l:auth): authentication failure; logname=ec2-user uid=1001 euid=0 tty=pts/0 ruser=ryogo rhost=  
Apr 21 17:21:37 ip-10-0-0-246.ap-northeast-1.compute.internal su[18752]: FAILED SU (to root) ec2-user on pts/0
Apr 21 17:24:29 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: (to root) ec2-user on pts/0
Apr 21 17:24:29 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: pam_unix(su-l:session): session opened for user root by ec2-user(uid=1001)
Apr 21 18:19:59 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: (to ryogo) ryogo on pts/1
Apr 21 18:19:59 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: pam_unix(su-l:session): session opened for user ryogo by ryogo(uid=1001)
Apr 21 22:32:20 ip-10-0-0-246.ap-northeast-1.compute.internal su[18808]: pam_unix(su-l:session): session closed for user root
Apr 21 23:29:08 ip-10-0-0-246.ap-northeast-1.compute.internal su[21779]: pam_unix(su-l:session): session closed for user ryogo

以上足りない情報があればコメントいただければ幸いです

0

1Answer

確実ではありませんが、権限がなくてなにかの *.service ファイルが読み取れずにエラーになっているように思います。

試しに、サービスを起動する際に sudo で起動してみてください。

$ sudo service postgresql start
0Like

Your answer might help someone💌