Closed jacargentina closed 2 years ago
I've found something lib/magic/magic.so
was not here
I've copied it manually from ext/magic/magic.so
in place, and now it works.
What could it be the problem?
Hi @jacargentina,
Sorry that you are having issues!
While I don't know much about how GitLab uses Puma, and generally don't know much about how GitLab was put together (as I don't work on the project and/or for GitLab), I can definitely have a look at my Ruby Gem.
Question: when you install ruby-magic
Gem manually (same version, of course) under the same Ruby you run GitLab on (unless it's an Omnibus installation where you need to use the bundled Ruby), does it install correctly and then works, or does it fail the same way?
Also, what Ruby version is it, how did you install it, etc? Any detail that can help me troubleshoot this (and perhaps even reproduce locally) would be helpful.
Krzysztof
Also, I would like to mention @stanhu here, as he actually works on GitLab, and perhaps would have some insight faster than me trying to reproduce this on my own.
It looks like you are installing GitLab from source, and this gem isn't properly compiled and installed. Have you tried running gem pristine ruby-magic
?
@stanhu since I've made it work by copying the .so file, I 've not done any other testing.
What I can say, is I've tried from 3 to 5 times by doing the bundle install
with a previous cleaning of the gems inside vendor/
Not sure what's going on here. I feel like if this were a systemic issue we would have seen many complaints from source installs months ago. lib/magic/magic.so
is present on every dev environment I have. I'd be curious to see the mkmf.log
if it errored out.
Hi,
@stanhu, thank you for looking into this! I appreciate it.
I can't reproduce this locally. Everything installs correctly. Thus, we need to get more details from @jacargentina about this environment, otherwise it's hard to try to reproduce what is going on.
Krzysztof
@kwilczynski I'm not a ruby / gems/ bundler expert, so I can help with some instructions
I've done this, in order to reproduce the specific ruby-magic gem installation:
bundle exec gem uninstall ruby-magic
bundle install
This re-installs ruby-magic, with its .so file not being copied where it belongs. By I can't find any mkmf.log
; there is some way to generate some logging from that last bundle install
?
Hello @jacargentina,
I sincerely apologise for a very late reply! Are you still having issues?
[...]
I've done this, in order to reproduce the specific ruby-magic gem installation:
bundle exec gem uninstall ruby-magic bundle install
This re-installs ruby-magic, with its .so file not being copied where it belongs.
I have attempted to reproduce this issue from scratch using a Debian 11 virtual machine and installing GitLab using source repository like you. I haven't actually completed an entire installation, only focusing on installing required Ruby gems. Sadly, my attempt was unsuccessful (I was unable to reproduce the issue), as per:
kwilczynski@debian11:~/gitlab-foss$ bundle exec gem info ruby-magic
*** LOCAL GEMS ***
ruby-magic (0.4.0)
Author: Krzysztof Wilczyński
Homepage: https://github.com/kwilczynski/ruby-magic
License: Apache-2.0
Installed at: /home/kwilczynski/gitlab-foss/vendor/bundle/ruby/2.7.0
File Magic in Ruby
kwilczynski@debian11:~/gitlab-foss$ ls -l /home/kwilczynski/gitlab-foss/vendor/bundle/ruby/2.7.0/gems/ruby-magic-0.4.0/lib/magic
total 160
drwxr-xr-x 2 kwilczynski kwilczynski 4096 Nov 13 03:00 core
-rwxr-xr-x 1 kwilczynski kwilczynski 154912 Nov 13 03:00 magic.so
-rw-r--r-- 1 kwilczynski kwilczynski 775 Nov 13 03:00 version.rb
kwilczynski@debian11:~/gitlab-foss$ ldd /home/kwilczynski/gitlab-foss/vendor/bundle/ruby/2.7.0/gems/ruby-magic-0.4.0/lib/magic/magic.so
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
linux-vdso.so.1 (0x00007ffc6dd99000)
libruby-2.7.so.2.7 => /lib/x86_64-linux-gnu/libruby-2.7.so.2.7 (0x00007f1c2d641000)
libmagic.so.1 => /lib/x86_64-linux-gnu/libmagic.so.1 (0x00007f1c2d616000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1c2d451000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1c2d42f000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1c2d424000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f1c2d3a3000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1c2d39b000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f1c2d360000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1c2d21c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1c2d9b4000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f1c2d209000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1c2d1ec000)
kwilczynski@debian11:~/gitlab-foss$ bundle exec gem uninstall ruby-magic
Successfully uninstalled ruby-magic-0.4.0
kwilczynski@debian11:~/gitlab-foss$ bundle exec gem info ruby-magic
Could not find ruby-magic-0.4.0 in any of the sources
Run `bundle install` to install missing gems.
kwilczynski@debian11:~/gitlab-foss$ bundle install
Fetching gem metadata from https://rubygems.org/........
Using rake 13.0.6
Using RedCloth 4.3.2
Using faraday-em_http 1.0.0
Using faraday-em_synchrony 1.0.0
Using faraday-excon 1.1.0
Using faraday-net_http 1.0.1
Using faraday-net_http_persistent 1.1.0
Using multipart-post 2.1.1
Using ruby2_keywords 0.0.4
Using faraday 1.4.2
Using acme-client 2.0.6
Using concurrent-ruby 1.1.9
Using i18n 1.8.10
Using minitest 5.11.3
Using tzinfo 2.0.4
Using zeitwerk 2.4.2
Using activesupport 6.1.4.1
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.5.3
Using racc 1.5.2
Using nokogiri 1.11.7 (x86_64-linux)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.12.0
Using rails-html-sanitizer 1.4.2
Using actionview 6.1.4.1
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.1.4.1
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 6.1.4.1
Using globalid 0.5.2
Using activejob 6.1.4.1
Using activemodel 6.1.4.1
Using activerecord 6.1.4.1
Using marcel 1.0.1
Using mini_mime 1.1.1
Using activestorage 6.1.4.1
Using mail 2.7.1
Using actionmailbox 6.1.4.1
Using actionmailer 6.1.4.1
Using actiontext 6.1.4.1
Using pg 1.2.3
Using activerecord-explain-analyze 0.1.0
Using acts-as-taggable-on 7.0.0
Using public_suffix 4.0.6
Using addressable 2.8.0
Using aes_key_wrap 1.1.0
Using akismet 3.0.0
Using android_key_attestation 0.3.0
Using graphql 1.11.8
Using apollo_upload_server 2.1.0
Using faraday_middleware 1.0.0
Using multi_json 1.14.1
Using faraday_middleware-multi_json 0.0.6
Using jwt 2.1.0
Using multi_xml 0.6.0
Using oauth2 1.4.7
Using asana 0.10.3
Using asciidoctor 2.0.15
Using asciidoctor-include-ext 0.3.1
Using asciidoctor-kroki 0.5.0
Using asciidoctor-plantuml 0.0.12
Using atlassian-jwt 0.2.0
Using encryptor 3.0.0
Using attr_encrypted 3.1.0
Using attr_required 1.0.1
Using execjs 2.8.1
Using autoprefixer-rails 10.2.5.1
Using awrence 1.1.1
Using aws-eventstream 1.1.0
Using aws-partitions 1.345.0
Using aws-sigv4 1.2.1
Using jmespath 1.4.0
Using aws-sdk-core 3.104.3
Using aws-sdk-cloudformation 1.41.0
Using aws-sdk-kms 1.36.0
Using aws-sdk-s3 1.75.0
Using connection_pool 2.2.2
Using net-http-persistent 4.0.1
Using azure-storage-common 2.0.2
Using azure-storage-blob 2.0.1
Using babosa 1.0.4
Using base32 0.3.2
Using batch-loader 2.0.1
Using bcrypt 3.1.16
Using bcrypt_pbkdf 1.0.0
Using memory_profiler 0.9.14
Using benchmark-memory 0.1.2
Using bindata 2.4.10
Using msgpack 1.3.3
Using bootsnap 1.9.1
Using bootstrap_form 4.2.0
Using browser 4.2.0
Using bundler 2.1.4
Using mime-types-data 3.2020.0512
Using mime-types 3.3.1
Using ssrf_filter 1.0.7
Using carrierwave 1.3.2
Using cbor 0.5.9.6
Using rbtree 0.4.4
Using set 1.0.1
Using sorted_set 1.0.3
Using character_set 1.4.1
Using charlock_holmes 0.7.7
Using chef-utils 16.10.17
Using fuzzyurl 0.9.0
Using tomlrb 1.3.0
Using mixlib-config 3.0.9
Using mixlib-shellout 3.2.5
Using chef-config 16.10.17
Using chunky_png 1.3.5
Using citrus 3.0.2
Using claide 1.0.3
Using colored2 3.1.2
Using cork 0.3.0
Using nap 1.1.0
Using open4 1.3.4
Using claide-plugins 0.9.2
Using commonmarker 0.23.2
Using contracts 0.11.0
Using openssl-signature_algorithm 0.4.0
Using cose 1.0.0
Using i18n_data 0.8.0
Using sixarm_ruby_unaccent 1.2.0
Using unicode_utils 1.4.0
Using countries 3.0.0
Using safe_yaml 1.0.4
Using crack 0.4.3
Using creole 0.5.0
Using css_parser 1.7.0
Using faraday-http-cache 2.2.0
Using rchardet 1.8.0
Using git 1.7.0
Using rexml 3.2.5
Using kramdown 2.3.1
Using kramdown-parser-gfm 1.1.0
Using no_proxy_fix 0.1.2
Using sawyer 0.8.2
Using octokit 4.20.0
Using unicode-display_width 1.7.0
Using terminal-table 1.8.0
Using danger 8.4.1
Using httparty 0.16.4
Using gitlab 4.16.1
Using danger-gitlab 8.0.0
Using html-pipeline 2.13.2
Using deckar01-task_list 2.3.1
Using declarative 0.0.20
Using declarative-option 0.1.0
Using declarative_policy 1.1.0
Using default_value_for 3.4.0
Using device_detector 1.0.0
Using orm_adapter 0.5.0
Using method_source 1.0.0
Using thor 1.1.0
Using railties 6.1.4.1
Using responders 3.0.0
Using warden 1.2.8
Using devise 4.7.3
Using rotp 6.2.0
Using devise-two-factor 4.0.0
Using diff_match_patch 0.1.0
Using diffy 3.3.0
Using http-accept 1.7.0
Using unf_ext 0.0.7.7
Using unf 0.1.4
Using domain_name 0.5.20190701
Using http-cookie 1.0.3
Using netrc 0.11.0
Using rest-client 2.1.0
Using discordrb-webhooks 3.4.2
Using docile 1.3.2
Using doorkeeper 5.5.0.rc2
Using json-jwt 1.13.0
Using doorkeeper-openid_connect 1.7.5
Using dotenv 2.7.6
Using dry-core 0.5.0
Using dry-configurable 0.12.0
Using dry-container 0.7.2
Using dry-equalizer 0.3.0
Using dry-inflector 0.2.0
Using dry-logic 1.1.0
Using dry-types 1.4.0
Using regexp_parser 2.1.1
Using ecma-re-validator 0.3.0
Using ed25519 1.2.4
Using elasticsearch-api 6.8.2
Using elasticsearch-transport 6.8.2
Using elasticsearch 6.8.2
Using hashie 4.1.0
Using elasticsearch-model 6.1.1
Using elasticsearch-rails 6.1.1
Using email_reply_trimmer 0.1.6
Using escape_utils 1.2.1
Using et-orbi 1.2.1
Using excon 0.71.1
Using expression_parser 0.9.0
Using faraday-cookie_jar 0.0.7
Using faraday_middleware-aws-sigv4 0.3.0
Using fast_blank 1.0.0
Using fast_gettext 2.1.0
Using ffi 1.15.3
Using ffi-compiler 1.0.1
Using libyajl2 1.2.0
Using ffi-yajl 2.3.4
Using flipper 0.21.0
Using flipper-active_record 0.21.0
Using flipper-active_support_cache_store 0.21.0
Using flowdock 0.7.1
Using formatador 0.2.5
Using fog-core 2.1.0
Using fog-json 1.2.0
Using ipaddress 0.8.3
Using xml-simple 1.1.5
Using fog-aliyun 0.3.3
Using fog-xml 0.1.3
Using fog-aws 3.12.0
Using memoist 0.16.2
Using os 1.1.1
Using signet 0.14.0
Using googleauth 0.14.0
Using httpclient 2.8.3
Using uber 0.1.0
Using representable 3.0.4
Using retriable 3.1.2
Using google-api-client 0.50.0
Using google-cloud-env 1.5.0
Using fog-google 1.15.0
Using fog-local 0.6.0
Using fog-openstack 1.0.8
Using fog-rackspace 0.1.1
Using raabro 1.1.6
Using fugit 1.2.1
Using get_process_mem 0.2.5
Using locale 2.1.3
Using text 1.3.1
Using gettext 3.3.6
Using gettext_i18n_rails 1.8.0
Using json 2.5.1
Using po_to_json 1.0.1
Using sprockets 3.7.2
Using sprockets-rails 3.2.2
Using rails 6.1.4.1
Using gettext_i18n_rails_js 1.3.0
Using google-protobuf 3.17.3 (x86_64-linux)
Using googleapis-common-protos-types 1.1.0
Using grpc 1.30.2 (x86_64-linux)
Using gitaly 14.4.0.pre.rc43
Using github-markup 1.7.0
Using numerizer 0.2.0
Using gitlab-chronic 0.10.5
Using gitlab-dangerfiles 2.5.0
Using request_store 1.5.0
Using scientist 1.6.0
Using gitlab-experiment 0.6.4
Using timeliness 0.3.10
Using ms_rest 0.7.6
Using ms_rest_azure 0.12.0
Using gitlab-fog-azure-rm 1.2.0
Using opentracing 0.5.0
Using thrift 0.14.0
Using jaeger-client 1.1.0
Using pg_query 2.1.1
Using redis 4.4.0
Using gitlab-labkit 0.21.1
Using gitlab-license 2.0.0
Using gitlab-mail_room 0.0.9
Using gitlab-markup 1.7.1
Using gitlab-net-dns 0.9.1
Using omniauth 1.9.1
Using rack-oauth2 1.16.0
Using swd 1.2.0
Using validate_email 0.1.6
Using validate_url 1.0.13
Using webfinger 1.1.0
Using openid_connect 1.2.0
Using gitlab-omniauth-openid-connect 0.8.0
Using sidekiq 6.2.2
Using gitlab-sidekiq-fetcher 0.8.0
Using gitlab_chronic_duration 0.10.6.2
Using net-ldap 0.16.3
Using pyu-ruby-sasl 0.0.3.3
Using rubyntlm 0.6.2
Using gitlab_omniauth-ldap 2.1.1
Using gon 6.4.0
Using gpgme 2.0.20
Using mustermann 1.1.1
Using mustermann-grape 1.0.1
Using rack-accept 0.4.5
Using grape 1.5.2
Using grape-entity 0.10.0
Using grape-path-helpers 1.7.0
Using grape_logging 1.8.3
Using graphiql-rails 1.4.10
Using graphql-client 0.16.0
Using graphlient 0.4.0
Using temple 0.8.2
Using tilt 2.0.10
Using hamlit 2.15.0
Using hana 1.3.7
Using hangouts-chat 0.0.5
Using hashie-forbidden_attributes 0.1.1
Using health_check 3.0.0
Using html2text 0.2.0
Using htmlentities 4.3.4
Using http-form_data 2.3.0
Using http-parser 1.2.3
Using http 4.4.1
Using icalendar 2.4.1
Using invisible_captcha 1.1.0
Using ipynbdiff 0.3.7
Using oauth 0.5.6
Using jira-ruby 2.1.4
Using regexp_property_values 1.0.0
Using js_regex 3.7.0
Using uri_template 0.7.0
Using json_schemer 0.2.18
Using jsonpath 1.1.0
Using kaminari-core 1.2.1
Using kaminari-actionview 1.2.1
Using kaminari-activerecord 1.2.1
Using kaminari 1.2.1
Using kas-grpc 0.0.2
Using recursive-open-struct 1.1.3
Using kubeclient 4.9.2
Using rubyzip 2.0.0
Using parslet 1.8.2
Using toml 0.2.0
Using with_env 1.1.0
Using license_finder 6.0.0
Using reverse_markdown 1.4.0
Using rugged 1.2.0
Using licensee 9.14.1
Using lockbox 0.6.2
Using lograge 0.11.2
Using lru_redux 1.1.0
Using mail-smtp_pool 0.1.0 from source at `vendor/gems/mail-smtp_pool`
Using marginalia 1.10.0
Using mini_magick 4.10.1
Using mixlib-cli 2.1.8
Using mixlib-log 3.0.9
Using murmurhash3 0.1.6
Using net-ntp 2.1.3
Using net-ssh 6.0.0
Using net-scp 3.0.0
Using nokogumbo 2.0.2
Using plist 3.6.0
Using train-core 3.4.9
Using wmi-lite 1.0.5
Using ohai 16.10.6
Using oj 3.10.6
Using omniauth-oauth2 1.7.1
Using omniauth-atlassian-oauth2 0.2.0
Using omniauth-auth0 2.0.0
Using omniauth-authentiq 0.3.3
Using omniauth-azure-activedirectory-v2 1.0.0
Using omniauth-azure-oauth2 0.0.10
Using omniauth-cas3 1.1.4
Using omniauth-dingtalk-oauth2 1.0.0
Using omniauth-facebook 4.0.0
Using omniauth-github 1.4.0
Using omniauth-gitlab 1.0.3
Using omniauth-google-oauth2 0.6.0
Using omniauth-oauth 1.1.0
Using omniauth-oauth2-generic 0.2.2
Using omniauth-salesforce 1.0.5
Using ruby-saml 1.13.0
Using omniauth-saml 1.10.0
Using omniauth-shibboleth 1.3.0
Using omniauth-twitter 1.4.0
Using omniauth_crowd 2.4.0
Using openssl 2.2.0
Using optimist 3.0.1
Using rubypants 0.2.0
Using org-ruby 0.9.12
Using peek 1.1.0
Using premailer 1.11.1
Using premailer-rails 1.10.3
Using prometheus-client-mmap 0.15.0
Using puma 5.3.2
Using puma_worker_killer 0.3.1
Using rack-attack 6.3.0
Using rack-cors 1.0.6
Using rack-proxy 0.6.0
Using rack-timeout 0.5.2
Using rails-i18n 6.0.0
Using rainbow 3.0.0
Using rbtrace 0.4.14
Using rdoc 6.3.2
Using re2 1.2.0
Using redis-store 1.9.0
Using redis-rack 2.1.3
Using redis-actionpack 5.2.0
Using redis-namespace 1.8.1
Using rinku 2.0.0
Using rouge 3.26.1
Using rqrcode 0.7.0
Using rqrcode-rails3 0.1.7
Using ruby-fogbugz 0.2.1
Fetching ruby-magic 0.4.0
Using ruby-prof 1.3.1
Using sexp_processor 4.15.1
Using ruby_parser 3.15.0
Using safety_net_attestation 0.4.0
Using sanitize 5.2.1
Using sassc 2.0.1
Using sassc-rails 2.1.0
Using sd_notify 0.1.0
Using securecompare 1.0.0
Using seed-fu 2.3.7
Using sentry-raven 3.1.2
Using settingslogic 2.0.9
Using sidekiq-cron 1.0.4
Using simplecov-html 0.12.3
Using simplecov 0.18.5
Using simplecov-cobertura 1.3.1
Using slack-messenger 2.3.4
Using snowplow-tracker 0.6.1
Using spamcheck 0.1.0
Using sshkey 2.0.0
Using stackprof 0.2.15
Using state_machines 0.5.0
Using state_machines-activemodel 0.8.0
Using state_machines-activerecord 0.8.0
Using sys-filesystem 1.1.9
Using tanuki_emoji 0.5.0
Using terser 1.0.2
Using toml-rb 2.0.1
Using tpm-key_attestation 0.9.0
Using truncato 0.7.11
Using u2f 0.2.1
Using unleash 3.2.2
Using valid_email 0.1.3
Using validates_hostname 1.0.11
Using version_sorter 2.2.4
Using vmstat 2.3.0
Using warning 1.2.0
Using webauthn 2.3.0
Using webrick 1.6.1
Using wikicloth 0.8.1
Using yajl-ruby 1.4.1
Bundle complete! 280 Gemfile dependencies, 447 gems now installed.
Gems in the groups development, test, mysql, aws and kerberos were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from ruby-magic:
Thank you for installing!
kwilczynski@debian11:~/gitlab-foss$ bundle exec gem info ruby-magic
*** LOCAL GEMS ***
ruby-magic (0.4.0)
Author: Krzysztof Wilczyński
Homepage: https://github.com/kwilczynski/ruby-magic
License: Apache-2.0
Installed at: /home/kwilczynski/gitlab-foss/vendor/bundle/ruby/2.7.0
File Magic in Ruby
kwilczynski@debian11:~/gitlab-foss$ RUBYLIB=./vendor/bundle/ruby/2.7.0/gems/ruby-magic-0.4.0/lib irb
irb(main):001:0> require 'magic'
=> true
irb(main):002:0> File.magic '/etc/hosts'
=> "ASCII text"
irb(main):003:0>
Everything seems to have compiled and installed correctly. The shared library magic.so
is also at the correct location.
By I can't find any
mkmf.log
; there is some way to generate some logging from that lastbundle install
?
You can locate the mkmf.log
file as follows (an example from my virtual machine):
kwilczynski@debian11:~/gitlab-foss$ find ./vendor/bundle/ruby | grep 'mkmf.log'
Look for ruby-magic
there in the output. In terms of more verbose output from the bundle install
, you can pass -V
(for "verbose") option to Bundler to get a little bit more information printed during Ruby gems installation.
If you are still having issues installing GitLab from scratch, then I would recommend you try the Omnibus Installer instead. It's probably the most convenient way of deploying GitLab that I personally can think of. See Consider the Omnibus package installation for more details.
Krzysztof
Hi @jacargentina,
Do you still need any help with this? It's been two weeks since my last message.
Krzysztof
No time to try again, sorry. U can close.
For whatever its worth it wont move magic.so to lib on Fedora (34). Current version and all previous tags for whose tarball is accessible behave the same way (fail to do so).
The bug is still valid and happens every single time for me.
Ah, I know what this is -- see https://github.com/sparklemotion/nokogiri/issues/2300 for a description of what's going on and how to fix it. I'll submit a PR now.
See #27
Thanks, works great now.
Cheers 🍷
Hi @f6p,
Sorry for late reply!
Thank you for letting us know and sorry troubles, and big THANK YOU to @flavorjones for a quick fix!
Released in ruby-magic v0.5.3.
On gitlab project, when trying to run Puma, I get this error:
Any advice?