I tried to install metasploit on a raspberry pi 3b, Raspbian release 2019-04-08, kernel 4.19.42-v7+ and all updates installed.
Do the bundle install
Bundle installation fails:
pi@syst01:/opt/metasploit-framework $ bundle install
Fetching gem metadata from https://rubygems.org/..............
Using rake 12.3.2
Following files may not be writable, so sudo is needed:
/usr/local/bin
/var/lib/gems/2.3.0
/var/lib/gems/2.3.0/build_info
/var/lib/gems/2.3.0/cache
/var/lib/gems/2.3.0/doc
/var/lib/gems/2.3.0/extensions
/var/lib/gems/2.3.0/gems
/var/lib/gems/2.3.0/specifications
Using Ascii85 1.0.3
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.11.1
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 4.2.11.1
Using rack 1.6.11
Using rack-test 0.6.3
Using actionpack 4.2.11.1
Using activemodel 4.2.11.1
Using arel 6.0.4
Using activerecord 4.2.11.1
Using public_suffix 3.1.0
Using addressable 2.6.0
Using afm 0.2.2
Using arel-helpers 2.8.0
Using backports 3.15.0
Fetching bcrypt 3.1.13
Installing bcrypt 3.1.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20190610-1459-18bu3bvbcrypt-3.1.13/gems/bcrypt-3.1.13/ext/mri
/usr/bin/ruby2.3 -r ./siteconf20190610-1459-18dwrkq.rb extconf.rb
creating Makefile
current directory: /tmp/bundler20190610-1459-18bu3bvbcrypt-3.1.13/gems/bcrypt-3.1.13/ext/mri
make "DESTDIR=" clean
current directory: /tmp/bundler20190610-1459-18bu3bvbcrypt-3.1.13/gems/bcrypt-3.1.13/ext/mri
make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
gcc -D__SKIP_GNU -Wdate-time -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -c -o x86.o x86.S
x86.S: Assembler messages:
x86.S:202: Error: junk at end of line, first unrecognized character is `,'
make: * [x86.o] Fehler 1
make failed, exit code 2
Gem files will remain installed in /tmp/bundler20190610-1459-18bu3bvbcrypt-3.1.13/gems/bcrypt-3.1.13 for inspection.
Results logged to /tmp/bundler20190610-1459-18bu3bvbcrypt-3.1.13/extensions/arm-linux/2.3.0/bcrypt-3.1.13/gem_make.out
An error occurred while installing bcrypt (3.1.13), and Bundler cannot continue.
Make sure that gem install bcrypt -v '3.1.13' --source 'https://rubygems.org/' succeeds before bundling.
In Gemfile:
metasploit-framework was resolved to 5.0.29, which depends on
bcrypt
pi@syst01:
and also the separated bcrypt installation fails:
pi@syst01:/opt/metasploit-framework $ sudo gem install bcrypt -v '3.1.13' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR: Error installing bcrypt:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/bcrypt-3.1.13/ext/mri
/usr/bin/ruby2.3 -r ./siteconf20190610-1569-tlxzky.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/bcrypt-3.1.13/ext/mri
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/bcrypt-3.1.13/ext/mri
make "DESTDIR="
compiling bcrypt_ext.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
gcc -D__SKIP_GNU -Wdate-time -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -c -o x86.o x86.S
x86.S: Assembler messages:
x86.S:202: Error: junk at end of line, first unrecognized character is `,'
make: * [x86.o] Fehler 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/bcrypt-3.1.13 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/arm-linux/2.3.0/bcrypt-3.1.13/gem_make.out
pi@syst01:
git clone https://github.com/rapid7/metasploit-framework.git
Linux syst01 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux
Any ideas?
Any ideas?
Looks like bcrypt is trying to build as x86, which is not likely to end well.
Some googling reveals you may be able to get by with OS packages bcrypt-ruby, libgmp-dev and build-essential... maybe.
Also, you're probably in for a rough time with Ruby 2.3.x.
See here for how we handle the workarounds for upstream:
https://github.com/rapid7/metasploit-omnibus/blob/master/config/software/metasploit-framework.rb#L84
The solution was:
And actually it works ...... maybe the bcrypt (3.1.13) only works for x86 at the moment, not for arm
Ran into the same problem when installing OpenProject (branch stable/10) on a Raspberry Pi on Buster. Same fix (using v3.1.12) bypassed the problem.
Isn't it Gemfile, not Gemfile.lock where you downgrade from bcrypt 3.1.13 to 3.1.12?
To compile bcrypt 3.1.13 I succeeded with:
In /var/lib/gems/2.5.0/gems/bcrypt-3.1.13/ext/mri/x86.S line 202, change "@" to "%":
-.section .note.GNU-stack,"",@progbits
+.section .note.GNU-stack,"",%progbits
"%" is said to somehow be more universal and while it doesn't cause problems on x86, it does on arm due to what a quick duckduckgo showed.
With that change, I can compile bcrypt 3.1.13.
Most helpful comment
The solution was:
And actually it works ...... maybe the bcrypt (3.1.13) only works for x86 at the moment, not for arm