[SOLVED] Network configuration gets messed up after boot
CentOSThis forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
on a freshly installed centos 7.3 system two network ports were configured for bonding. which worked perfectly until the next reboot.
networkmanager is disabled and masked, so from this side there should be no problem.
however after the reboot the ifcfg files of the bonded ports were overwritten by a stupid process called dracut. the whole configuration is messed up the bond interface and one physical interface get configured with the same ip adress, the /etc/resolve.conf gets overwritten but not with the search suffixes from the ifcfg files.......
building a new initrd during a state where the network configuration is working doesnt help.
does anybody know how to stop this dracut process from messing up the configuration during each reboot of the computer?
since an update to centos 7.4 the same mess happenes on some of our desktop stations the whole ipv6 configuration gets overwritten each reboot.
on centos 7.4 this trick doesnt work. the network configuration gets overwritten even with the bootparameter "networkstatic=yes" set.
i am wondering where this stupid dracut process takes its wrong information from. the static ip address set during installation of the system is nowhere in the configuration files of dracut. but it overwrites the configuration of the network with this address. additionally it wipes out every ipv6 configuration.
is there any other way to stop dracut from messing around with the network configuration?
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
I was hoping that would also work with CentOS 7.4, but anyhow try the following command;
Code:
systemctl mask rhel-import-state.service
Run the above as root, of course.
From what I'm understanding, it appears that this service copy's the network configuration from initramfs. I had a look at /lib/systemd/system/rhel-import-state.service (the service in question) and it appears (along with some other research I done) that if this service is disabled, it may stop your network configuration from being overwritten.
I have no way to test it myself, so let us know if it works for you.
Last edited by jsbjsb001; 09-29-2017 at 12:06 PM.
Reason: typo
this service seems not to be active on our systems or it has no effect.
after a lot of testing the whole thing seems to be still quite a mess.
the kernel parameter leads to doubled devices after the boot process on centos 7.4. however the ifcfg files don t get overwritten any more but the system is nearly unusable until a "systemctl restart network" command is done.
a not so invasive solution to the problem is described here: https://www.centos.org/forums/viewto...p?f=50&t=64258
this is working on centos 7.3 for the bonding interfaces and the ipv6 configuration. this survives even an update to centos 7.4. however when this solution is done on a freshly installed centos 7.4 the whole system gets unusable after a restart. each command needs 5 minutes to execute until a "systemctl restart network" command is done.
so after booting the whole network configuration is a complete mess until the "systemctl restart network" command is done.
dracut is still messing up the system.
very early in the boot process, dracut is starting dhclient and configuring the network devices.
(as far as i could find out this is a "feature" to enable the rare case of mounting the root filesystem over the network. however this is enabled per default)
we have dhcp servers on our network but these special computers with the bonding interface should be configured locally. therefore dhclient is not enabled but dracut is starting it anyway.
dracut is configuring the interfaces with dhclient even with all the tricks to stop this stupid behaviour mentioned above.
later in the boot process the bonding interface is configured. but instead of stopping the devices and reconfiguring them they are directly placeed into the bonding with their whole previous configuration intact.
the bonding interface has an ip address and each physical interface has still its own ip adress from the dracut configuration after the boot process is finished.
this leads to a messed up system (not sure why each command needs 5 minutes when the network is in this state)
the only way to rescue the system is to perform a "systemctl restart network" command and even this needs 5 minutes to get executed. afterwards the network is set up properly.
so the question remains is there a way to stop dracut from messing up the network configuration or is there a way to get rid of this stupid process?
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Hi campher,
Sorry it's still not working for you, I was hoping that we had finally got it...
A couple of thoughts...
1) When you say "the only way to rescue the system is to perform a "systemctl restart network" command and even this needs 5 minutes to get executed. afterwards the network is set up properly.", that sounds like a hint to me, but I'm not sure where you should look to act upon it though?
2) It seems to me that the solution is either dracut's configuration file or possibly a systemd config/option.
There are a couple of interesting settings in dracut's config file that I think are worth trying, but I would suggest you test it on just one machine and verify it works before going to your other machines;
Try changing /etc/dracut.conf as follows;
Code:
# dracut modules to omit
#omit_dracutmodules+=""
This setting looks like it omit's whatever modules that you specify in it's config file. Based on the link you provided, it seems like this may well be the setting your after.
Try changing the above to this:
Code:
# dracut modules to omit
omit_dracutmodules+="ifcfg"
# dracut modules to omit
omit_dracutmodules+="ifcfg"
thats working for centos 7.3 but not 7.4. the weird thing is when i configure this on a centos 7.3 and update to centos 7.4 it still works. when i install a centos 7.4 and configure afterwards the network is messed up the system gets dead slow until the network is set up properly again.
i even tried a
Code:
# dracut modules to omit
omit_dracutmodules+="dhclient"
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Well, the more I read about dracut, the more I'm getting a little confused myself. I just had a look at something and I think I should have said this before;
Code:
# dracut modules to omit
omit_dracutmodules+="network"
I have also found some interesting links that may help:
It sounds like this guy might have had either the same problem as yourself or a very similar one. But unfortunately he's not exactly clear on what the answer is.
I don't know if this would work, but you could always try building your own initramfs image. Get your machine(s) setup with a working config and then build an image, then get it to use the new image.
Last edited by jsbjsb001; 10-23-2017 at 01:34 PM.
Reason: corrections/additions
i found a solution
the file to prevent dracut from messing up the network /etc/dracut.conf.d/ifcfg.conf must look like this
Code:
omit_dracutmodules+="ifcfg network"
the "network" part was missing in my previous attempts.
afterwards a
Code:
dracut -fv
to build the init ramdisk and check if the network is really left alone by dracut
during the next reboot dracut does not start the dhclient anymore and the bonding ist set up properly.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Rep:
Well done campher!
Thanks for the update and the solution.
I'm glad you finally stopped it overwriting your network config.
I thought it was the omit_dracutmodules+="something" setting/option to stop dracut missing up your network config, I said in post #7 that you were after. I just give ya the wrong dracut config file.
Also, thanks for confirming that you need to build the init ramdisk again.
I'm sure this thread will help others.
But given we now know what the solution is and you have therefore solved it; could you maybe mark this thread as "solved" so future readers know there is a solution in this thread?
Due to extra NICs (9 ports in total with built-in), dracut was taking more than 5 min to fail getting DHCP for each port .
Removing the 2 modules above + clevis (dracut complains as it relies on network but we omit it) has speeded up powering up the system with more than 5 min.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.