"Failed to create swap, sorry!"

I improved the error in discourse-setup to reflect what we covered in this topic:

echo “Failed to create swap, sorry!”
echo “Failed to create swap: are you root? Are you running on real hardware, or a fully virtualized server?”


I think it could be even better if this was not posed as a question, since it is not clear what the desired answer should be (you could read this as “if you’re doing this as root, this will never work”) And the second question looks more like a A or B type of question instead of yes/no.

So how about:

“Failed to create swap. You should be logged in as the root user, and you should be running on real hardware or a fully virtualized server”.


There is a check for root at the beginning of the script,so we know that’s not the problem at this point.


That was not my point. :slight_smile:

1 Like

Heh. Michael’s trying to help you make your error messages less eggheady and more readable/palatable for the everyman :wink: That, or you could go in the opposite direction and call it a GURU MEDITATION ERROR 002534x47754647993591.

You guys have said my host is ripping me off, so i’ve been looking around. This Cloud Server Pro product is only 5 bucks cheaper per month, but is it a far better deal? They claim their meets the specs for Discourse:

  • 4 CPU Cores
  • 4GB Memory
  • 50GB SSD Disk Space
  • 150Mbps Network
  • Unlimited Bandwidth¹
  • Managed w/cPanel
    ( a 20$ value! )

A TWENTY DOLLAR VALUE. Did you hear that? And as i mentioned, i need a gui panel, because life is too short to futz with a command line (or opaquely written error messages).

It’s $50/mo (CAD instead of USD, and i’m in Canadialand).

(Also, where is my Thread Derailer badge?)

Yeah, I hear Michael. My point is that we already know they’re root, so we can also remove that from the message.

Mostly, I think that if the script fails to create swap there are no words to communicate to a Normal Person just why it failed. Not many folks know just what a “fully virtualized server” is or how to tell whether they have one.

Usually, if you have cpanel, you don’t have full access to root to do stuff like install Docker and swap.

Cpanel doesn’t know how to deal with Discourse, so the likelihood that it will make things much more complicated or simply not work at all is pretty high. If you can manage to get Discourse to work with cpanel, it still won’t keep you from having to log in and do things at the command line when something goes wrong with Discourse.

Ah! Good observation, and one that i missed. i checked with them, and SSH is included. Does that make this a good (and reasonably priced) route?

That’s not the purpose, the purpose is that when they copy-paste the error people reading it who do have a clue will go “aha! yes! That’s what they did wrong.”


No, but we can (in many cases), and could detect that and bomb out (for instance, if /proc/user_beancounters exists, then the system is OpenVZ/Virtuozzo).

I think the people who do have a clue already know that if you’re running as root, but you can’t enable a swapfile, we know what they did wrong. The purpose of error messages is to avoid the person having to ask the people who do have a clue.


Ha ha the joke is on you, sir, because that would require reading and understanding the error message!


1 Like

I subscribe to the motto that more detailed error messages are always better. :grin:

How about something like:

WTF - cannot enable swap!  Usually this means one of the following common reasons:

- You are not running as root. How to fix...
- Your VPS is not a REAL VPS.  If your VPS is OpenVZ, foo, bar, baz, etc. it is very likely the case. Sorry, we don't support this. We need a REAL VPS, such as Digital Ocean, Vultr etc.
- The stars are not yet lined up.  Try again after consulting your horoscope.
1 Like

Although most people will find this funny, this can be very, very confusing for people who have bad English language skills.

Well, the point is not in the content. The point is detailed description plus a list of possible causes and outlining what to do next.

1 Like

I was unsure whether you were just making up something so there would be a third reason in your example, or whether you thought it was a good idea to insert funny remarks there - I always get annoyed by the latter and it really confuses people.

Well, notice that I say:

Instead of:

A better write-up:

It indicates that I’m trying to make a point instead of actually providing the solution.

Of course I’m sorry that you get annoyed. But IMHO I am not convinced that it is THAT confusing for non-fluent English users. I deal with people who barely understand English on an everyday basis.

A problem I have at times with the CLI is that a lot of lines scroll by too fast for me to read them let alone identify any as being “key” to a problem.

I can have fairly good search foo as long as I can spot distinct phrases. But I really prefer and appreciate messages that do more than tell me what went wrong and give me a next step suggestion. eg. “Check logs at /some/folder/file”, "Read the manpage at http://documentation.com", "See https://meta.discourse.org/t/some-topic" etc.

1 Like