Results 1 to 2 of 2

Thread: postgresql.service wont start

  1. #1
    Join Date
    2020-Jul
    Posts
    1

    postgresql.service wont start

    Im using the raspi4 with 4GB, and im stuck with this at this point.

    Thanks in advice!

    Some info about my errors:

    Code:
    root@kali:~# service postgresql status
    ● postgresql.service - PostgreSQL RDBMS
         Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
         Active: active (exited) since Sat 2020-07-04 05:55:50 UTC; 44min ago
        Process: 2172 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
        Process: 2723 ExecReload=/bin/true (code=exited, status=0/SUCCESS)
       Main PID: 2172 (code=exited, status=0/SUCCESS)
    
    Jul 04 05:55:50 kali systemd[1]: Starting PostgreSQL RDBMS...
    Jul 04 05:55:50 kali systemd[1]: Finished PostgreSQL RDBMS.
    Jul 04 06:08:01 kali systemd[1]: Reloading PostgreSQL RDBMS.
    Jul 04 06:08:01 kali systemd[1]: Reloaded PostgreSQL RDBMS.

    Code:
    msf5 > db_status [*] postgresql selected, no connection

    Code:
    root@kali:~# msfdb reinit
    [i] Database already started
    psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    [+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml
    [+] Stopping database
    [+] Starting database
    psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    [+] Creating database user 'msf'
    createuser: error: could not connect to database postgres: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    [+] Creating databases 'msf'
    createdb: error: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    [+] Creating databases 'msf_test'
    createdb: error: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    [+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
    [+] Creating initial database schema
    rake aborted!
    PG::ConnectionBad: could not connect to server: Connection refused
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
    could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/connection_handling.rb:87:in `connection'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:941:in `initialize'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:823:in `new'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:823:in `up'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/migration.rb:801:in `migrate'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/tasks/database_tasks.rb:139:in `migrate'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
    /usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
    Tasks: TOP => db:migrate
    (See full trace by running task with --trace)

    Code:
    root@kali:~# msfdb status
    ● postgresql.service - PostgreSQL RDBMS
         Loaded: loaded (/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
         Active: active (exited) since Sat 2020-07-04 06:43:49 UTC; 48s ago
        Process: 4035 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
       Main PID: 4035 (code=exited, status=0/SUCCESS)
    
    Jul 04 06:43:49 kali systemd[1]: Starting PostgreSQL RDBMS...
    Jul 04 06:43:49 kali systemd[1]: Finished PostgreSQL RDBMS.
    [i] No network service running
    [+] Detected configuration file (/usr/share/metasploit-framework/config/database.yml)

  2. #2
    Join Date
    2020-Nov
    Posts
    1
    I stumbled across this today after an update to a kali linux system on AMD hardware. For whatever reason the default port for the postgresql server was set to 5433 on my system, checked with "ss -ltp". The msfdb scripts check on port 5432 and therefore reported the network service as "not running". I changed the port for my postgresql system to 5432, restarted the database (msfdb stop, msfdb start) and then did a msfdb init. Worked like a charm afterwards.

Similar Threads

  1. Postgresql service wont start after reboot.
    By kalipi2 in forum ARM Archive
    Replies: 0
    Last Post: 2015-05-24, 09:28
  2. postgresql wont start
    By iraq0wnz in forum General Archive
    Replies: 0
    Last Post: 2013-12-05, 21:11
  3. Failed #service postgresql start
    By Castor_Troy in forum TroubleShooting Archive
    Replies: 2
    Last Post: 2013-06-25, 00:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •