Bug 1940919

Summary: parse-kickstart doesn't create expected information for bond ports
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: anacondaAssignee: Radek Vykydal <rvykydal>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: medium    
Version: 8.3CC: acardace, bgalvani, dracut-maint-list, dtardon, jikortus, jkonecny, jstodola, kwalker, lrintel, rkhan, rvykydal, sukulkar, till
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: anaconda-33.16.8.4-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2133053 (view as bug list) Environment:
Last Closed: 2023-05-16 08:15:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2021-03-19 14:34:56 UTC
Description of problem:

Upon boot, parse-kickstart parses the kickstart and searches for the first "network" stanza only. It then creates /tmp/ifcfg/ifcfg-* files. This works fine.
Additionally it generates an excerpt of cmdline, e.g. "bootdev=bond0 ip=...:bond0:...

Example:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
network  --hostname=vm-test8 --device=bond0 --mtu=1500 --bondslaves=enp1s0,enp2s0 --bondopts=mode=active-backup --bootproto=static --noipv6 --activate --ip=192.168.122.47 --netmask=255.255.255.0 --gateway=192.168.122.1
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Generated files by parse-kickstart:
 - /tmp/ifcfg/ifcfg-bond0
 - /tmp/ifcfg/ifcfg-bond0_slave_1
 - /tmp/ifcfg/ifcfg-bond0_slave_2

Generated stdout (then pushed to /etc/cmdline.d/80-kickstart.conf):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
ip=192.168.122.47::192.168.122.1:255.255.255.0:vm-test8:bond0:none:1500 bootdev=bond0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This is then used by nm-initrd-generator to generate NM profiles.

Apparently nm-initrd-generator doesn't rely on /tmp/ifcfg/ifcfg-* files, but only the command line:

/usr/lib/nm-lib.sh:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[...]
    /usr/libexec/nm-initrd-generator -- $(getcmdline)
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

From above, we can see that the generated stdout is broken and lacks the full definition of the bond, which causes an infinite hang to happen (well not exactly infinite, but almost):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[    7.369943] IPv6: ADDRCONF(NETDEV_UP): enp1s0: link is not ready
[    7.370838] 8021q: adding VLAN 0 to HW filter on device enp1s0
[    7.373143] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready
[    7.373987] 8021q: adding VLAN 0 to HW filter on device enp2s0
---> nothing then
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

There are 2 solutions for this:
1. Generate the appropriate cmdline
or
2. Generate files in /etc/sysconfig/network-scripts (this works, but I fear this will collide with initial boot parameters, if any)


Version-Release number of selected component (if applicable):

dracut-049-95.git20200804.el8


How reproducible:

Always

Steps to Reproduce: Boot with a kickstart hosted on a minimal DVD (don't setup the network initiallyà

1. Create a minimal DVD stub

  # mkdir rhel83.minimal && cd rhel83.minimal
  # cp -r /var/www/html/rhel83/{EFI,images,isolinux} .

2. Create a minimal kickstart

  # cat > ks.cfg << EOF
  url --url http://192.168.122.1/rhel83
  network  --hostname=vm-test8 --device=bond0 --mtu=1500 --bondslaves=enp1s0,enp2s0 --bondopts=mode=active-backup --bootproto=static --noipv6 --activate --ip=192.168.122.47 --netmask=255.255.255.0 --gateway=192.168.122.1
  EOF

3. Build the minimal DVD

  # mkisofs -o /tmp/rhel83.minimal.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -V "RHEL-8-3-0-BaseOS-x86_64" .

4. Boot a VM with 2 NICs (enp1s0, enp2s0) and append "inst.ks=cdrom:/ks.cfg" to kernel command line


Actual results:

Hang before switching root, no way to get a dracut shell.


Expected results:

Network configuration and installation continues.

Comment 1 Beniamino Galvani 2021-04-15 13:45:55 UTC
> There are 2 solutions for this:
> 1. Generate the appropriate cmdline
> or
> 2. Generate files in /etc/sysconfig/network-scripts (this works, but I fear this will collide with initial boot parameters, if any)

I think parse-kickstart should generate a kernel command line with all the networking parameters.

Options --bondslaves= and --bondopts= can be represented by a command line:

  bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]

Radek, do you think this is feasible?

Comment 2 Radek Vykydal 2021-04-16 14:31:28 UTC
(In reply to Beniamino Galvani from comment #1)
> > There are 2 solutions for this:
> > 1. Generate the appropriate cmdline
> > or
> > 2. Generate files in /etc/sysconfig/network-scripts (this works, but I fear this will collide with initial boot parameters, if any)
> 
> I think parse-kickstart should generate a kernel command line with all the
> networking parameters.
> 
> Options --bondslaves= and --bondopts= can be represented by a command line:
> 
>   bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]
> 
> Radek, do you think this is feasible?

Yes, this should work, upstream PR:
https://github.com/rhinstaller/anaconda/pull/3296

Comment 7 Radek Vykydal 2022-10-25 13:18:11 UTC
Kickstart test for the issue: https://github.com/rhinstaller/kickstart-tests/pull/818

Comment 9 Jan Stodola 2022-12-14 15:43:33 UTC
Reproduced on RHEL-8.7 with a kickstart file included on boot.iso using mkksiso (and also with "--nameserver=192.168.122.1" option added to the network command)

With the same steps using compose RHEL-8.8.0-20221213.d.0 with anaconda-33.16.8.4-1.el8, the installer successfully activated the bond device specified in the kickstart file and fetched stage2. bond0 was the only device with an IP address. The bond0 interface was also successfully activated on the installed system.

Marking as Verified:Tested

Comment 15 errata-xmlrpc 2023-05-16 08:15:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (anaconda bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2748