Which section(s) is the issue in?
In Preparing the provisioner node for OpenShift Container Platform installation, 11. Configure networking.
What needs fixing?
The environment variables exported by the kni user are not passed to commands with sudo bash -c because the variables quoted by the single quotes.
[kni@provisioner ~]$ export HOGE=hoge
[kni@provisioner ~]$ echo $HOGE is not emply
hoge is not emply
[kni@provisioner ~]$ sudo bash -c 'echo "$HOGE" is empty'
is empty
As a result, the connection is neither down nor deleted and still remains after the command, and an error is recorded in nohup.out.
[kni@provisioner ~]$ nmcli con show
NAME UUID TYPE DEVICE
baremetal c5c91b0a-dab5-4371-9329-cc22d0311a61 bridge baremetal
ens224 a1f45de5-6c61-4b2c-8391-d583150f167f ethernet ens224
provisioning 0cfb97ac-b3f9-45cb-8c24-e42bbbe4f28d bridge provisioning
virbr0 d1a0030c-73c3-497f-abda-44bd37f79a5d bridge virbr0
bridge-slave 9d23f5fb-471f-46fc-99db-ed3828e5216d ethernet ens192
bridge-slave-1 6dcb9051-4259-49dc-ba7a-e197285c2143 ethernet --
ens192 35ee69a3-d075-4e51-b272-6b37a1ab6db4 ethernet --
[kni@provisioner ~]$ cat nohup.out
cat: nohup.out: Permission denied
[kni@provisioner ~]$ sudo cat nohup.out
Error: '' is not an active connection.
Error: no active connection provided.
Error: '' is not an active connection.
Error: no active connection provided.
Error: unknown connection ''.
Error: cannot delete unknown connection(s): ''.
Error: unknown connection ''.
Error: cannot delete unknown connection(s): ''.
Error: 'System ' is not an active connection.
Error: no active connection provided.
Error: unknown connection 'System '.
Error: cannot delete unknown connection(s): 'System '.
Connection 'provisioning' (0cfb97ac-b3f9-45cb-8c24-e42bbbe4f28d) successfully added.
Connection 'bridge-slave' (9d23f5fb-471f-46fc-99db-ed3828e5216d) successfully added.
Connection 'baremetal' (c5c91b0a-dab5-4371-9329-cc22d0311a61) successfully added.
Connection 'bridge-slave-1' (6dcb9051-4259-49dc-ba7a-e197285c2143) successfully added.
Error: '' is not an active connection.
Error: no active connection provided.
Workaround
Add -E option to sudo:
export PUB_CONN=ens224
export PROV_CONN=ens192
sudo -E nohup bash -c '
nmcli con down "$PROV_CONN"
nmcli con down "$PUB_CONN"
nmcli con delete "$PROV_CONN"
nmcli con delete "$PUB_CONN"
# RHEL 8.1 appends the word "System" in front of the connection, delete in case it exists
nmcli con down "System $PUB_CONN"
nmcli con delete "System $PUB_CONN"
nmcli connection add ifname provisioning type bridge con-name provisioning
nmcli con add type bridge-slave ifname "$PROV_CONN" master provisioning
nmcli connection add ifname baremetal type bridge con-name baremetal
nmcli con add type bridge-slave ifname "$PUB_CONN" master baremetal
nmcli con down "$PUB_CONN";pkill dhclient;dhclient baremetal
nmcli connection modify provisioning ipv6.addresses fd00:1101::1/64 ipv6.method manual
nmcli con down provisioning
nmcli con up provisioning
'
Or, replace single quote with double quote and add escape:
export PUB_CONN=ens224
export PROV_CONN=ens192
sudo nohup bash -c "
nmcli con down "$PROV_CONN"
nmcli con down "$PUB_CONN"
nmcli con delete "$PROV_CONN"
nmcli con delete "$PUB_CONN"
# RHEL 8.1 appends the word "System" in front of the connection, delete in case it exists
nmcli con down \"System $PUB_CONN\"
nmcli con delete \"System $PUB_CONN\"
nmcli connection add ifname provisioning type bridge con-name provisioning
nmcli con add type bridge-slave ifname "$PROV_CONN" master provisioning
nmcli connection add ifname baremetal type bridge con-name baremetal
nmcli con add type bridge-slave ifname "$PUB_CONN" master baremetal
nmcli con down "$PUB_CONN";pkill dhclient;dhclient baremetal
nmcli connection modify provisioning ipv6.addresses fd00:1101::1/64 ipv6.method manual
nmcli con down provisioning
nmcli con up provisioning
"
Which section(s) is the issue in?
In Preparing the provisioner node for OpenShift Container Platform installation, 11. Configure networking.
What needs fixing?
The environment variables exported by the
kniuser are not passed to commands withsudo bash -cbecause the variables quoted by the single quotes.As a result, the connection is neither down nor deleted and still remains after the command, and an error is recorded in
nohup.out.Workaround
Add
-Eoption tosudo:Or, replace single quote with double quote and add escape: