YunoHost-Apps / mastodon_ynh

Free, open-source social network for YunoHost
https://joinmastodon.org/
GNU Affero General Public License v3.0
84 stars 36 forks source link

Ruby not in PATH #225

Closed nin0-0 closed 4 years ago

nin0-0 commented 4 years ago

I wanted to use tootctl, to remove some media, but it didn't find my ruby binary.

Added PATH=$PATH:/opt/rbenv/versions/2.6.5/bin, and afterwards also 2.6.0 to ~/.profile. e.g. PATH=$PATH:/var/www/mastodon/live/vendor/bundle/ruby/2.6.0/bin/

Now get this error:

root@x:/var/www/mastodon/live/bin# ./tootctl 
Traceback (most recent call last):
    53: from ./tootctl:4:in `<main>'
    52: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
    51: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    50: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    49: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    48: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    47: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    46: from /var/www/mastodon/live/lib/cli.rb:4:in `<top (required)>'
    45: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
    44: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    43: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    42: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    41: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    40: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    39: from /var/www/mastodon/live/lib/mastodon/media_cli.rb:4:in `<top (required)>'
    38: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
    37: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    36: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    35: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    34: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    33: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    32: from /var/www/mastodon/live/config/environment.rb:5:in `<top (required)>'
    31: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/application.rb:361:in `initialize!'
    30: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:60:in `run_initializers'
    29: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    28: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    27: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    26: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
    25: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
    24: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    23: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
    22: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `call'
    21: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
    20: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:50:in `each'
    19: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    18: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    17: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    16: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    15: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    14: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
    13: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:32:in `run'
    12: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:32:in `instance_exec'
    11: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:607:in `block in <class:Engine>'
    10: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:607:in `each'
     9: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:608:in `block (2 levels) in <class:Engine>'
     8: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
     7: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
     6: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     5: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
     4: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
     3: from /var/www/mastodon/live/config/environments/development.rb:90:in `<top (required)>'
     2: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
     1: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant': uninitialized constant ActiveRecordQueryTrace (NameError)
    54: from ./tootctl:4:in `<main>'
    53: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
    52: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    51: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    50: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    49: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    48: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    47: from /var/www/mastodon/live/lib/cli.rb:4:in `<top (required)>'
    46: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
    45: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    44: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    43: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    42: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    41: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    40: from /var/www/mastodon/live/lib/mastodon/media_cli.rb:4:in `<top (required)>'
    39: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative'
    38: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    37: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    36: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    35: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    34: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    33: from /var/www/mastodon/live/config/environment.rb:5:in `<top (required)>'
    32: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/application.rb:361:in `initialize!'
    31: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:60:in `run_initializers'
    30: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    29: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    28: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    27: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
    26: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
    25: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    24: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
    23: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:415:in `call'
    22: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
    21: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:50:in `each'
    20: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    19: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    18: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    17: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    16: from /opt/rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    15: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
    14: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:32:in `run'
    13: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/initializable.rb:32:in `instance_exec'
    12: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:607:in `block in <class:Engine>'
    11: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:607:in `each'
    10: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.1/lib/rails/engine.rb:608:in `block (2 levels) in <class:Engine>'
     9: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
     8: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
     7: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     6: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
     5: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
     4: from /var/www/mastodon/live/config/environments/development.rb:90:in `<top (required)>'
     3: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
     2: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
     1: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant ActiveRecordQueryTrace (NameError)
nin0-0 commented 4 years ago

you have to source the /etc/profile.d/rbenv.sh when you have a .profile file in your user home folder

ImaCrea commented 3 years ago

Hello dear @nin0-0 I'm trying to use tootctl and stumbled on the same issue as you.

Though I don't understand what to do to fix it when you say :

you have to source the /etc/profile.d/rbenv.sh when you have a .profile file in your user home folder

Coud you please give me some details about what to do? Thanks :)

nin0-0 commented 3 years ago

sourcing a file in linux:

source

run: source /etc/profile.d/rbenv.sh

ImaCrea commented 3 years ago

Thank you for your help @nin0-0 but I'm afraid I keep having the same issue :/

admin@x:/var/www/mastodon/live/bin$ ./tootctl 
Traceback (most recent call last):
    53: from ./tootctl:5:in `<main>'
    52: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
    51: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    50: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    49: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    48: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    47: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    46: from /var/www/mastodon/live/lib/cli.rb:4:in `<top (required)>'
    45: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
    44: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    43: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    42: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    41: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    40: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    39: from /var/www/mastodon/live/lib/mastodon/media_cli.rb:4:in `<top (required)>'
    38: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
    37: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    36: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    35: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    34: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    33: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    32: from /var/www/mastodon/live/config/environment.rb:5:in `<top (required)>'
    31: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:361:in `initialize!'
    30: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:60:in `run_initializers'
    29: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    28: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    27: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    26: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
    25: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
    24: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    23: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
    22: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:415:in `call'
    21: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:50:in `tsort_each_child'
    20: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:50:in `each'
    19: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    18: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    17: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    16: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    15: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    14: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    13: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `run'
    12: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `instance_exec'
    11: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/engine.rb:607:in `block in <class:Engine>'
    10: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/engine.rb:607:in `each'
     9: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/engine.rb:608:in `block (2 levels) in <class:Engine>'
     8: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
     7: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
     6: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     5: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
     4: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
     3: from /var/www/mastodon/live/config/environments/development.rb:90:in `<top (required)>'
     2: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `load_missing_constant'
     1: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in `allow_bootsnap_retry'
/var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant': uninitialized constant ActiveRecordQueryTrace (NameError)
    54: from ./tootctl:5:in `<main>'
    53: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
    52: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    51: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    50: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    49: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    48: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    47: from /var/www/mastodon/live/lib/cli.rb:4:in `<top (required)>'
    46: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
    45: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    44: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    43: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    42: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    41: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    40: from /var/www/mastodon/live/lib/mastodon/media_cli.rb:4:in `<top (required)>'
    39: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
    38: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    37: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    36: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    35: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    34: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    33: from /var/www/mastodon/live/config/environment.rb:5:in `<top (required)>'
    32: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:361:in `initialize!'
    31: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:60:in `run_initializers'
    30: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    29: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    28: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    27: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
    26: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
    25: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    24: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
    23: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:415:in `call'
    22: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:50:in `tsort_each_child'
    21: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:50:in `each'
    20: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    19: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    18: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    17: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    16: from /opt/rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    15: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    14: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `run'
    13: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/initializable.rb:32:in `instance_exec'
    12: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/engine.rb:607:in `block in <class:Engine>'
    11: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/engine.rb:607:in `each'
    10: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/engine.rb:608:in `block (2 levels) in <class:Engine>'
     9: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
     8: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
     7: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     6: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
     5: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
     4: from /var/www/mastodon/live/config/environments/development.rb:90:in `<top (required)>'
     3: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
     2: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `rescue in load_missing_constant'
     1: from /var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:9:in `without_bootsnap_cache'
/var/www/mastodon/live/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant': uninitialized constant ActiveRecordQueryTrace (NameError)
admin@x:/var/www/mastodon/live/bin$ $PATH
-bash: /opt/rbenv/shims:/opt/rbenv/bin:/opt/rbenv/bin:/opt/node_n/n/versions/node/12/bin:/opt/node_n/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/www/mastodon/live/vendor/bundle/ruby/2.6.0/bin/:/opt/rbenv/versions/2.6.5/bin:/opt/rbenv/versions/2.6.6/bin/: No such file or directory

I'm a bit of a beginner here so I'd really appreciate if you could detail the steps to follow please ☺️

nin0-0 commented 3 years ago

I use this in my cron jobs to remove media:

. /etc/profile.d/rbenv.sh && cd /var/www/mastodon/live && RAILS_ENV=production bin/tootctl

. is shorthand for source

ImaCrea commented 3 years ago

it works ! 🤩 Thank you very much @nin0-0 🌺

Xananax commented 1 year ago

Here's a script I use to clean mastodon and regain some storage

#!/bin/bash
ROOT=/var/www/mastodon
TOOT_DIR=$ROOT/live

#source /etc/profile.d/rbenv.sh
export PATH=$PATH:/opt/rbenv/versions/mastodon/bin:$TOOT_DIR/bin
export RAILS_ENV=production

cd $TOOT_DIR

bin/tootctl media remove
bin/tootctl preview-cards remove
bin/tootctl media remove-orphans
bin/tootctl statuses remove
bin/tootctl media usage
date

You should run it as root (use sudo su first)

If you want to run it as mastodon user, you may do:

#!/bin/bash
ROOT=/var/www/mastodon
TOOT_DIR=$ROOT/live

sudo -u mastodon /bin/bash << EOF
#source /etc/profile.d/rbenv.sh
export PATH=\$PATH:/opt/rbenv/versions/mastodon/bin:$TOOT_DIR/bin
export RAILS_ENV=production

cd $TOOT_DIR

bin/tootctl media remove
bin/tootctl preview-cards remove
bin/tootctl media remove-orphans
bin/tootctl statuses remove
bin/tootctl media usage
date
EOF

On one of my yunohost servers, it worked perfectly, but on the other, I got https://github.com/ClearlyClaire/webpush.git is not yet checked out. Run bundle install first

I cannot run bundle install as mastodon, because it requires sudo and mastodon isn't in sudoers

I cannot run bundle install as a user, because I am not in the right directory. I cannot access /var/www/mastodon/live, because it's forbidden from my user

I cannot run bundle install as root, because ruby yells at me and tells me I may break up the packages for all other users.

I could test things out, but this is a prod server and I cannot break anything.

If I manage to find a solution I'll update this post

EDIT:

the command in the readme works!

sudo su
(cd /var/www/mastodon/live && sudo -u mastodon RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin bin/tootctl --help)

But I'd still like to know why this script isn't working. What's the difference? I want to be able to run things in cron jobs or in batches, etc, so being able to run a script is important for me.