Discourse-setup: line 260: *0: syntax error: operand expected (error token is "*0")

first installation and got this error:
discourse-setup: line 260: *0: syntax error: operand expected (error token is "*0") Hostname for your Discourse? [discourse.example.com]:

Any suggestion what went wrong?

Hi, welcome back!

Can you detail what OS you are trying to install Discourse with?

Hi There! This is Ubuntu 20.04.6 LTS
Linux ubuntu 5.4.0-1082-raspi aarch64 aarch64 aarch64 GNU/Linux

I think I’d suggest starting with a git pull. And then if the script still does this, perhaps instead try
bash -vx ./discourse-setup
and we might be able to see what’s happening. (I don’t see how line 260 could cause this trouble)

1 Like

the line in 260:

avail_cores=$((`awk '/cpu cores/ {print $4;exit}' /proc/cpuinfo`*`sort /proc/cpuinfo | uniq | grep -c "physical id"`))

output of bash -x:

scale_ram_and_cpu
+ scale_ram_and_cpu
+ local changelog=/tmp/changelog.11937
+ avail_gb=0
+ avail_cores=0
++ check_OS
+++ uname -s
++ echo Linux
+ os_type=Linux
+ '[' Linux == Darwin ']'
++ check_linux_memory
+++ free -m --si
+++ awk ' /Mem:/ {print $2}'
++ mem=3975
++ '[' 3975 -ge 990 -a 3975 -lt 1000 ']'
+++ free -g --si
+++ awk ' /Mem:/  {print $2} '
++ echo 3
+ avail_gb=3
++ awk '/cpu cores/ {print $4;exit}' /proc/cpuinfo
++ sort /proc/cpuinfo
++ uniq
++ grep -c 'physical id'
./discourse-setup: line 260: *0: syntax error: operand expected (error token is "*0")

cat /proc/cpuinfo:

root@ubuntu:/var/discourse# cat /proc/cpuinfo 
processor	: 0
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 1
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 2
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 3
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

Hardware	: BCM2835
Revision	: c03112
Serial		: 10000000d0894f90
Model		: Raspberry Pi 4 Model B Rev 1.2

There are several ways to go here, I think. Perhaps I’d go for

avail_cores=$((`lscpu --parse=core | awk 'NF==1' | sort -u | wc -l`))

(we’re trying to calculate the total number of presently-online physical cores - not logical cores, cpus, sockets, or processors)

Would that work in your case?

yes - it gives back 4
so maybe better to use lscpu instead of parsing /proc/cpuinfo

2 Likes

Great - I’ve submitted a PR

4 Likes

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