MSF更新之后无法启动问题

发布于 2021-02-03  1206 次阅读


《随笔》目录

今天在更新msf的时候出现了一个从未遇到过的问题,如下:

root@kali:~# msfconsole -v
Unable to find a spec satisfying metasploit-framework (>= 0) in the set. Perhaps the lockfile is corrupted?                                                                                               
Run `bundle install` to install missing gems.

百度无果之后自己尝试解决这个问题,先是换源更新软件,失败;后是卸载之后重新安装,失败;最后自己尝试更新了相关的ruby、bundle等配置文件,最后成功。

1.按照提示输入bundle install

root@kali:~# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.                             
Could not locate Gemfile

2.根据提示发现是定位不到Gemfile这个文件,gem与ruby有关,查看ruby版本

root@kali:~# ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux-gnu]

3.尝试更新ruby

root@kali:/usr/share/metasploit-framework# sudo apt-get install libruby2.7 ruby2.7-dev ruby2.7
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
libruby2.7 已经是最新版 (2.7.2-3)。
libruby2.7 已设置为手动安装。
ruby2.7 已经是最新版 (2.7.2-3)。
ruby2.7 已设置为手动安装。
下列软件包是自动安装的并且现在不需要了:
  ettercap-common ettercap-graphical libapache2-mod-php libluajit-5.1-2 libluajit-5.1-common nginx
  python-crypto python-paramiko python-pefile python-qrcode
使用'sudo apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
  ruby2.7-doc
下列【新】软件包将被安装:
  ruby2.7-dev ruby2.7-doc
..............................................................

4.再次尝试bundle install命令,还是无果

root@kali:/usr/share/metasploit-framework# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.                             
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.5). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.2.5`.                                                                                        
The dependency metasploit-framework (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86_64-linux but the dependency is only for ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, . To add those platforms to the bundle, run `bundle lock --add-platform ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby `.          
Unable to find a spec satisfying metasploit-framework (>= 0) in the set. Perhaps the lockfile is
corrupted?

5.根据提示尝试输入bundle lock命令

root@kali:/usr/share/metasploit-framework# bundle lock
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.5). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.2.5`.                                                                                        
The dependency metasploit-framework (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86_64-linux but the dependency is only for ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, ruby, . To add those platforms to the bundle, run `bundle lock --add-platform ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby ruby `.          
Unable to find a spec satisfying metasploit-framework (>= 0) in the set. Perhaps the lockfile is
corrupted?

6.根据提示安装bundle

root@kali:/usr/share/metasploit-framework# gem install bundler:2.2.5
Fetching bundler-2.2.5.gem
Successfully installed bundler-2.2.5
Parsing documentation for bundler-2.2.5
Installing ri documentation for bundler-2.2.5
Done installing documentation for bundler after 4 seconds
1 gem installed
root@kali:/usr/share/metasploit-framework# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.                             
Using rake 13.0.3
Using Ascii85 1.1.0
Using concurrent-ruby 1.0.5
Using i18n 1.8.7
......................................................
......................................................略
......................................................
Using simplecov-html 0.12.3
Using simplecov 0.18.2
Bundle complete! 17 Gemfile dependencies, 163 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into `./vendor/bundle`

7.msf成功开启!!!

root@kali:/usr/share/metasploit-framework# msfconsole
                                                  
                                   ___          ____
                               ,-""   `.      < HONK >
                             ,'  _   e )`-._ /  ----                                                 
                            /  ,' `-._<.===-'                                                        
                           /  /                                                                      
                          /  ;                                                                       
              _          /   ;                                                                       
 (`._    _.-"" ""--..__,'    |                                                                       
 <_  `-""                     \                                                                      
  <`-                          :                                                                     
   (__   <__.                  ;                                                                     
     `-.   '-.__.      _.'    /                                                                      
        \      `-.__,-'    _,'                                                                       
         `._    ,    /__,-'                                                                          
            ""._\__,'< <____                                                                         
                 | |  `----.`.                                                                       
                 | |        \ `.                                                                     
                 ; |___      \-``                                                                    
                 \   --<                                                                             
                  `.`.<                                                                              
                    `-'                                                                              
                                                                                                     
                                                                                                     

       =[ metasploit v6.0.28-dev                          ]
+ -- --=[ 2097 exploits - 1128 auxiliary - 356 post       ]
+ -- --=[ 592 payloads - 45 encoders - 10 nops            ]
+ -- --=[ 7 evasion                                       ]

Metasploit tip: Writing a custom module? After editing your 
module, why not try the reload command

msf6 >

注:本文仅是笔者自己尝试解决msf更新之后无法启动问题的一个流程,并非标准解决方案,仅供参考。


人生就像赛跑,不在乎你是否第一个到达终点,而在乎你是否跑完全程。