You are not logged in.

#1 2019-01-09 02:50:56

Registered: 2016-06-06
Posts: 199

What is the point of changing /proc/cmdline after booting?

Reading the wiki instructions for changing (hijacking) the kernel command line from within a running system, I wonder what are the real benfits. To the best of my knoweldge, /proc/cmdline is written while booting. While booting the next time, the boot loader will once again tell the kernel its command line according to what is recorded in the boot loader configuraion. Why, and when, will one benefit when changing the command line from a running system?
Can it be that I am missing the point? The wiki mentions debugging. Does debugging a special case? In what circumstances will the kernel reread its command line?

pantum-p1000-p2000-p3000-m5100-m5200-ppd-driver (AUR): PPDs, drivers, for Pantum P1000, P2000, P3000, M5100, M5200 printers.
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.


#2 2019-01-09 03:11:32

Inspector Parrot
Registered: 2011-11-29
Posts: 27,102

Re: What is the point of changing /proc/cmdline after booting?

Using that method would only change the parameters for the current boot.  As you note, they are read from the boot loader for the next boot.  That's the whole point of that section though: to change the current effective parameters without rebooting.

As for "rereading" the command line, I gather it's not really rereading that "file" to reload all parameters, but rather every time a kernel process needs a parameter, it checks for that parameter on the command line.  Following those instructions overwrites the command line, so when these processes later check, they get the new value.

In other words, rather than thinking of /proc/cmdline as some place from where the kernel periodically "rereads" the values - as (re)reading them implies that they are read from there to be stored somewhere else - it is rather the places where they are actually stored.  The steps in that wiki allow you to change what values the kernel is storing for parameters.

Last edited by Trilby (2019-01-09 03:13:32)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman


#3 2019-01-09 21:33:18

Registered: 2012-06-22
Posts: 796

Re: What is the point of changing /proc/cmdline after booting?

regid wrote:

In what circumstances will the kernel reread its command line?

If you reboot tongue
But it can fool userspace processes. I think systemd responds to some kernel command line arguments, so perhaps there is a use for that.
I'll be highly surprised if anyone demonstrates that bind-mounting over this file makes the kernel behave as if it was booted with different arguments than it actually was.


Board footer

Powered by FluxBB