Mastodon 4.3.7 to 4.5.1 upgrade failed

Hi,

I am running Yunohost 12.1.35 and I am trying to upgrade Mastodon from 4.3.7 to 4.5.1 but it fails. Please see the logs
https://paste.yunohost.org/raw/iqijucezac

I tried to follow @JfmbLinux guidance at Mastodon update fails (4.3.6->4.5.0), ruby 3.4.5 not installed, provision fails - #5 by JfmbLinux
But this is what I get:

root@sub:~# yunohost app shell mastodon
mastodon@sub:~$ rbenv install --list
3.2.9
3.3.10
3.4.7
jruby-10.0.2.0
mruby-3.4.0
picoruby-3.0.0
truffleruby-25.0.0
truffleruby+graalvm-25.0.0

Only latest stable releases for each Ruby implementation are shown.
Use `rbenv install --list-all' to show all local versions.
mastodon@sub:~$ rbenv install 3.4.5
==> Installing ruby-3.4.5...
-> ./configure --prefix=/opt/rbenv/versions/3.4.5 --enable-shared --with-ext=openssl,psych,+
-> make -j 4
-> make install

BUILD FAILED (Debian 12 on x86_64 using ruby-build 20251023-2-gdd6ffec2)

You can inspect the build directory at /tmp/ruby-build.20251115090759.18775.kUiOZi
See the full build log at /tmp/ruby-build.20251115090759.18775.log
mastodon@sub:~$ 

And here you can find the contents of /tmp/ruby-build.20251115090759.18775.log
https://paste.yunohost.org/raw/ecajejofiv

What should I do?

Thank you!

The log /tmp/ruby-build.20251115090759.18775.log, among other things, it shows a:

Permission denied @ dir_s_mkdir - /opt/rbenv/versions/3.4.5

Hi,
Update from version 4.3.7 to version 4.5.1.
Wouldn’t it be better to go through the stable versions, after version 4.3.7, before going directly to version 4.5.1?

Hey, thanks.

How can I do that?

I’ve never done this kind of update, but I think it would be better to make a backup of the Mastodon database and Mastodon too as a precaution :

yunohost backup create --apps mastodon

Then, create a backup folder if it does not exist, then use this command:

pg_dump -U mastodon -W -F t mastodon > /backups/mastodon_backup.dump 

You will be asked for the password found in the .env.production file = PostgreSQL = DB_PASS=password
Copy it before running the command and put it aside.

Try updating with this command:

# upgrade an existing install:
sudo yunohost app upgrade mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh/tree/testing

Hope this can help you.

I forgot to say that, since the upgrade failure, my Mastodon server is completely down.

So, maybe I should first try to make it work before backing it up?

The three Mastodon services (mastodon-sidekiq, mastodon-streaming and mastodon-web) fail to start.

Can you restore the last stable backup, made before the update?

I have restored the last automatic backup of Mastodon, the one done just before the upgrade. That made Mastodon apparently go up but its service mastodon-streaming fails to start.
I tried to restart it manually but it immediately fails.
So I have manually stopped the other two services as I am not sure if I will be able to keep new data of my Mastodon users if they start using it now, I might have to go back again to a previous point, I don’t know. Trying to prevent my Mastodon users do not loose data.

Why do my mastodon-streaming service fails to start?

I see there is a problem with node :

mastodon-streaming.service: Failed to locate executable /opt/node_n/n/versions/node/20.19.1/bin/node: No such file or directory

I see there is a problem with node
Check the installed version:

node -v
1 Like

v18.20.4

You should have this version:

v20.19.5

Thank you!
How should I do it?

This is what I did to resolve this problem I already had.

Install the latest version.

nvm install 20.19.5

Switch versions using

nvm use 20.19.5

Then, restart the services:

      systemctl restart mastodon-web
      systemctl restart mastodon-sidekiq
      systemctl restart mastodon-streaming
1 Like

I’m afraid I’m missing something:

root@sub:~# nvm install 20.19.5
-bash: nvm: command not found

You would have to install nvm. But node -v shows the active node version in your shell, not for your app. You need to install 20.19.5 in /opt/node_n/n/versions/node/:

N_PREFIX=/opt/node_n/ /usr/share/yunohost/helpers.v2.1.d/vendor/n/n install 20.19.5

Then restart mastodon.

Thank you. I don’t seem to get this nvm thing… Please look what I did and what I got:

root@sub:~# cd /opt/node_n/n/versions/node/
root@sub:/opt/node_n/n/versions/node# node -v
v18.20.4
root@sub:/opt/node_n/n/versions/node# N_PREFIX=/opt/node_n/ /usr/share/yunohost/helpers.v2.1.d/vendor/n/n install 20.19.5
     copying : node/20.19.5
   installed : v20.19.5 to /opt/node_n/bin/node
      active : v18.20.4 at /usr/bin/node
root@sub:/opt/node_n/n/versions/node# nvm use 20.19.5
-bash: nvm: command not found

Don’t need to do this : nvm use 20.19.5. Just check if 20.19.5 is present in /opt/node_n/n/versions/node and restart mastodon.

It is there.

root@sub:/opt/node_n/n/versions/node# ls -hal
total 16K
drwxr-xr-x 4 root root 4.0K Nov 15 14:47 .
drwxr-xr-x 3 root root 4.0K Feb  8  2025 ..
lrwxrwxrwx 1 root root   35 Aug 30 17:09 14 -> /opt/node_n/n/versions/node/14.21.3
drwxrwxrwx 6 root root 4.0K Aug 30 17:09 14.21.3
lrwxrwxrwx 1 root root   35 Feb  8  2025 20 -> /opt/node_n/n/versions/node/20.18.2
drwxrwxrwx 6 root root 4.0K Nov 15 14:47 20.19.5
lrwxrwxrwx 1 root root   35 May 26 23:19 22 -> /opt/node_n/n/versions/node/22.16.0

Then I rebooted the system. But the mastodon-streaming service keeps failing to start.