Azure/WALinuxAgent

[BUG] waagent missing ipv6.addr-gen-mode eui64 from nmcli command

Opened this issue · 1 comments

Running sudo waagent -deprovision+user and I got this error:

ERROR MainThread Command: [nmcli device modify eth0 ipv4.dhcp-hostname localhost.localdomain ipv6.dhcp-hostname localhost.localdomain], return code: [6], result: [Error: Reapplying connection to device 'eth0' (/org/freedesktop/NetworkManager/Devices/2) failed: The settings specified are invalid: ipv6.addr-gen-mode: property is invalid

The fix is to do the following:

Run

$ nmcli device modify eth0 ipv4.dhcp-hostname localhost.localdomain ipv6.dhcp-hostname localhost.localdomain ipv6.addr-gen-mode eui64

before

running sudo waagent deprovision

Distro: RHEL8.7
WALinuxAgent version: 2.7.0.6 running on redhat 8.7
Python: 3.6.8

Additional context
N/A

Log file attached
N/A

I updated the title to now reflect the actual problem and provided the fix.

The bad state part was due to cloud-init. That problem is covered under: https://bugzilla.redhat.com/show_bug.cgi?id=1957532

and the workaround for RHEL8.7 because it does not have the fixed version of cloud-init is: For VMs that were upgraded from RHEL 8.4 or earlier, you must work around the issue manually.

To do so, edit the cloud.cfg file and changing the ssh_genkeytypes: ~ line to ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']. This makes it possible for SSH keys to be deleted and generated correctly when provisioning a RHEL 8 VM in the described circumstances.

I recommend you put the nmcli and the cloud.cfg into an Ansible playbook then run it from your hardening pipeline that should have an automated capture capability (e.g. with terraform)