1

This was prompted by another question elsewhere, which after digging into briefly a quick online search ("linux kernel command line override priority" and some variations) turned up absolutely nothing.

The issue is that /proc/cmdline indicates a parameter has been included twice with different values. My question is NOT about why that is or how it can happen, it's which one has precedence. In other words, given this as a commandline:

foo=12 console=tty1 foo=16

If foo is a setting which cannot meaningfully have two values, is there any convention for which one applies?

1 Answer 1

2

I’m not sure it’s documented explicitly in the kernel, but the x86-specific boot command-line parsing includes this comment:

Find a non-boolean option, that is, "option=argument". In accordance with standard Linux practice, if this option is repeated, this returns the last instance on the command line.

This allows users to add settings to the end of their command-line without caring about any preceding values in the command-line.

Looking at the generic parsing code confirms this: parameters are read one after another, and any value set by a duplicated parameter is overwritten by the last instance.

In your example, foo=16 wins.

Note that tools which parse /proc/cmdline have their own behaviour and may not follow the kernel convention.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .