You copied the Doc URL to your clipboard.

Tracing Chrome on Chrome OS

MGD supports tracing the Chrome application in Chrome OS. This is useful for debugging websites, web apps, and Chrome applications. The methodology for this is similar to Tracing a Linux Application on Chrome OS, with a few differences.

Note:

You will need to set up SSH access to your Chrome OS device before you can trace Chrome with MGD.

Note:
Chrome OS will try to reboot when you attempt to stop the UI. To prevent this, you will need to modify the file /usr/share/cros/init/ui-post-stop by commenting out the following lines:
while ! sudo -u chronos kill -9 -- -1 ; do
 sleep .1
done

# Check for still-living chronos processes and log their status.
ps -u chronos --no-headers -o pid,stat,args |
 logger -i -t "${JOB}-unkillable" -p crit

Once you have SSH access and the ability to stop the UI, you will need to install MGD onto your device.

  1. Follow the MGD Daemon and interceptor installation instructions in Tracing a Linux Application on Chrome OS.
  2. You will need to set up a password for the "chronos" user by starting an SSH session as root and using passwd chronos
  3. Start a new SSH session, this time using the chronos user: ssh chronos@(IP address)
  4. From your root user SSH session, launch mgddaemon. You may need to restart the root session after starting an SSH session as chronos.
  5. Connect to your Chrome OS device from MGD.
  6. From your chronos SSH session, suspend the Chrome OS UI using the command sudo stop ui.
  7. You will need to preload the interceptor library and launch Chrome from the chronos user SSH session. For example:
    LD_PRELOAD=/usr/bin/mgd/libinterceptor.so /opt/google/chrome/chrome \
    --ozone-platform=gbm --ozone-use-surfaceless \
    --user-data-dir=/home/chronos/ --bwsi \
    --login-user='$guest' --login-profile=user
    More information about preloading the interceptor library can be found in Tracing an OpenGL ES, EGL, or OpenCL Application.

You should start to get trace data appearing in the desktop MGD client.

Note: On some devices, Chrome may not launch correctly while the desktop MGD client is connected, and will launch numerous sub-processes. If this happens, you can disconnect the MGD client and Chrome should launch correctly. You should be able to connect MGD and trace Chrome after it has launched.
Was this page helpful? Yes No