captree - Linux
Overview
captree is a command-line tool used to capture and record the system boot process of Linux systems. It provides a detailed trace of the boot sequence, including kernel boot parameters, device initialization, and system services startup. captree is particularly useful for troubleshooting boot issues and performance analysis.
Syntax
captree [options]
Options/Flags
- -b: Boot device. Specify the device from which the system boots.
- -f: Filename. Name of the output file to save the boot trace. Defaults to captree.txt
- -m: Monitor. Specifies the type of monitoring. Options include:
- full: Captures the entire boot process.
- preinit: Captures the process up to the initialization of system services.
- postinit: Captures the process from the initialization of system services onward.
- -o: Output format. Specify the format of the output trace. Options include:
- text: Plain text format.
- html: HTML format for easier readability.
- -p: Print level. Sets the verbosity of the output. Options include:
- 0: Minimal output.
- 1: Normal output.
- 2: Verbose output.
- -r: Read-only mode. Only reads the boot trace from the specified file.
- -s: Size. Limits the size of the output file in bytes.
- -w: Wait time. Sets the timeout period in seconds before the process is automatically terminated.
Examples
Capture the entire boot process:
captree -m full -f boot.txt
Capture the boot process up to system service initialization:
captree -m preinit -f earlyboot.txt
Read a saved boot trace and display in HTML format:
captree -r -o html boot.txt
Common Issues
Permission Denied Errors:
- Ensure that you have sufficient permissions to access the specified boot device or file.
Invalid Output Format:
- Check that the specified output format is valid. captree supports text and HTML formats.
Integration
Combining captree with systemd:
- captree can be integrated with systemd to automatically capture boot traces during system boots. Configure the following in
/etc/systemd/systemd.conf.d/captree.conf
:
[Service]
ExecStart=/usr/sbin/captree -m full -f /var/log/boot.txt
Related Commands
- systemd-analyze
- dmesg
- journalctl