3 Commits

Author SHA1 Message Date
5ec1cff
8304c54b8c ksud: more verbose log (#3021)
Some checks failed
Build Manager / build-lkm (push) Has been cancelled
Build Manager / build-user_scanner (ubuntu-latest, All-linux-android) (push) Has been cancelled
Build Manager / build-ksud (ubuntu-latest, aarch64-linux-android) (push) Has been cancelled
Build Manager / build-ksud (ubuntu-latest, armv7-linux-androideabi) (push) Has been cancelled
Build Manager / build-ksud (ubuntu-latest, x86_64-linux-android) (push) Has been cancelled
Build Manager / build-manager (false) (push) Has been cancelled
Build Manager / build-manager (true) (push) Has been cancelled
2025-12-01 06:11:14 +08:00
Wang Han
8ddca5f310 ksud: Add process info in bugreport (#3014) 2025-11-30 13:31:39 +08:00
Wang Han
d4d42cae0d ksud: Remove warning for non-tty std 2025-11-29 19:05:40 +08:00
3 changed files with 8 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ fun getBugreportFile(context: Context): File {
val bugreportDir = File(context.cacheDir, "bugreport")
bugreportDir.mkdirs()
val processFile = File(bugreportDir, "process.txt")
val dmesgFile = File(bugreportDir, "dmesg.txt")
val logcatFile = File(bugreportDir, "logcat.txt")
val tombstonesFile = File(bugreportDir, "tombstones.tar.gz")
@@ -40,8 +41,10 @@ fun getBugreportFile(context: Context): File {
val shell = getRootShell(true)
shell.newJob().add("dmesg > ${dmesgFile.absolutePath}").exec()
shell.newJob().add("logcat -d > ${logcatFile.absolutePath}").exec()
// busybox ps has very few features for embed devices
shell.newJob().add("toybox ps -T -A -w -o PID,TID,UID,COMM,CMDLINE,CMD,LABEL,STAT,WCHAN > ${processFile.absolutePath}").exec()
shell.newJob().add("dmesg -r > ${dmesgFile.absolutePath}").exec()
shell.newJob().add("logcat -b all -v uid -d > ${logcatFile.absolutePath}").exec()
shell.newJob().add("tar -czf ${tombstonesFile.absolutePath} -C /data/tombstones .").exec()
shell.newJob().add("tar -czf ${dropboxFile.absolutePath} -C /data/system/dropbox .").exec()
shell.newJob().add("tar -czf ${pstoreFile.absolutePath} -C /sys/fs/pstore .").exec()

View File

@@ -21,9 +21,9 @@ pub fn on_post_data_fs() -> Result<()> {
}
#[cfg(unix)]
let _ = catch_bootlog("logcat", &["logcat"]);
let _ = catch_bootlog("logcat", &["logcat", "-b", "all"]);
#[cfg(unix)]
let _ = catch_bootlog("dmesg", &["dmesg", "-w"]);
let _ = catch_bootlog("dmesg", &["dmesg", "-w", "-r"]);
if utils::has_magisk() {
warn!("Magisk detected, skip post-fs-data!");

View File

@@ -5,7 +5,7 @@ use crate::{
use anyhow::{Context, Ok, Result, bail};
use getopts::Options;
use libc::c_int;
use log::{error, warn};
use log::error;
#[cfg(unix)]
use std::os::unix::process::CommandExt;
use std::{
@@ -75,7 +75,6 @@ fn set_identity(uid: u32, gid: u32, groups: &[u32]) {
fn wrap_tty(fd: c_int) {
let inner_fn = move || -> Result<()> {
if unsafe { libc::isatty(fd) != 1 } {
warn!("not a tty: {fd}");
return Ok(());
}
let new_fd = get_wrapped_fd(fd).context("get_wrapped_fd")?;