Initial installation error reported: FrozenError: can’t modify frozen String

Environment: Ubuntu 18.04

I followed the installation document Installing from source step by step for the initial installation, and configuration of a server, but during the mastodon:setup step the program reported an error and could not save the .env.production and proceed to the next steps.

No error from the previous steps, even the notification email works fine.

Thanks in advance.

Save configuration? Yes
rake aborted!
FrozenError: can’t modify frozen String: “# Generated with mastodon:setup on 2021-11-11 01:36:19 UTC\n\n”
/home/mastodon/live/lib/tasks/mastodon.rake:356:in block (2 levels) in <top (required)>' /home/mastodon/live/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake:27:in <top (required)>’
/home/mastodon/.rbenv/versions/2.7.2/bin/bundle:23:in load' /home/mastodon/.rbenv/versions/2.7.2/bin/bundle:23:in
Tasks: TOP => mastodon:setup

uh-oh, that’s indeed an issue caused in my latest change in the setup script.

Please apply the following patch:

diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 9146f78e1..d905a07da 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -350,11 +350,11 @@ namespace :mastodon do
           end
         end.join("\n")
 
-        generated_header = "# Generated with mastodon:setup on #{Time.now.utc}\n\n"
+        generated_header = "# Generated with mastodon:setup on #{Time.now.utc}\n\n".dup
 
         if incompatible_syntax
-          generated_header << "Some variables in this file will be interpreted differently whether you are\n"
-          generated_header << "using docker-compose or not.\n\n"
+          generated_header << "# Some variables in this file will be interpreted differently whether you are\n"
+          generated_header << "# using docker-compose or not.\n\n"
         end
 
         File.write(Rails.root.join('.env.production'), "#{generated_header}#{env_contents}\n")

Sorry for the inconvenience.

2 Likes

To edit the file /home/mastodon/live/lib/tasks/mastodon.rake around line 356

You could type patch -p1, copy the contents of the patch, then press ctrl+D.

The fix has been merged in the development version, but I don’t know how long until a new release.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.