Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b771279 authored by Tom Cherry's avatar Tom Cherry Committed by android-build-merger
Browse files

Merge "init: add tips for debugging linker errors when launching init services" am: 3699dbe2

am: dcec1930

Change-Id: Ib9b93fff9ab1d02dddc65ca27e49b29371fa09ba
parents 4fb34975 dcec1930
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -784,6 +784,12 @@ affected.

Debugging init
--------------
When a service starts from init, it may fail to `execv()` the service. This is not typical, and may
point to an error happening in the linker as the new service is started. The linker in Android
prints its logs to `logd` and `stderr`, so they are visible in `logcat`. If the error is encountered
before it is possible to access `logcat`, the `stdio_to_kmsg` service option may be used to direct
the logs that the linker prints to `stderr` to `kmsg`, where they can be read via a serial port.

Launching init services without init is not recommended as init sets up a significant amount of
environment (user, groups, security label, capabilities, etc) that is hard to replicate manually.

+2 −1
Original line number Diff line number Diff line
@@ -490,7 +490,8 @@ Result<void> Service::Start() {
        SetProcessAttributesAndCaps();

        if (!ExpandArgsAndExecv(args_, sigstop_)) {
            PLOG(ERROR) << "cannot execve('" << args_[0] << "')";
            PLOG(ERROR) << "cannot execv('" << args_[0]
                        << "'). See the 'Debugging init' section of init's README.md for tips";
        }

        _exit(127);