Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine-os: install netcat #1523

Closed
vrutkovs opened this issue Feb 23, 2023 Discussed in #1521 · 5 comments
Closed

machine-os: install netcat #1523

vrutkovs opened this issue Feb 23, 2023 Discussed in #1521 · 5 comments

Comments

@vrutkovs
Copy link
Member

Discussed in #1521

Originally posted by dsevost February 22, 2023
Describe the bug
Hello dear OKD Team.
Startup script /usr/local/bin/configure-ovs.sh tries to bind to some port while config IPv6 (line 557, see below)

[root@worker2-rs1 ~]# cat -n /usr/local/bin/configure-ovs.sh | grep ' nc ' -B 14 -A 12
   543  # This function waits for ip address of br-ex to be bindable only in case of ipv6
   544  # This is workaround for OCPBUGS-673 as it will not allow starting crio
   545  # before address is bindable
   546  try_to_bind_ipv6_address() {
   547    # Retry for 1 minute
   548    retries=60
   549    until [[ ${retries} -eq 0 ]]; do
   550      ip=$(ip -6 -j addr | jq -r "first(.[] | select(.ifname==\"br-ex\") | .addr_info[] | select(.scope==\"global\") | .local)")
   551      if [[ "${ip}" == "" ]]; then
   552        echo "No ipv6 ip to bind was found"
   553        break
   554      fi
   555      random_port=$(shuf -i 50000-60000 -n 1)
   556      echo "Trying to bind ${ip} on port ${random_port}"
   557      exit_code=$(timeout 2s **nc** -l "${ip}" ${random_port}; echo $?)
   558      if [[ exit_code -eq 124 ]]; then
   559        echo "Address bound successfully"
   560        break
   561      fi
   562      sleep 1
   563      (( retries-- ))
   564    done
   565    if [[ ${retries} -eq 0 ]]; then
   566      echo "Failed to bind ip"
   567      exit 1
   568    fi
   569  }

Version
4.12.0-0.okd-2023-01-21-055900

How reproducible
Enable IPv6 RA on subnet

@vrutkovs
Copy link
Member Author

vrutkovs commented Mar 6, 2023

@vrutkovs vrutkovs closed this as completed Mar 6, 2023
@vrutkovs vrutkovs reopened this Mar 15, 2023
@vrutkovs
Copy link
Member Author

Somehow despite installing the package still no /usr/bin/nc on the machine os content

@vrutkovs
Copy link
Member Author

Expected:

ls -la /usr/bin/nc                                                                             
lrwxrwxrwx. 1 root root 20 Mar 15 20:33 /usr/bin/nc -> /etc/alternatives/nc

but we get

bash-5.2# rpm -ql netcat
/usr/bin/nc
/usr/bin/netcat
/usr/lib/.build-id
/usr/lib/.build-id/5e
/usr/lib/.build-id/5e/2cf9a27e870b9c05dba3677208e6ae1afd2fdc
/usr/share/man/man1/nc.1.gz
/usr/share/man/man1/netcat.1.gz
bash-5.2# /usr/bin/nc
bash: /usr/bin/nc: No such file or directory
bash-5.2# /usr/bin/netcat
usage: nc [-46cDdFhklNnrStUuvz] [-C certfile] [-e name] [-H hash] [-I length]
	  [-i interval] [-K keyfile] [-M ttl] [-m minttl] [-O length]
	  [-o staplefile] [-P proxy_username] [-p source_port] [-R CAfile]
	  [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout]
	  [-X proxy_protocol] [-x proxy_address[:port]] [-Z peercertfile]
	  [destination] [port]

which is an rpm-ostree bug - coreos/rpm-ostree#1614

@ibotty
Copy link

ibotty commented Mar 15, 2023

@vrutkovs
Copy link
Member Author

OKD 4.12+ stables should have it for some time - openshift/okd-machine-os#565 added the right nc, working around the rpm-ostree bug for alternatives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants