You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sudo -u postgres psql -p 5433 works, so database is up and responsive.
Log from sudo PGPORT=5433 msfdb reinit:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Starting database
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[i] Database already stopped
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Starting database
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Creating database user 'msf'
Error: PostgreSQL version 13 is not installed
[+] Creating databases 'msf'
Error: PostgreSQL version 13 is not installed
[+] Creating databases 'msf_test'
Error: PostgreSQL version 13 is not installed
[+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[+] Creating initial database schema
rake aborted!
ActiveRecord::NoDatabaseError: connection to server at "127.0.0.1", port 5433 failed: FATAL: password authentication failed for user "msf"
connection to server at "127.0.0.1", port 5433 failed: FATAL: password authentication failed for user "msf"
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql_adapter.rb:81:in `rescue in new_client'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_handling.rb:283:in `connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/railties/databases.rake:90:in `each'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Caused by:
PG::ConnectionBad: connection to server at "127.0.0.1", port 5433 failed: FATAL: password authentication failed for user "msf"
connection to server at "127.0.0.1", port 5433 failed: FATAL: password authentication failed for user "msf"
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:609:in `async_connect_or_reset'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:761:in `connect_internal'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:737:in `block (2 levels) in connect_to_hosts'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:735:in `each'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:735:in `block in connect_to_hosts'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:721:in `each'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:721:in `each_with_index'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:721:in `connect_to_hosts'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg/connection.rb:672:in `new'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/pg-1.4.3/lib/pg.rb:69:in `connect'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/connection_handling.rb:283:in `connection'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/railties/databases.rake:90:in `each'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.6.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Because WSL2 does not boot linux with systemd as init system some of the Errors above are to be expected.
This is what a successful run looks like, with the database running on port 5432. sudo PGPORT=5432 msfdb reinit:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Starting database
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[i] Database already stopped
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Starting database
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
[+] Creating database user 'msf'
[+] Creating databases 'msf'
[+] Creating databases 'msf_test'
[+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[+] Creating initial database schema
msf6 > db_status
[*] Connected to msf. Connection type: postgresql.
The text was updated successfully, but these errors were encountered:
@adfoster-r7 my bad, I mistyped the command in my issue, it should have been sudo PGPORT=5433 msfdb reinit in the first place. I also tried sudo bash -c 'export PGPORT=5433; msfdb reinit' and that caused the same error.
This issue has been left open with no activity for a while now.
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
It’s been 60 days since anything happened on this issue, so we are going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
Steps to reproduce
How'd you do it?
sudo msfdb delete
)port = 5433
in/etc/postgresl/14/main/postgresql.conf
sudo service postgresql restart
sudo PGPORT=5433 msfdb reinit
Expected behavior
What should happen?
The database should be configured.
Current behavior
What happens instead?
msfdb cannot connect to the database.
Metasploit version
Framework Version: 6.2.15-dev
Additional Information
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2022.3
Codename: kali-rolling
WSL2 VM in Windows 11
PostgreSQL: psql (PostgreSQL) 14.5 (Debian 14.5-1)
sudo -u postgres psql -p 5433
works, so database is up and responsive.Log from
sudo PGPORT=5433 msfdb reinit
:Because WSL2 does not boot linux with systemd as init system some of the Errors above are to be expected.
This is what a successful run looks like, with the database running on port 5432.
sudo PGPORT=5432 msfdb reinit
:The text was updated successfully, but these errors were encountered: