msfconsole >db_status postgresql selected,no connect >msfdb init System has not been booted with systemd as init system (PID 1). Can't operate.
原理是wsl启动的时候没systemd。
解决方法
启动数据库服务
1 2 3
msfdb init sudo service postgresql start sudo service postgresql status
手动建立数据库用户,数据库
1 2 3 4 5 6 7
# cd /etc/postgresql/13/main sudo -u postgres psql alter user postgres password 'root'; create user msf with password 'metasploit' createdb; create database msf with owner=msf; quit