MRColorR / money4band

A multi platform, self updating, lightweight docker stack that use compose to run many passive income applications like Honeygain, EarnApp, IPRoyal Pawns, PacketStream, Peer2Profit, Repocket, Earnfm, Proxyrack, Bitping, SpeedShare, etc. that pay you in USD or crypto to share unused internet bandwidth. It includes an auto updater and web dashboard
https://github.com/MRColorR/money4band#-join-the-money4band-community-on-discord
GNU General Public License v3.0
221 stars 36 forks source link

Raspberry pi - Syntax error: operand expected "-" #76

Closed 44ron closed 10 months ago

44ron commented 10 months ago

Describe the bug runme.sh throws an error for line 246 The output of lscpu has "-" for Sockets on my device and this makes the script unable to use the output.

[...]

Device (please complete the following information):

MRColorR commented 10 months ago

hello and thank you for reaching out :) , could you please share the output of your lscpu command so we can think on how to write a general solution? on my Pi4 with Pi OS full (debian 11) it works as lscpu | awk '/^Socket\(s\)/{ print $2 }' gives me a plain 1 as output. and mine lscpu output is like:

lscpu
Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
Vendor ID:                       ARM

So could you also share the output of these comamnds too?:

44ron commented 10 months ago

Sure. lscpu gives: $ lscpu Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM Model name: Cortex-A72 Model: 3 Thread(s) per core: 1 Core(s) per cluster: 4 Socket(s): - Cluster(s): 1 Stepping: r0p3 CPU(s) scaling MHz: 100% CPU max MHz: 1500.0000 CPU min MHz: 400.0000 BogoMIPS: 108.00 Flags: fp asimd evtstrm crc32 cpuid Caches (sum of all): L1d: 128 KiB (4 instances) L1i: 192 KiB (4 instances) L2: 1 MiB (1 instance) Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Vulnerable Spectre v1: Mitigation; __user pointer sanitization Spectre v2: Vulnerable Srbds: Not affected Tsx async abort: Not affected

lscpu | awk '/^Socket(s)/{ print $2 }' gives: -

lscpu | awk '/^Core(s) per socket/{ print $4 }' produces nothing.

lscpu | awk '/^Thread(s) per core/{ print $4 }' gives: 1

Since then I simply set the CPU_SOCKETS variable as 1 and CPU_CORES as 4 and it seems to work flawlessly.

OlivierVerhoek commented 10 months ago

Same issue here with RPi Zero 2 W (aarch64) giving - on Socket(s)

Extra info

~/money4band-main# lscpu
Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  4
  On-line CPU(s) list:   0-3
Vendor ID:               ARM
  Model name:            Cortex-A53
    Model:               4
    Thread(s) per core:  1
    Core(s) per cluster: 4
    Socket(s):           -
    Cluster(s):          1
    Stepping:            r0p4
    CPU(s) scaling MHz:  78%
    CPU max MHz:         1000.0000
    CPU min MHz:         600.0000
    BogoMIPS:            38.40
    Flags:               fp asimd evtstrm crc32 cpuid
Caches (sum of all):     
  L1d:                   128 KiB (4 instances)
  L1i:                   128 KiB (4 instances)
  L2:                    512 KiB (1 instance)
MRColorR commented 10 months ago

it seems that lscpu output is not consistent among all the OS. Could you please try these two commands on your machine and post the outputs ? grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}' and also try : lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l

i do not want to use an utility like nproc or similar as some OS could not have it installed

another workaround could be an hardcoded check like: if ! [[ "$CPU_SOCKETS" =~ ^[0-9]+$ ]]; then CPU_SOCKETS=1 # Default to 1 if CPU_SOCKETS is not a number fi

i'll wait for your response and then we can decide which option is the best and most ubiquitous 👍

44ron commented 10 months ago

lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l

This command prints 4, the first prints nothing

MRColorR commented 10 months ago

please try the new release and report back if the issue is resolved :) we moved to lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l

44ron commented 10 months ago

please try the new release and report back if the issue is resolved :) we moved to lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l

Yep, works perfectly, ty :)