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

Rocky 9.0 network customization is lost right after applying. #607

Closed
shanduur-dell opened this issue Aug 22, 2022 · 15 comments
Closed

Rocky 9.0 network customization is lost right after applying. #607

shanduur-dell opened this issue Aug 22, 2022 · 15 comments
Labels

Comments

@shanduur-dell
Copy link

shanduur-dell commented Aug 22, 2022

Describe the bug

After building the VM using Packer for vSphere, I am booting the test VM. It picks the Hostname (but not IP), and saves it in /etc/sysconfig/network and it is visible in the login panel, prompt and as a output of hostname. After few seconds, a reboot happens and rebooted OS no longer has proper hostname, nor valid IP. Displayed IP is IP of the VM used for building template.

Full log:
toolsDeployPkg.log (corrected)

Reproduction steps

1. Prepare VM as template with Rocky Linux 9.0 given the following kickstart file:

cdrom
text
skipx
bootloader
firewall --disabled
selinux --disabled
firstboot --disabled
lang en_US.UTF-8
keyboard us
timezone America/New_York
zerombr
autopart --type=plain
rootpw toor
reboot

%packages --ignoremissing --excludedocs
openssh-clients
wget
curl
bzip2
dkms
patch
net-tools
sudo
sshpass
selinux-policy-devel
open-vm-tools
iproute-tc
-fprintd-pam
-intltool
-microcode_ctl
-irqbalance
-dracut-config-rescue
%end

%post
# perl is outside base image
dnf install -y perl
%end

2. Deploy VM from template using network configuration with static IP and name for VM in VSphere.
3. Observe

Expected behavior

Network configuration is preserved after reboot.

Additional context

No response

@rongz609
Copy link

Hi @shanduur-dell
Please try the work around method in https://kb.vmware.com/s/article/88199
Or you can update your vCenter to vSphere 6.7 P07/U3r or vSphere 7.0 P05/U3f releases according to the KB article.
Please let me know if the problem still exists.
Thanks.

@shanduur-dell
Copy link
Author

shanduur-dell commented Aug 23, 2022

@rongz609 unfortunately, the work around does not seem to work. I modified NetworkManager.conf to include:

[main]
plugins=ifcfg-rh,keyfile

...

And followed the instruction to modify the abc123.nmconnection to look like:

[connection]
autoconnect-priority=-999

...

Unfortunately, this did not solved the issue. The ifcfg-rh file created by customization engine is called ifcfg-ether instead of ifcfg-ens192, but renaming it and rebooting deployed VM does not help.


vSphere Client version 6.7.0.48000
Name:         VMware vCenter Server
Vendor:       VMware, Inc.
Version:      6.7.0
Build:        18010599
OS type:      linux-x64
API type:     VirtualCenter
API version:  6.7.3

@rongz609
Copy link

Hi @shanduur-dell

The KB says "Edit /etc/NetworkManager/system-connections/{NAME}.connection file(s)."

I saw you modified abc123.nmconnection.
Seems that you modified the wrong file.
Can you confirm it?
Thanks.

@rongz609
Copy link

According to your attached toolsDeployPkg.log, I saw you have four NICs in your VM, eth0, eth1, eth2 and eth3
then you may need to edit below files:
/etc/NetworkManager/system-connections/eth0.connection
/etc/NetworkManager/system-connections/eth1.connection
/etc/NetworkManager/system-connections/eth2.connection
/etc/NetworkManager/system-connections/eth3.connection

The "NAME" in /etc/Ne†workManager/system-connections/{NAME}.connection means your NIC interface name.

@shanduur-dell
Copy link
Author

shanduur-dell commented Aug 23, 2022

I do not have any *.connection files in this location. And I do not have any *.connection files anywhere in the system.

@rongz609
Copy link

OK, can you run command "(sudo) nmcli -f ALL connection show"
to check which configure file is active in your VM.

@rongz609
Copy link

Hi @shanduur-dell

In your toolsDeployPkg.log, I found:
DEBUG: Command: 'cat /etc/redhat-release'
DEBUG: Result: Red Hat Enterprise Linux Server release 7.6 (Maipo)

Seems that you are using Red Hat 7.6.
Can you confirm it?
Thanks.

@shanduur-dell
Copy link
Author

shanduur-dell commented Aug 23, 2022

No, I am using Rocky Linux 9.0 (ISO: Rocky-9.0-x86_64-minimal.iso, Checksum: dbe7ee3000baa22ebfc7d66611597081c6b3e792a8c0c86a5a9d58e14650d874), I have no idea why in the log there is other value...

[root@myhost ~]# cat /etc/redhat-release
Rocky Linux release 9.0 (Blue Onyx)
[root@myhost ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.0 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.0 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.0"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.0"

@shanduur-dell
Copy link
Author

$ nmcli -f ALL connection show
NAME          UUID                                  TYPE      TIMESTAMP   TIMESTAMP-REAL                   AUTOCONNECT  AUTOCONNECT-PRIORITY  READONLY  DBUS-PATH                                   ACTIVE  DEVICE  STATE      ACTIVE-PATH                                         SLAVE  FILENAME

ens192        0e18df80-9835-496a-b114-b71f05d5ece7  ethernet  1661262677  Tue 23 Aug 2022 09:51:17 AM EDT  yes          -999                  no        /org/freedesktop/NetworkManager/Settings/2  yes     ens192  activated  /org/freedesktop/NetworkManager/ActiveConnection/1  --     /etc/NetworkManager/system-connections/ens192.nmconnection
System ether  593e52dc-83ae-583a-539e-6ddc573de122  ethernet  0           never                            yes          0                     no        /org/freedesktop/NetworkManager/Settings/1  no      --      --         --                                                  --     /etc/sysconfig/network-scripts/ifcfg-ether

@shanduur-dell
Copy link
Author

Looks like I uploaded wrong Log file, here is correct one:
toolsDeployPkg.log

@rongz609
Copy link

OK, got it.
Can you also post the content of /etc/sysconfig/network-scripts/* after the customization?

@shanduur-dell
Copy link
Author

[root@myhost ~]# ls -al /etc/sysconfig/network-scripts
total 12
drwxr-xr-x. 2 root root   64 Aug 23 09:45 .
drwxr-xr-x. 3 root root 4096 Aug 23 05:42 ..
-rw-r--r--  1 root root  185 Aug 23 09:45 ifcfg-ether
-rw-r--r--  1 root root    0 Aug 23 09:45 route6-ether
-rw-r--r--  1 root root   24 Aug 23 09:45 route-ether
[root@myhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ether
# Generated by VMWare customization engine.
DEVICE=ether
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
NETMASK=255.255.248.0
IPADDR=10.247.97.127
PEERDNS=no

check_link_down() {
 return 1;
}
[root@myhost ~]# cat /etc/sysconfig/network-scripts/route-ether
default via 10.247.96.1
[root@myhost ~]# cat /etc/sysconfig/network-scripts/route6-ether

@rongz609
Copy link

OK, your vCenter is too old.
You need to follow two KB to solve your issue.
https://kb.vmware.com/s/article/86163
https://kb.vmware.com/s/article/88199

Let me summarize the steps:

  1. Power-on Virtual Machine.
  2. In Guest OS, update /etc/redhat-release, replace "Rocky" with "CentOS". Save and close the file.
  3. Edit /etc/NetworkManager/system-connections/{NAME}.connection file(s).
  4. Add 'autoconnect-priority=-999' under [Connection] section in the file(s).
  5. Save and close the file(s).
  6. Power-off the Virtual Machine (convert Virtual Machine back to template).

If you upgrade your vCenter to 6.7U3p, then you just need to follow https://kb.vmware.com/s/article/88199.
And if you upgrade your vCenter to 6.7 P07/U3r, then you don't need the walk around steps.

@shanduur-dell
Copy link
Author

Thank you for your help @rongz609 !

@rongz609
Copy link

Glad to help:)

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

No branches or pull requests

2 participants