#1495 PR merged: Add automatically some important kernel parameters to KERNEL_CMDLINE

Labels: enhancement, fixed / solved / done

schabrolles opened issue at 2017-09-15 11:45:

I propose to check the current kernel parameters used (in /proc/cmdline) to detect some important parameter we should use when booting in rescue mode (means add them in KERNEL_CMDLINE variable).

Based on the discussion with @gdha in #1400, I started to detect net.ifnames or biosdevname parameter in order to preserve interface naming between rescue mode and real system after migration.

schabrolles commented at 2017-09-15 15:02:

@gdha It was my thought.... I was starting this scipt by considering KERNEL_CMDLINE was an array ... but it was not ;-) May be @jsmeix or @schlomo could tell us why it is a variable and not an array.

@jsmeix, I've just made some adjustments (using a Array CHECK_KERNEL_PARAMETER in default.conf). Does it fit your expectation ? (not sure I understand what you mean by "implement it via
generically working code"
)

jsmeix commented at 2017-09-18 08:51:

FWIW:
Bash arrays are in the end only needed when the elements
could be strings (i.e. consist of several words) so that

# strings=( first 'second thing' last )

# for string in "${strings[@]}" ; do echo "'$string'" ; done
'first'
'second thing'
'last'

works.
When things are only words, a simple string is sufficient
because then simple

# words=" first second   third "

# for word in $words ; do echo "'$word'" ; done
'first'
'second'
'third'

already works.
Careful note quoting versus non-quoting!

schabrolles commented at 2017-09-18 13:45:

@jsmeix variable name changed. (and tested an ubuntu with net.ifnames)

I'm waiting for last feedback/approval from @gdha and @schlomo before merging this one.

schlomo commented at 2017-09-18 15:22:

Looks good to me. Did you check it with kernel options that are bare words without a =? Like gpt?

schabrolles commented at 2017-09-18 15:33:

@gdha, Yes I have some system (in PowerVM) where even if you put net.ifnames=0, the inet are name with biosdevname. But it is a first step ... (some other modification will come).
Without this one, you could face the following problem:

  1. During a migration of a system that have "net.ifnames=0" (source machine) interface is named "eth0"
  2. Migrate to a new system... So boot on the ReaR rescue media, interface could be named "enpos1" if running ubuntu.... So ReaR start the network migration and rename interfaces from eth0 to enpos1 (ubuntu is not using udev rules file by default).
  3. After migration, reboot the the "Real OS" .... but this one will restart with "net.ifnames=0" ... so network won't be setup correctly ... :(

That's why we need to copy this option into the rescue image.

schabrolles commented at 2017-09-18 15:45:

@schlomo, Yes it also works with parameters without = like quiet (just tested)

schlomo commented at 2017-09-18 15:48:

Thanks, go ahead and merge.


[Export of Github issue for rear/rear.]