Reputation: 31
I know when an (Android) bootloader starts loading kernel, it passes some parameters to the kernel (for example androidboot.verifiedbootstate, ...), which can be obtained via reading /proc/cmdline
file, but it could be read only on rooted devices. Was I right ? Is there any other way of getting kernel parameters in non rooted Android devices ?
Upvotes: 2
Views: 6116
Reputation: 1210
On Android 12 (and likely earlier/later versions, but I haven't tested), you can retrieve the kernel command line by taking a bug report. Bug reports are collected by Android's dumpstate
command, which can and does read /proc/cmdline
. Here are the three ways I know to collect a bug report:
am bug-report
(or am bug-report --progress
for an "interactive" report that shows a progress bar) on the device using adb shell
.adb shell bugreport
from your computer, optionally specifying a filename to save the report as (defaults to dumpstate-<DATE>.zip
).The device will take several minutes to collect the bug report. Once it's done (and while it's going if you chose an "interactive" report), it will display a notification.
Once you've collected the report, you need to retrieve it for viewing. If you chose option #3, adb
has already done that for you and the bug report will be present on your computer as a .zip
file. If you chose option #1 or #2, there are two ways to collect the report:
adb pull
. Bug reports are saved in /bugreports/
(which is a symlink to /data/user_de/0/com.android.shell/files/bugreports/
) on the device.Regardless of what you choose, you should end up with a .zip
file containing the bug report. Inside that zip file will be a text file named bugreport.txt
, dumpstate.txt
, or one of the preceding with a date appended. That file will contain a lot of information about the system state, including a line right at the top starting with Command line:
. That line shows the kernel command line.
Upvotes: 0
Reputation: 180060
In a 'normal' Linux, /proc/cmdline
is readable by everyone.
Android explicitly removes that read permission from /proc/cmdline
.
There is no other way to get at its contents because that would circumvent this protection. (And if somebody were to find a way, it would be quickly closed.)
Upvotes: 3