首次安装时遇到此错误:
discourse-setup: line 260: *0: syntax error: operand expected (error token is "*0")
您的 Discourse 的主机名? [discourse.example.com]:
有什么建议知道哪里出错了?
首次安装时遇到此错误:
discourse-setup: line 260: *0: syntax error: operand expected (error token is "*0")
您的 Discourse 的主机名? [discourse.example.com]:
有什么建议知道哪里出错了?
您好,欢迎回来!
您能详细说明您尝试安装 Discourse 的操作系统吗?
您好!这是 Ubuntu 20.04.6 LTS
Linux ubuntu 5.4.0-1082-raspi aarch64 aarch64 aarch64 GNU/Linux
我建议先执行 git pull。然后,如果脚本仍然出现此问题,或许可以尝试运行
bash -vx ./discourse-setup
这样我们或许能看到发生了什么。(我不知道第 260 行怎么会引起这个问题)
260行的代码:
avail_cores=$((`awk '/cpu cores/ {print $4;exit}' /proc/cpuinfo`*`sort /proc/cpuinfo | uniq | grep -c \"physical id\"`))
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
这里有几种方法可以尝试,我想,或许我会选择
avail_cores=$((`lscpu --parse=core | awk 'NF==1' | sort -u | wc -l`))
(我们正在尝试计算当前在线的物理核心总数 - 而不是逻辑核心、cpu、插槽或处理器)
这在你的情况下会起作用吗?
是的 - 它返回 4
所以也许最好使用 lscpu 而不是解析 /proc/cpuinfo
好的 - 我已提交一个 PR
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.