启动msfconsole报错Unable to find a spec satisfying metasploit-framework (>= 0) in the set. Perhaps the lockfile is corrupted?

在Kali上启动msfconsole,报错:

WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      io-console (~> 0.5)
      Available/installed versions of this gem:
      - 0.5.9
      - 0.5.6
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
Unable to find a spec satisfying metasploit-framework (>= 0) in the set. Perhaps the lockfile is corrupted?
Run `bundle install` to install missing gems.

上网一搜

gem update --system

无效,然后我留意前面报错的提示语Perhaps the lockfile is corrupted?,再结合我之前的文章

cd /usr/share/metasploit-framework/
cat Gemfile.lock |grep -A 1 "BUNDLED"

得到

BUNDLED WITH
   2.2.5

gem list |grep bundle

得到

bundler (2.1.4)

所以尝试更新下bundler的版本

gem install bundler -v 2.2.5

再次运行msfconsole发现可行。