Ubuntu Linux for Robotics · Lesson 91 of 96
Hardware deployment
Preparing a robot computer: images, services, updates, backups and rollback.
Estimated time · 60–90 min
Learning goals
What you will understand
- Explain hardware deployment 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
Deploying to real hardware means the robot must start by itself and be recoverable: install a minimal Ubuntu, add your packages from apt or a container image, create a systemd service for the bringup, set static network addresses, enable SSH with keys, and configure the firewall. Keep the configuration in Git or a script so a second robot can be made identically.
Update carefully: freeze package versions (apt-mark hold) on a working robot, test updates on a spare machine first, keep a backup image, and keep a rollback path (the previous container tag or a disk image). Never test new code first on an untethered robot.
Guided lesson
Work through these steps
- 1.
Open a terminal and record the current state before changing anything.
- 2.
Read the hardware deployment 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
sudo apt-mark hold ros-lyrical-navigation2 ros-lyrical-nav2-bringup
# Stop a working set of packages from being upgraded by accident.
sudo systemctl enable --now robot-bringup.service
# Start the robot software at every boot.
sudo hostnamectl set-hostname robot1
# Give the computer a stable name.
sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp
# Allow SSH from the robot network only.
sudo dd if=/dev/nvme0n1 of=/mnt/backup/robot1.img bs=4M status=progress
# Back up the disk to an image (check the device names twice).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 Hardware deployment. Expected result: The packages are marked as held
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: put ros-lyrical-navigation2 on hold so apt upgrade does not change it
apt-mark showholdExpected output
The packages are marked as heldStuck? Show the full solution (try it yourself first)
sudo apt-mark hold ros-lyrical-navigation2
apt-mark showholdExpected 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
Write a setup script that installs packages, creates the bringup service, sets the hostname and firewall, and run it on a second (virtual) machine to prove that the robot can be reproduced.
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.