Bug 1818579 - dracut network-manager module ignores /etc/sysconfig/network-scripts when using clevis
Summary: dracut network-manager module ignores /etc/sysconfig/network-scripts when usi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dracut
Version: 31
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: dracut-maint-list
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-29 13:35 UTC by Phil Potter
Modified: 2023-03-16 09:07 UTC (History)
5 users (show)

Fixed In Version: dracut-050-61.git20200529.fc31
Clone Of:
Environment:
Last Closed: 2020-10-18 15:48:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Phil Potter 2020-03-29 13:35:57 UTC
Description of problem:
When building clevis dracut module into initramfs (for root filesystem unlock from TPM on boot), it pulls in the network-manager module too - this used to work fine in dracut-049, but since the update to dracut-050, when the machine boots, network-manager has already assigned the ethernet port on my machine to a default "Wired Connection" profile - this means the static address and firewall profile etc. defined by my custom connection profile in nmcli is ignored and the machine doesn't get the right IP addresses.

Version-Release number of selected component (if applicable):
dracut-network-049-27.git20181204.fc31.1.x86_64 (works)
dracut-network-050-26.git20200316.fc31.x86_64 (version with problem)

How reproducible:
Define a connection profile in NetworkManager, set various properties on it such as connection.id, connection.zone, ipv6.addresses, etc. Then build an initramfs with dracut, reboot, and problem manifests.

Steps to Reproduce:
1. Add:
add_dracutmodules+="clevis" to dracut configuration file.

2. Define connection profile in NetworkManager with nmcli for ethernet card.

3. Generate initramfs with dracut.

4. Reboot.

Actual results:
Connection profile is ignored and a new default "Wired Connection" profile (which I believe has been setup by NetworkManager inside initramfs phase) is present. This profile has a different UUID on every boot, suggesting it is being dynamically created.

Expected results:
Read configuration from /etc/sysconfig/network-scripts/ifcfg-* and setup connection profile as specified earlier.

Additional info:
I have done much testing to narrow down the problem (as far as I can tell) to the network-manager module of dracut. In particular, I find that removing the following lines from /usr/lib/dracut/modules.d/35network-manager/nm-config.sh fixes the issue, after generating a new initramfs. I realise these lines are there for a reason though otherwise I would have submitted a patch already:

if getargbool 0 rd.neednet; then
  for i in /usr/lib/NetworkManager/system-connections/* \
           /run/NetworkManager/system-connections/* \
           /etc/NetworkManager/system-connections/* \
           /etc/sysconfig/network-scripts/ifcfg-*; do
    [ -f "$i" ] || continue
    echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
    break
  done
fi

Comment 1 Fedora Update System 2020-05-29 19:03:27 UTC
FEDORA-2020-03e14f6120 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-03e14f6120

Comment 2 Fedora Update System 2020-05-30 02:04:26 UTC
FEDORA-2020-03e14f6120 has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-03e14f6120`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-03e14f6120

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 3 Phil Potter 2020-05-30 21:52:03 UTC
Sorry, the specified update does not fix this issue, even after generating a new initramfs. I shall mention this feedback at the specified link too, thanks.

Comment 4 Fedora Update System 2020-10-18 15:48:04 UTC
FEDORA-2020-03e14f6120 has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Pavel Valena 2023-03-16 08:37:12 UTC
Hello, is this still an issue for you?

What I could drill out of the dracut upstream discussion is that you simply need to specify which network interface you want to activate (on kernel cmdline), or all interfaces get activated. e.g.

```
ip=enp1s0:dhcp
```
or

```
ip=[2001:db8::2]:::56::enp2s0
```

By default, initrd does not activate any interfaces. Adding `clevis` to cmdline basically says to dracut `reconfigure my interfaces`, so this is on a opt-in basis - and completely depends on what the default (NetworkManager's behaviour) is, and what clevis does.

From NetworkManager POV this is a correct behaviour.

Alternatively to above suggestions, you can also include your networkmanager configs directly into the initrd, changing NetworkManager behaviour.

Comment 6 Phil Potter 2023-03-16 09:07:13 UTC
Hi Pavel,

No longer an issue thanks, using Fedora 37 with clevis dracut module quite happily, and had forgotten about this to be honest.

Regards,
Phil


Note You need to log in before you can comment on or make changes to this bug.