Red Hat Bugzilla – Bug 1266215
%post script in kickstart, on HP Gen9, includes non-chroot /etc/sysconfig/network-scripts for network commands
Last modified: 2016-11-25 08:07:37 EST
Created attachment 1076687 [details]
Description of problem:
In the kickstart, user defines a static ip for eth0 and installs the system. In a %post script, user creates new ifcfg files for required network configuration:
ifcfg-eth0, in chrooted environment does not contain any ip information, only that it is a slave.
After newly created files, running "service network restart" shows it interacting with more interfaces then normal. Additionally, eth0 is set as a slave and is incorrectly given its IP from the anaconda install. Any attempt to reset the interfaces leaves eth0 with its old IP and the default gateway sticks to eth0 (instead of going to bond0).
Running "ip route del default" will remove the eth0 default gateway.
Running "ifup bond0" will then correctly set the default gateway to bond0.
Resetting the environment with the following commands, while in chroot, will cause the "service network restart" and "ifup,ifdown" commands to work properly and no longer apply an IP to eth0
Rebooting the system resolves these issues and network works as it should. This does not occur on the customers Gen8 hardware. Only gen9.
Version-Release number of selected component (if applicable):
---Steps to Reproduce---
This is post script environment. system mounted at /mnt/sysimage. %post runs in chrooted environment. You must include script or pause install at post and "ctrl+alt+f2" to access terminal
0.service NetworkManager stop; chkconfig NetworkManager off
1.Use static ip during kickstart install for eth0
2.%post script recreates ifcfg-eth0 and ifcfg-bond0 files
3."service network restart"
4."route -n" (((Check Default gateway interface. It should be bond0, not eth0)))
5."ifdown eth0; ifup bond0" (((Default gateway does not update again)))
6."ip route del default"
7."ifup bond0" (((Default gateway is now bond0)))
Default Gateway does not update to correct bond0 interface and eth0 retains anaconda install IP.
"service network restart" brings all interfaces down and back up with correct configuration. eth0 should be a slave with no IP.
The workaround we discovered was to run these two commands after the network scripts finishes. (But before the oracle script)
/sbin/ip route del default
This will delete the default gateway linked to "eth0". Then when it brings up bond0, it will set the default gateway to the correct interface. Resetting networking or bringing up eth0 will result in the default gateway switching back to using eth0 and networking will fail.
Created attachment 1076688 [details]
Created attachment 1076689 [details]
Customer Network Script Called in %post. Script completes, then install pauses
This isn't an Anaconda issue, and I'm not sure if doing this inside the %post chroot is expected to be reliable, moving to NetworkManager for comment.
> 0.service NetworkManager stop; chkconfig NetworkManager off
I am reassigning to initscripts, because NetworkManager was switched off and thus ifup should handle the networking.
For debugging, it may help to add "-x" option to bash  in /etc/sysconfig/network-scripts/ifup and /etc/sysconfig/network-scripts/ifup.
I can't see the bonding attempt in anaconda.syslog. Where are the logs suppose to be?
I have requested the customer enable post script logging so we can get a better log. I did not find one myself in the sosreport
Specifically is there any command output or additional logs/debug you would like to see? I troubleshot this when the script hung by going to the second tty. I should be able to add any commands we ran or need to run to see the output. Then log that and attach it here.