Discourse Build Error: "An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue."

For the past few weeks or so, I cannot rebuild our Discourse forum software.

Each time, we get this Bundler error:

"An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue." 

failing:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4' failed with return #<Process::Status: pid 541 exit 5>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle config --local deployment true'", "su discourse -c 'bundle config --local without \"development test\"'", "su discourse -c 'bundle install --retry 3 --jobs 4'"]}
bootstrap failed with exit code 5
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
dfd1d73cc65b60ab8b8963ad9bdb005500322808bf8766cf90c07c91d3dea615

so I tried, from this reference

gem install rbtrace -v '0.5.1' --source 'http://rubygems.org/' -- --with-cflags=-Wno-implicit-function-declaration

with success:

Building native extensions with: '--with-cflags=-Wno-implicit-function-declaration'
This could take a while...
Successfully installed rbtrace-0.5.1
Parsing documentation for rbtrace-0.5.1
Done installing documentation for rbtrace after 0 seconds
1 gem installed

But it keeps failing.....

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.

If this error cannot be fixed, I will need to rebuild Discourse from scratch in an entire new directory structure and change all our admin scripts, etc.

:frowning:

@vbe

Was going to ask you to post this question in the discourse meta forum, but after some searching, I am not hopeful anyone there will offer any tangible / actionable constructive suggestions.

I posted this:

Let's see...

3 Likes

Thanks Victor!

Maybe we will get lucky this time :slight_smile:

Perhaps you're not the only one. This topic relates to rbtrace 0.5.0 which I guess is not a million miles away?

Certainly the error msgs are pretty much the same.

(And, obviously, I'm not a Discourse user/techie so I'm not sure of my facts.)

This closed just 3 days ago! Not the only one perhaps?

Ok, it doesn't solve it.

1 Like

And of course there is this one...

1 Like

Yes, and there is no solution or even a root cause discussion in that meta discourse forum post.

Yes, it's an issue and it's (not really) surprising that discourse has not addressed it to date.

ubuntu_linux:/var/disco# git pull
Already up to date.

Our Discourse Building Admin Script

ubuntu_linux:/var/disco# buildnewsocket
...
...
...
...
...

Final Build Error

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4' failed with return #<Process::Status: pid 543 exit 5>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle config --local deployment true'", "su discourse -c 'bundle config --local without \"development test\"'", "su discourse -c 'bundle install --retry 3 --jobs 4'"]}
bootstrap failed with exit code 5
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
9725dda21c23ab35742fd83f9fdbcef12440e5a9946a844a04c5ca4435322e7f
Bootstrap  failed

Build Failure Line Error

/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.

In Gemfile:
  rbtrace
I, [2023-12-23T03:09:39.054005 #1]  INFO -- : Fetching gem metadata from https://rubygems.org/.........

Really do not want to spend time during the holidays rebuilding discourse from scratch, restoring all images, thumbnails and the entire DB, due to this discourse bundle error.

!!!

This is interesting.....

This Ruby Gem rbtrace has this version history:

0.5.1 - December 19, 2023 (509 KB)
0.5.0 - December 01, 2023 (509 KB)
0.4.14 - August 03, 2020 (508 KB)
0.4.13 - May 19, 2020 (508 KB)
0.4.12 - March 17, 2020 (508 KB)

So, the discourse bundle error corresponds to the new December 5.0 releases.

Reference:

https://rubygems.org/gems/rbtrace

1 Like

It seems the rbtrace ruby gem reference is in the discourse docker image; because I searched the repo here:

https://github.com/search?q=repo%3Adiscourse%2Fdiscourse_docker++rbtrace&type=code

and removing that reference did not effect the build process.

I also tried removing the rbtrace gem from the build Gemfile and that did not work either, so my current best guess is that the root cause of this error exists in the discourse-docker image.

Worked on this for about 2 full hours; and cannot remove the gem or update it during the build process using the build yml file.

:annoyed:

:frowning:

1 Like

Reminding me posts blaming docker version ( too old...)

Hey even Falco posted:
Falcoteam

11h

Can you please share your docker version, OS version and kernel version?

We have been getting a fair share of failures like this, but I’ve been unable to reproduce it in my droplets.

(To Aston T ...)
in this thread

I don't think any those questions are actually relevant to Ruby and the bundle process (OS version and kernel version) but here is the more relevant info, in my view:

# docker -v
Docker version 18.09.7, build 2d0083d

# /usr/local/bin/rbtrace -v
rbtrace: like strace, but for ruby code
  version 0.5.1
  (c) 2013 Aman Gupta (tmm1)
  http://github.com/tmm1/rbtrace

# ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

# rails -v
Rails 4.2.10

# gem -v
2.7.6

# bundle -v
Bundler version 2.3.15

The error is a Ruby on Rails bundle error, so the relevant information is more closely related to Rails versioning, not the underlying OS or docker version.

In other words, the app should be independent (decoupled) from the Linux OS version and kernel version.

Hope this helps.

1 Like

Since I have had no other replies since the one linked to Rebuild failed- FAILED TO BOOTSTRAP... I will let them continue their way, and see if anything new arise before suggesting them to look at ruby... They seem more interested by this thread than mine, maybe because there are others that have complained but not in the forum...

1 Like

My prior experience is that both pfaffman and Falco of discourse meta are not deep enough technically to troubleshoot this kind of error. They are more expert at cookie cutter installs and standard template build support; and not more complex, deeper bundle and Ruby build errors.

Anyway, standing by.... :slight_smile:

pfaffman is on vacation till 01.01.24, unless you are ready to pay $$$$$:

If it’s an emergency and you have a budget you can post in #marketplace::category or contact me directly.

Before I update docker or bundle etc; the smart thing to do would be to just do a test, fresh install in a new directory and see if discourse will compile and run from a virgin install on our current platform.

2 Likes

It may work, based on what I have read...

1 Like

Just tested building discourse from scratch on the same server and got the same error:

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.

So, I'll disable all the custom plugins to see if any plugin might be causing the problem and try again.

Same error with all custom plugins disabled.

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.

Now, I disable all extra Ruby gems in the build file:

See error with extra gems removed:

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.
1 Like

Looking at bundler, first I will try:

gem install bundler -v 2.3.27

Fetching: bundler-2.3.27.gem (100%)
Successfully installed bundler-2.3.27
Parsing documentation for bundler-2.3.27
Installing ri documentation for bundler-2.3.27
Done installing documentation for bundler after 0 seconds
1 gem installed

... but this resulted in the same error.

Try to update gem system:

linux:/var/discourse# gem update --system
Updating rubygems-update
ERROR:  Error installing rubygems-update:
	There are no versions of rubygems-update (= 3.5.3) compatible with your Ruby & RubyGems
	rubygems-update requires Ruby version >= 3.0.0. The current ruby version is 2.5.0.
linux:/var/discourse# rbenv versions
* system
  3.0.4

but this shows:

linux:/var/discourse# ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

So, I set the current version of Ruby using rbenv:

# rbenv global 3.0.4

and ran this to update bundler:

# gem update --system
linux:/var/discourse# bundler -v
Bundler version 2.5.3

linux:/var/discourse# ruby -v
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]

linux:/var/discourse# gem -v
3.5.3

so, now try upgrading rails:

gem update rails
...
Done installing documentation for actioncable, actionmailbox, actionmailer, actionpack, actiontext, actionview, activejob, activemodel, activerecord, activestorage, activesupport, concurrent-ruby, connection_pool, loofah, minitest, nokogiri, racc, rack, rack-session, rackup, rails, rails-dom-testing, rails-html-sanitizer, railties, thor, timeout, webrick after 10 seconds

Gems updated: actioncable actionmailbox actionmailer actionpack actiontext actionview activejob activemodel activerecord activestorage activesupport concurrent-ruby connection_pool loofah minitest nokogiri racc rack rack-session rackup rails rails-dom-testing rails-html-sanitizer railties thor timeout webrick

Try to build discourse again:

# ./launcher bootstrap socket3

same error:

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.

Looking at the discourse build output, the error does appear do be inside the discourse container, which will not build:

I, [2023-12-24T03:30:38.587015 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle config --local deployment true'
I, [2023-12-24T03:30:38.699387 #1]  INFO -- : 
I, [2023-12-24T03:30:38.699452 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle config --local without "development test"'
I, [2023-12-24T03:30:38.811768 #1]  INFO -- : You are replacing the current local value of without, which is currently "test:development"

I, [2023-12-24T03:30:38.811847 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4'
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rbtrace-0.5.1/ext
/usr/local/bin/ruby extconf.rb
  -- tar zxvfo msgpack-1.1.0.tar.gz
  -- env CFLAGS=nil LDFLAGS=nil CC=nil
-- ./configure --disable-dependency-tracking --disable-shared --with-pic
--prefix=/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rbtrace-0.5.1/ext/dst/
--libdir=/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rbtrace-0.5.1/ext/dst/lib
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

So, the error is in the discourse build inside the container for sure.

However, I'm hesitant to now upgrade docker as it might break the current running forums and I'm not convinced docker is the issue.

Discourse Install Error

/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'

An error occurred while installing rbtrace (0.5.1), and Bundler cannot continue.

In Gemfile:
  rbtrace
I, [2023-12-24T03:47:27.603733 #1]  INFO -- : Fetching gem metadata from https://rubygems.org/.........
1 Like

Checking the current running discourse docker container:

linux:/var/discourse# docker exec -it  socket2 bash
root@linux-socket2:/# bundler -v
Bundler version 2.4.21

root@linux-socket2:/# ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

root@linux-socket2:/# rails -v
Rails 7.0.7

root@linux-socket2:/# rbtrace -v
*** run `sudo sysctl kernel.msgmnb=1048576` to prevent losing events (currently: 16384 bytes)
rbtrace: like strace, but for ruby code
  version 0.4.14

However, I don't see any clear path to downgrade rbtrace because it looks like it exists in the discourse docker image which is downloaded when installed.

In the current working container:

Gemfile

gem "rbtrace", require: false, platform: :mri

I could try (again) to remove that line someone when the container is built, something like:

 after_code:
    - exec:
        cd: $home
        cmd:
          - sed -i '/rbtrace/d' Gemfile
          - sed -i '/rbtrace/d' Gemfile.lock
          - echo "gem 'rbtrace', '~> 0.4.14'" >> Gemfile
          - su discourse -c 'bundle config unset deployment'
          - su discourse -c 'bundle install --no-deployment --path vendor/bundle --jobs 4 --without test development'

But interestingly enough, now I get this error:

An error occurred while installing rbtrace (0.4.14), and Bundler cannot
continue.

So, I was able to hack the discourse build yml file and change the version of rbtrace to the prior working version, but that also fails.

So, even a ninja server warrior like me, cannot get past this error (yet).

!!

1 Like