Problem with fresh installation

AI-generated summary

In a discussion titled “Problem with fresh installation” under the Installation category, Fajfi reports an issue during Discourse setup on Ubuntu 16.04, where the ./discourse-setup script fails due to awk not recognizing the --field-separator option. Shivam_Trivedi identifies the issue and suggests replacing --field-separator with -F, offering a sed command to fix it. codinghorror acknowledges the bug and asks pfaffman to investigate. pfaffman notes that GNU awk (gawk) typically supports the long option, but discovers Fajfi is using mawk, which doesn’t. He submits a PR to fix the script for compatibility with both mawk and gawk pfaffman. After applying the fix, Fajfi encounters a “Cannot load app” error; pfaffman advises running ./launcher rebuild app to resolve it. codinghorror confirms the oversight and recommends testing on stock Ubuntu. pfaffman concludes that while Ubuntu’s lsb-core lists both mawk and gawk, stock installs usually default to gawk, suggesting the VPS provider may have opted for mawk instead. The issue stems from script assumptions about awk behavior, now addressed in the PR.

Hi!

I need to create new discourse like I’ve tried lately, I used this commands:

https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

When I try to create app.yml using discourse-setup i got this:

user@dominik:/var/discourse# ./discourse-setup
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
Found 8GB of memory and 4 physical CPU cores
setting db_shared_buffers = 2048MB
setting UNICORN_WORKERS = 8
containers/app.yml memory parameters updated.
awk: not an option: --field-separator=:
awk: not an option: --field-separator=:
awk: not an option: --field-separator=:
awk: not an option: --field-separator=:
awk: not an option: --field-separator=:
awk: not an option: --field-separator=:
awk: not an option: --field-separator=:

SMTP password? []:

I cant input hostname etc. What cause this problem?
I’m using Ubuntu 16.04.
`

Hello! I recently faced a similar issue with discourse as well! On line 279 of the ./discourse-setup script, you will find a line that looks like this:

 read_config_result=`echo $config_line | awk  --field-separator":" '{print $2}'`

If you change the line to this:

 read_config_result=`echo $config_line | awk  -F":" '{print $2}'`

things should work.

I guess awk does not have the --field-separator parameter anymore.

If you do not wish to manually replace that line, you can just use this command below:

sed -i 's/--field-separator=/-F/g' ./discourse-setup

Hope this helps!

It looks like we messed this up @pfaffman – can you take a look and fix ASAP? Thanks for the diagnosis @Shivam_Trivedi!

That’s very strange!

The awk (gawk) on my 16.04 supports the “hew style” (available when I first used GNU tools in the 1990s) --long-switches.

Can you tell what package provided your awk? Did you install some “minimal” Ubuntu distribution?

What does

 dpkg -l |grep awk

say?

I’m working on a PR for this, but found another error that I’d like to resolve before sumitting. The awk (gawk) that is typically installed on Ubuntu supports the --field-separator switch. It looks like there is an original-awk package that installs an awk that must be the one that doesn’t support GNU-style switches. @Shivam_Trivedi or @Fajfi can you see what version of awk you have installed?

I disagree that anyone messed this up. I don’t know how someone managed to get a non GNU-compatible awk, but I do agree that it should be fixed. While I was at it, I cleaned up the check-that-default-was-changed code.

@codinghorror, please see

https://github.com/discourse/discourse_docker/pull/392

I would still like to know under what circumstances you install a non GNU-compatible awk(1), especially on Ubuntu 16.04.

@pfaffman

user@dominik:~# dpkg -l |grep awk
ii mawk 1.3.3-17ubuntu2 amd64 a pattern scanning and text processing language

I’m using default ubuntu 16.04 installation on my VPS provider. I can also use my iso so maybe it will be better solution?

This solution works:

sed -i 's/--field-separator=/-F/g' ./discourse-setup

But when I want to start discourse on my domain i got:
# Cannot load app
It looks like you are offline! Please check your network connection and try again.

Where can I find logs?

Thanks. That answers it for me. The standard Ubuntu comes with gawk. our VPS must have someone who prefers mawk for some reason.

I fixed it in the PR. I don’t mean to be a GNU fanboy.

If you’re getting “Cannot load app” it means that the site is down. I recommend that you do a ./launcher rebuild app (or perhaps just ./launcher start app).

Looks like we did mess this up after all :wink: thanks for the fix!

I’d definitely be sure to test on stock Ubuntu first.

Digital Ocean installs gawk. Every Ubuntu install that I can find has gawk installed. https://askubuntu.com/questions/710379/do-i-need-to-install-awk-or-is-it-inbuilt-in-ubuntu claims that mawk is the default, but Ubuntu – Error says taht lsb-core includes

OR? But no explanation of what “or” means.

All I can figure is that there is some gnu-utils package that gets installed in a /stock install/ but that there is a minimal install that doesn’t override mawk with gawk.