Failed to create swap on install

I’m following the official install guide, and when I run this command.

./discourse-setup

I’m getting this error message.

root@server:/var/discourse# ./discourse-setup
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.
install: cannot remove '/swapfile': Operation not permitted
fallocate: fallocate failed: Text file busy
mkswap: error: /swapfile is mounted; will not make swapspace
swapon: /swapfile: swapon failed: Device or resource busy
/swapfile       swap    swap    auto      0       0
vm.swappiness = 10
Failed to create swap: are you root? Are you running on real hardware, or a fully virtualized server?

I have VPS of 2GB RM and 50 GB SSD and did set up a sub-domain for discourse as well.

Why it gives me that error?

1 Like

This usually means you are not on a “real” VPS, as in it’s not a KVM one. What is your VPS provider and product / plan?

1 Like

Oh, didn’t know that and it’s atlantic.net. Is there a fix for this though?

This is their free VPS offering? Contact support and ask if this product is KVM or OpenVZ.

Okay, so on free on it couldn’t be, right?

Well, if I had to guess I would bet on it not being KVM as it’s simply more expensive. But I guess it doesn’t hurt asking their team, as their FAQs don’t mention the virtualization technology at all.

I’ll and going to them. Thanks! :slight_smile:

If it is a true KVM VPS, then you will need this article

There is no need to follow that as the current version of discourse-setup script takes care of that automatically.

1 Like

It has failed for me on a couple of instances of Ubuntu (different providers) - Ramnode being one.

Yes, I worked that out by creating the swapfile.

I have one question though after installation, do I need to keep that file or can remove that anyway?

What file, the swap file? Yes, you need to keep it.

Yes, I thought I just needed that for the installation. :joy:

Don’t remove it, or you are gonna have a bad time.

3 Likes

You’re saying that Discourse-setup failed to create the swap file? Are you able to create a swap file at all? Or does your vm not let you do it?

Not sure you’re addressing me or @Timelord

If it’s yes then, yeah I was able to create that file, and the installation went well.

1 Like

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