Linux basics: the operating system behind robots running ROS2
Atlasbot · 20/8/2026 · 11 min read
Nearly all of the ROS2 documentation, every LiDAR/camera driver, and every SLAM/Nav2 example assumes you're running Linux — no coincidence. Before installing ROS2 or connecting sensors, you need to understand how Linux works differently from Windows, because most newbies' "follow the instructions but still not running" errors come from not being familiar with three things: directory trees, file permissions, and how to install software.
What layers does the Linux architecture consist of?
Linux is not a single operating system but a kernel (operating system kernel) — the core that communicates directly with the hardware (CPU, RAM, USB, network) — packaged with countless other software into a complete distribution (distro). Ubuntu, Debian, and Fedora all use the same Linux kernel but differ in packaging, software management tools, and usage goals.
Three main classes to know:
- Kernel — manages hardware, processes, memory. Users usually do not manipulate the kernel directly.
- Shell — command line program (
bash,zsh...) that accepts input commands and calls the kernel for execution. This is where you actually work when you open the terminal. - Applications — everything that runs on Linux (including ROS2) is a program that calls down to the kernel through intermediate layers.
Why is ROS2 associated with Linux?
ROS2 uses many low-level Linux mechanisms — device permissions (/dev/ttyUSB0, /dev/video0), processes and signals (process/signals) to manage nodes, and a DDS system that communicates over the network the way Linux handles sockets. Running ROS2 on Windows/macOS is theoretically partially supported, but most robot hardware drivers (LiDAR, camera, motor) are only documented and well-tested on Ubuntu.
In short: Linux = kernel (core) + shell (where you type commands) + applications — Ubuntu is a specific packaging of Linux, not "another Linux".
Linux directory tree (Filesystem Hierarchy)
Unlike Windows (drive C:, D:...), Linux has a single directory tree starting from / (called the root), every other drive/partition is "mounted" at some point in this tree.
| Directory | What does it contain? |
|---|---|
/home/<user> | Each user's personal folder — where you usually work, equivalent to C:\Users\<name> |
/etc | System configuration files (e.g. network configuration, udev rules) |
/usr/bin, /bin | System and user-installed executable files (programs). |
/dev | Hardware device, represented as a file — LiDAR/Arduino plugged into USB will appear here, e.g. /dev/ttyUSB0 |
/var/log | System log — the first place to look when there's a puzzling error |
/opt | Where third party software (not passing apt) is often installed, e.g. JetPack SDK on Jetson |
The fact that the hardware device (USB, sensor) appears as file in /dev is the biggest difference compared to Windows — reading data from LiDAR is essentially just reading a /dev/ttyUSB0 file, and this is why the "USB & Serial" and "udev rules" articles in this section are important when assembling a real robot.
File permissions (permissions)
Each file/folder on Linux has 3 permission groups: owner, group, others — each group has 3 permissions: read (r), write (w), execute (x).
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Aug 20 10:15 /dev/ttyUSB0
Read from left to right: crw-rw---- means the owner (root) can read/write, the group (dialout) can read/write, others have no rights. This is why error Permission denied when opening USB port is extremely common with new users — users who are not currently in group dialout.
# Add the current user to the dialout group to use the USB port without sudo
$ sudo usermod -aG dialout $USER
# A log out/re-in (or reboot) is required for this to take effect
sudo (superuser do) allows running a command with administrator (root) privileges — used when the command needs to change something outside the scope of the user that is usually edited, but sudo should not be used everywhere for every command that reports a permission error, because it can create a file owned by root in a place where it shouldn't be, causing more troublesome access permission errors later.
Manage software packages with apt
Windows installs the software by downloading file .exe from the home page; Ubuntu uses APT (Advanced Package Tool) to download and install from a centralized software store — this is how ROS2, libraries, and drivers are mostly installed in the ROS2 guide.
$ sudo apt update # Update the latest software list from the repository
$ sudo apt install ros-humble-desktop # Install a specific package
$ apt list --installed | grep ros # Check installed packages
apt update only downloaded the latest version of list, didn't install anything — forgetting to run before apt install is a common cause of the installation command saying "Unable to locate package" even though the package is real.
Technical details
Formulas
The literal (rwx) and numeric (octal) access rights used by the chmod command are essentially the same thing — each right corresponds to 1 bit, adding up to 1 octal digit (0-7) for each owner/group/others group:
r (read) = 4, w (write) = 2, x (execute) = 1
Octal value of a group = total rights in that group
VD: chmod 664 file.txt
Owner: rw- = 4+2+0 = 6
Group: rw- = 4+2+0 = 6
Others: r-- = 4+0+0 = 4
→ "664" means master and group can read/write, others can only read
Parameters
Common permission levels and actual usage scenarios:
| Octal value | Meaning | Used for |
|---|---|---|
644 | Owner read/write, group/others read only | Regular files (scripts, non-sensitive config) |
755 | Owner reads/writes/executes, group/others reads/executes | Executable file, directory |
600 | Only owner reads/writes, group/others do nothing | Sensitive files (private SSH keys, see SSH article) |
Register / Bit / Byte
9 permission bits (3 groups × 3 bits rwx) is a practical example of the bit manipulation technique learned in the embedded programming section — each independent bit turns on/off exactly a specific permission, and octal is just a shorthand for 3-bit-one-digit (like hex for short for 4-bit-one-digit) — same principle, different base.
Practical applications
On an AMR robot that uses Jetson as the main computer, /var/log (especially journalctl — systemd's log reader) is the first place to check when a service that automatically starts at boot time (eg: ROS2 node running in the background) has an error in the background that no one standing next to the screen can see — reading the correct log helps determine whether the robot "doesn't respond at power on" is due to a node crash, a device access error, or a service error. Haven't finished starting yet.
Common mistakes
Permission deniedwhen opening/dev/ttyUSBx— user is not in groupdialout, see commandusermod -aG dialoutabove.command not foundeven after installing — usually due to forgetting to runsource ~/.bashrcor opening a new terminal after installation, because the environment variable (PATH) is only reloaded when opening a new shell session.Unable to locate package— forgot the previoussudo apt update, or is missing the software repository (repository) containing that package.sudo: command not foundor repeatedly asking for password — normally,sudoalways requires the user's own password (not the individual root password) for administrative operations.
Conclusion
Three concepts — the unified directory tree from /, owner/group/others file permissions, and package management through apt — are the foundation for reading and understanding any ROS2/driver installation instructions without having to follow them mechanically. The next article in the column delves into Ubuntu — the specific Linux distribution that most of the ROS2 documentation targets.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.