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

So I’m another one with a failed upgrade (site is down unfortunatley). I was on a fairly recent version of Discourse, maybe just a couple months old at most.

Over the years .launcher rebuild app would usually fix failed upgrades, I guess not this time…

Im running: Ubuntu 16.04.3 LTS and Docker version 18.02.0-ce, build fc4de44

Would upgrading components/modules in the OS possibly fix this?

Error Log:

virtual-dom@2.1.1 ✔
Done in 48.10s.
Done in 85.47s.
yarn cache v1.22.19
success Cleared cache.
Done in 6.37s.

I, [2024-01-11T13:44:59.521334 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle config --local deployment true'
I, [2024-01-11T13:44:59.761056 #1]  INFO -- : 
I, [2024-01-11T13:44:59.761185 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle config --local without "development test"'
I, [2024-01-11T13:44:59.917657 #1]  INFO -- : You are replacing the current local value of without, which is currently "test:development"

I, [2024-01-11T13:44:59.917780 #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.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/bin/$(RUBY_BASE_NAME)
extconf.rb:6:in `sys': ./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
failed, please report to https://github.com/tmm1/rbtrace/issues (RuntimeError)
	from extconf.rb:42:in `block (2 levels) in <main>'
	from extconf.rb:34:in `chdir'
	from extconf.rb:34:in `block in <main>'
	from extconf.rb:30:in `chdir'
	from extconf.rb:30:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/var/www/discourse/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/rbtrace-0.5.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/rbtrace-0.5.1 for inspection.
Results logged to
/var/www/discourse/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/rbtrace-0.5.1/gem_make.out

  /usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:125:in `run'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:28:in
`build'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:193:in
`build_extension'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:227:in `block in
build_extensions'
  /usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:224:in `each'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/ext/builder.rb:224:in
`build_extensions'
/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/installer.rb:852:in
`build_extensions'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/rubygems_gem_installer.rb:76:in
`build_extensions'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/source/rubygems.rb:205:in
`install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/worker.rb:62:in
`apply_func'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/worker.rb:57:in
`block in process_queue'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/worker.rb:54:in
`loop'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/lib/bundler/worker.rb:54:in
`process_queue'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.5.3/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, [2024-01-11T13:45:11.634256 #1]  INFO -- : Fetching gem metadata from https://rubygems.org/.........
Fetching cbor 0.5.9.8
Fetching excon 0.109.0
Fetching abbrev 0.1.2
Fetching fastimage 2.3.0
Installing abbrev 0.1.2
Installing fastimage 2.3.0
Installing excon 0.109.0
Fetching google-protobuf 3.25.2 (x86_64-linux)
Fetching regexp_parser 2.9.0
Installing cbor 0.5.9.8 with native extensions
Installing regexp_parser 2.9.0
Fetching nokogiri 1.16.0 (x86_64-linux)
Fetching rack-protection 3.2.0
Installing rack-protection 3.2.0
Installing google-protobuf 3.25.2 (x86_64-linux)
Fetching net-http 0.4.1
Installing net-http 0.4.1
Fetching highline 3.0.0
Fetching activesupport 7.0.8
Installing highline 3.0.0
Installing activesupport 7.0.8
Fetching puma 6.4.2
Installing puma 6.4.2 with native extensions
Fetching rbtrace 0.5.1
Installing rbtrace 0.5.1 with native extensions
Installing nokogiri 1.16.0 (x86_64-linux)
Fetching tzinfo-data 1.2023.4
Installing tzinfo-data 1.2023.4
Fetching net-imap 0.4.9.1
Installing net-imap 0.4.9.1
Fetching net-smtp 0.4.0.1
Installing net-smtp 0.4.0.1
Fetching sass-embedded 1.69.7 (x86_64-linux-gnu)
Fetching faraday-net_http 3.1.0
Installing faraday-net_http 3.1.0
Fetching activemodel 7.0.8
Installing activemodel 7.0.8
Fetching faraday 2.9.0
Installing faraday 2.9.0
Fetching activejob 7.0.8
Installing activejob 7.0.8
Fetching activerecord 7.0.8
Installing sass-embedded 1.69.7 (x86_64-linux-gnu)
Installing activerecord 7.0.8
Fetching sassc-embedded 1.69.1
Installing sassc-embedded 1.69.1
Fetching actionview 7.0.8
Installing actionview 7.0.8
Fetching actionpack 7.0.8
Installing actionpack 7.0.8
Fetching railties 7.0.8
Fetching actionmailer 7.0.8
Installing actionmailer 7.0.8
Installing railties 7.0.8

I, [2024-01-11T13:45:11.634921 #1]  INFO -- : Terminating async processes
I, [2024-01-11T13:45:11.635026 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 40
2024-01-11 13:45:11.635 UTC [40] LOG:  received fast shutdown request
I, [2024-01-11T13:45:11.635144 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 109
2024-01-11 13:45:11.636 UTC [40] LOG:  aborting any active transactions
109:signal-handler (1704980711) Received SIGTERM scheduling shutdown...
2024-01-11 13:45:11.641 UTC [40] LOG:  background worker "logical replication launcher" (PID 49) exited with exit code 1
2024-01-11 13:45:11.642 UTC [44] LOG:  shutting down
2024-01-11 13:45:11.666 UTC [40] LOG:  database system is shut down
109:M 11 Jan 2024 13:45:11.740 # User requested shutdown...
109:M 11 Jan 2024 13:45:11.740 * Saving the final RDB snapshot before exiting.
109:M 11 Jan 2024 13:45:11.811 * DB saved on disk
109:M 11 Jan 2024 13:45:11.811 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle install --retry 3 --jobs 4' failed with return #<Process::Status: pid 518 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.
21aaca59c3b38b78c089cd38f7be10da5c7ea8e91e305db490ba99c8622460c2