talos-bootstrap icon indicating copy to clipboard operation
talos-bootstrap copied to clipboard

Issues running on MacOS

Open insuusvenerati opened this issue 1 year ago • 8 comments

Getting the error when running talos-bootstrap install. On MacOS 13.6.6 talosctl version v1.6.7

❯ talos-bootstrap install
/usr/local/bin/talos-bootstrap: line 126: syntax error near unexpected token `;;'
/usr/local/bin/talos-bootstrap: line 126: `        case " ${seen} " in *" ${mac} "*) continue ;; esac # remove duplicated nodes'

insuusvenerati avatar Apr 09 '24 21:04 insuusvenerati

Hi @insuusvenerati could you please provide output of:

/bin/sh --version

kvaps avatar Apr 10 '24 10:04 kvaps

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.

insuusvenerati avatar Apr 10 '24 10:04 insuusvenerati

It seems case statement does not work inside subshell $() for some reason.

Please try this version from #12 https://github.com/aenix-io/talos-bootstrap/raw/8f3f1985a8b84b535d7ed01014d0f25bab13400b/talos-bootstrap

kvaps avatar Apr 10 '24 11:04 kvaps

Hey! That's works! Thanks so much

insuusvenerati avatar Apr 10 '24 15:04 insuusvenerati

Is there any chance you can get this to work on macOS? Mac doesn't have an iproute2 package so instead I used iproute2mac but get this error

❯ ./talos-bootstrap install
Option "-o" is unknown, try "ip help".
awk: extra ] at source line 1
 context is
        NR>1 >>>  {sub(/^[^/] <<< 
awk: nonterminated character class ^[^
 source line number 1
awk: illegal primary in regular expression *"$ at "$
 source line number 1
 context is
         >>> /*"$/ <<<

insuusvenerati avatar Apr 11 '24 01:04 insuusvenerati

Try installing awk

https://formulae.brew.sh/formula/awk

kvaps avatar Apr 11 '24 06:04 kvaps

Try installing awk

https://formulae.brew.sh/formula/awk

Same happens with the latest version of awk installed

awk: extra ] at source line 1
 context is
	NR>1 >>>  {sub(/^[^/] <<<
awk: nonterminated character class ^[^
 source line number 1
awk: illegal primary in regular expression *"$ at "$
 source line number 1
 context is
	 >>> /*"$/ <<<
	 ```

thecodeassassin avatar Apr 19 '24 21:04 thecodeassassin

Sorry to necro this but as a resolution, it appears that some of the awk syntax used by talos-bootstrap includes GNU extensions that require using gawk try brew install gawk and do one of 2 things:

  1. symlink awk against gawk or
  2. replace all instances of awk with gawk in talos-boostrap using sed -i.bak 's/awk/gawk/' talos-bootstrap

I came to this conclusion after a bit of blue/green testing between my daily driver MBP and a clean Ubuntu VM install. in the clean install /usr/bin/awk links to /etc/alternatives/awk and /etc/alternatives/awk links back to /usr/bin/gawk thus explaining the difference in behaviour

TrooperT avatar Aug 08 '24 17:08 TrooperT