You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It turns out that when you add to your cloud-init's user-data boot-cmd commands that enable the interface, the issue gets magically resolved!
My theory is that because of the initially down interface, the cloud-init network setup fails in some weird way, breaking NetworkManager somehow. But if we'll ensure that eth0 is up during the cloud-init run, everything completes fine, and NetworkManager works as expected. eth0 correctly gets automatically up after each reboot and the network is available!
Edit: Actually bootcmd might be running after every reboot, so it might be just hiding an issue, but at least it works.
I have no idea what is exactly at fault here (AlmaLinux, cloud-init, NetworkManager or LXD), but at least we have a solution.
This is the example LXD profile for AlmaLinux 9.1, where networking actually works:
- name: alma
description: "Almalinux testing profile."
config:
user.user-data: |
#cloud-config
bootcmd:
- nmcli c up eth0
- nmcli d mod eth0 ipv4.gateway 169.254.0.1
user.network-config: |
version: 2
ethernets:
eth0:
dhcp4: no
dhcp6: no
addresses:
- [something]/32
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: []
routes:
- to: 0.0.0.0/0
via: 169.254.0.1
on-link: true
devices:
eth0:
type: nic
ipv4.address: [something]
nictype: routed
parent: enp1s0f0
host_name: veth-alma
root:
type: disk
path: /
pool: default
size: 20GB
Host is
AlmaLinux 9.1
, guest is alsoAlmaLinux 9.1
.LXD 5.10
. Whatever I try, guest always boots with theeth0
interface down and no routes.ONBOOT=yes
in/etc/sysconfig/network-scripts/ifcfg-eth0
doesn’t work.nmcli d mod eth0 autoconnect yes
doesn’t work.I even tried to replace
/etc/sysconfig/network-scripts/ifcfg-eth0
with a configuration in/etc/NetworkManager/system-connections/
to no avail.Content of the
/etc/sysconfig/network-scripts/ifcfg-eth0
seems fine.Networking can be restored by running:
But it works only until the next reboot.
Time for logs/data etc.:
Full cloud-init.log from the container:
https://gist.github.com/lukasz-zaroda/51ef4a284892c6527b23f94bcb3be72d
journalctl -u NetworkManager
from the container:https://gist.github.com/lukasz-zaroda/e2eec7f7c7e81b6a761f899923bb8ecf
The text was updated successfully, but these errors were encountered: