Mastodon: Permission error and increase post limit

After upgrading to Mastodon 4.3.7 on Yunohost 12, I started having an issue with images not displaying. I tried everything and finally stumbled on this solution.

It seems an older bug has creeped into the system. So, here is how I fixed the issue.

First of all, mastodon was not in the www-data group. Not sure why, but this matters for some reason. I fixed that by using the following:

sudo su -usermod -aG mastodon www-datanginx -s reload

Then to finish the permission error, I ran the following inside /var/www/mastodon:

chmod -R 750 /var/www/mastodon

Now the images display as expected. Not sure if this is a wide-spread problem, but good to know for the future if anyone else has this issue.

To increase the character limit on Mastodon, I used the following instructions. (This works on Yunohost install of Mastodon up to 4.3.8)

1. Switch to your Mastodon user

Start by logging into your server and going into the root access using:

sudo su -

Then use the following to become Mastodon user. It will not work unless you are root user first.

su - mastodon

and switch to your Mastodon installation directory. For most people, this should be /home/mastodon.

2. Edit the file compose_form_container.js

nano -w live/app/javascript/mastodon/features/compose/containers/compose_form_container.js

Look for the line

maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500),

and change the number 500 to 2500.

3. Edit the file status_length_validator.rb

nano -w live/app/validators/status_length_validator.rb

Find the line

MAX_CHARS = 500

and change the number to 2500.

4. (Optionally, to change the poll limit) Edit the file poll_options_validator.rb

nano -w live/app/validators/poll_options_validator.rb

Find the line

MAX_OPTIONS = 4

and change the number to your desired limit.

5. Rebuild assets and restart services

You are now done editing and can rebuild the live assets. Do so with the following commands:

cd live
RAILS_ENV=production bundle exec rails assets:precompile <- DOES NOT WORK. No idea why, it just doesn't.

Afterwards, exit the mastodon user, and restart the Mastodon services as root:

systemctl restart mastodon-sidekiq
systemctl reload mastodon-web
systemctl restart mastodon-streaming

Congratulations, you should now have an increased character (and poll) limit on your instance. Have fun posting!

Leave a Comment