openSUSE / kdump

kernel dump helpers
GNU General Public License v2.0
22 stars 24 forks source link

Use gwaddr from KDUMP_COMMANDLINE_APPEND #11

Closed gfigueira closed 4 years ago

gfigueira commented 5 years ago

In case a static network configuration is used and the gateway set in KDUMP_COMMANDLINE_APPEND is different than the one currently set in the system, the rebuild of the initrd will generate a non-working configuration.

This config option should hold "Additional kernel command line options for the kdump kernel", according to the Implementation Guide. Other comments from the source also make clear the intent of the option:

# For static configuration, you may have to add the
# configuration to KDUMP_COMMANDLINE_APPEND.

In order to set the correct gateway address it is necessary to read the config, more specifically the 3rd value in the "ip" tuple and use it to set the correct gateway in the kdump environment.

In the current upstream version, the gateway set is always the current gateway set in the system:

590     gwaddr=$(ip route show 0/0 | sed -n 's/.* via \([^ ]*\).*/\1/p')

In order to fix this, $kdump_net_mode is used in a case statement and if the mode is static, the $gwaddr variable is set using the data inside the config option. The case statement is reused from init/module-setup.sh:203 with some slight changes.

On all others dhcp modes, the old "ip route" command is used to read the current gateway address running in the system.

The previous version of the patch, which didn't include checking the content of $KCA_GW, has been tested by me and a customer and it fixes the problem in this corner case.

In this new version I try to mitigate the problem of null or incorrect address in $KCA_GW (which will also not break the program for users who use static config plus the current system's gwaddr).

Please feel free to point out any mistakes so I can amend it.

ptesarik commented 5 years ago

Hi Gustavo, well, the original intention is that you put the complete ip= option into KDUMP_COMMANDLINE_APPEND. But that does not work either, because kdump always adds its own version if it decides that network is needed. You would have to disable network configuration by setting KDUMP_NETCONFIG to an empty string, but then the dracut network module is not included…

So, it is already broken, but if we have to look at KDUMP_COMMANDLINE_APPEND, I would rather detect a custom ip= string and avoid the automatic detection if it is found. That way we won't have to keep adding command line options if another parameter of the static configuration needs to be tweaked.

What do you think?

gfigueira commented 4 years ago

Hello Petr, can you please be more specific? Using ip= in KDUMP_COMMANDLINE_APPEND is an invalid action for static configuration?

ptesarik commented 4 years ago

Hi Gustavo, I don't think it is invalid to add an ip= option to KDUMP_COMMANDLINE_APPEND, but I'm not sure it works in all circumstances. Essentially, kdump already puts an ip= option into the initrd. If you add another one to KDUMP_COMMANDLINE_APPEND, dracut will have two network configurations. This is supported by dracut (e.g. to bring up more than one network interface at startup), but I haven't found good documentation on what happens if there are multiple configurations for the same interface. Of course, if you have already verified that the command line overrides whatever default in the initrd, then there is no issue.

gfigueira commented 4 years ago

After setting up the correct network setup I can no longer reproduce the issue. The patch is wrong, so I'm closing the MR.