| # Copyright 2012 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Chromium OS debug daemon" | |
| author "chromium-os-dev@chromium.org" | |
| # Start the debugd early to include kernel logs in the crash reports for early | |
| # Chrome crashes. E.g., in b/304370964, Chrome crashed on startup because it | |
| # failed to find the primary DRM device, and we need debugd available before | |
| # the login prompt to include the kernel logs. | |
| start on started boot-services | |
| stop on stopping system-services or starting halt or starting reboot | |
| respawn | |
| oom score -100 | |
| tmpfiles /usr/lib/tmpfiles.d/debugd.conf | |
| pre-start script | |
| # Dev mode only setup. | |
| if [ "$(crossystem cros_debug)" = "1" ]; then | |
| systemd-tmpfiles --create --remove --clean \ | |
| /usr/lib/tmpfiles.d/on-demand/debugd-dev.conf | |
| fi | |
| # NB: copy logs of stateful (re)creation / powerwash. | |
| # TODO(b/290114273): Move this to tmpfiles.d. | |
| cp -aPZ --remove-destination \ | |
| /mnt/stateful_partition/unencrypted/clobber.log \ | |
| /mnt/stateful_partition/unencrypted/clobber-state.log \ | |
| /mnt/stateful_partition/unencrypted/preserve/powerwash_count \ | |
| /var/log/ || true # croslint: disable | |
| end script | |
| exec /usr/sbin/debugd | |
| # Wait for daemon to claim its D-Bus name before transitioning to started. | |
| post-start exec minijail0 -u chronos -g chronos /usr/bin/gdbus \ | |
| wait --system --timeout 15 org.chromium.debugd |