Error rebuilding on 2GB RAM without swap

I am running into the exact same issue as the topic above, on a 2GB ram instance.

Right before the error, I made a htop snapshot - notice swap is not being used.

You need 2gb swap. If you ran discourse-setup it would have created it


Should’ve stated that this is running for 4 years+, I rebuild every 2/3 months.

Yep, swap is critical.

Things will fail without it.


So basically run discourse-setup again instead of a regular rebuild?


If you ran discourse-setup to start then perhaps there is something about your system that kept it from creating swap. You might need to just create the swap yourself. Google something like “create swap YOUR-LINUX-DISTRIBUTION”

1 Like

Thanks Jay & Robert. Indeed the swap was missing.

Solution is:

cd /var/discourse
chmod 700 containers # might be redundant, but no harm

The setup will recreate the swap and exit.

WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM
or less. This system does not appear to have sufficient swap space.

Without sufficient swap space, your site may not work properly, and future
upgrades of Discourse may not complete successfully.

Ctrl+C to exit or wait 5 seconds to have a 2GB swapfile created.
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=e0321b22-.....
/swapfile       swap    swap    auto      0       0
vm.swappiness = 10
The configuration file containers/app.yml already exists!

. . . reconfiguring . . .

Saving old file as app.yml.2023-10-03-153852.bak
Stopping existing container in 5 seconds or Control-C to cancel.

Then just do a regular rebuild.


So you originally installed without running discouse-setup?

No, I used discourse-setup a few years ago to install this instance. I am not sure why the swap is killed, I did install something else on the server a while ago, which is now uninstalled, it may have done something I’m not aware of. Maybe this app interacted with swap, not my field of expertise, but the instance is up and running again.


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