Ubuntu Linux for Robotics · Lesson 53 of 96
ros2 doctor
Checking the installation, network, QoS and package versions.
Estimated time · 30–45 min
Learning goals
What you will understand
- Explain ros2 doctor in your own words
- Use it in a small workstation example
- Verify the result instead of assuming it worked
Understand the idea first
The mental model
ros2 doctor checks the health of your ROS 2 setup: the platform, the middleware, network interfaces, environment variables and package versions, and warns about problems such as an old distribution or a missing sourced environment. ros2 doctor --report prints the full detail.
Run it first when something is wrong on a new machine, and include its report when you ask others for help. It complements ros2 wtf (an alias), ros2 topic/node tools for the running graph, and the log files in ~/.ros/log.
Guided lesson
Work through these steps
- 1.
Open a terminal and record the current state before changing anything.
- 2.
Read the ros2 doctor commands and predict what each one does.
- 3.
Run the commands one at a time and compare each output with your prediction.
- 4.
Write the commands that worked in a setup note you can repeat later.
Worked example
Read it before you run it
ros2 doctor
# Run the checks and print warnings, if any.
ros2 doctor --report | head -40
# Print the top of the detailed report.
ros2 doctor --report | grep -i -E 'middleware|distro|rmw'
# Find middleware and distribution information.
ros2 doctor --report | grep -i network
# Look at the network section for interface problems.
ros2 doctor --report > ~/doctor_report.txt
# Save the report to attach to a bug report.What the example is doing
- 1.Lines without sudo only inspect or change files you own; sudo authorizes a system-wide change.
- 2.Read command output before moving to the next line. Stop if names, versions, disks, or paths differ from the lesson.
- 3.Comments beginning with # explain safety checks and are not executed by the shell.
Watch it run · The robot's computer
See what this code does
The terminal types this lesson's practice solution and runs it. The scene shows the kind of robot behaviour that code drives. It plays by itself and loops.
Demo for ros2 doctor. Expected result: All checks passed (or a list of warnings)
Practice code
Now type it yourself
Open a terminal, run the starter line by line (or save it as practice.sh and run bash practice.sh), and replace every TODO with your own command.
# TODO: run ros2 doctorExpected output
All checks passed (or a list of warnings)Stuck? Show the full solution (try it yourself first)
ros2 doctorExpected result
How you know it worked
- Each command completes without an unexplained error.
- Your notes contain the command, the important output, and what it proves.
Practical exercise
Apply the lesson
Run ros2 doctor on a working machine and save the report, then unset your sourced environment or change the domain ID on a second machine and compare what doctor reports.
Before you continue
- You recorded the starting state
- Every command and output is understood
- The change can be repeated from your notes
If something goes wrong
Check ownership and permissions first. Do not add sudo unless the command changes a documented system location.
Check spelling, Ubuntu version, enabled repositories, and whether the previous installation command succeeded.