UP | HOME

Computer Setup

Hardware Overview

  1. MSR provides new Linux laptops for you to use while in the program.
  2. To build your Linux skills, use these laptops for everything!
  3. Most robots are computers, so the ability to maintain Linux systems is crucial.

Laptop Specifications

  • System76 Adder 4 Workstation (addws4)
  • Intel Core i9-14900HX (5.8 GHz, 36 MB Cache, 8 P-Cores 16 E-Cores)
  • 8GB NVIDIA GeForce RTX 4060 with 3072 CUDA Cores
  • 64 GB RAM (DDR4 5200 MHz)
  • 1 TB PCIe4 Hard Drive
  • 15.6" 1920x1080@144Hz LCD
  • Full Technical Documentation
  • This laptop is big, heavy, and powerful. Think of it more like a portable desktop than a laptop.

Why Linux?

Being able to use Linux is an important skill for robotics engineers, but it a skill that is not usually taught explicitly. By using Linux every day as your main computing platform and providing your own technical support you will become a knowledgeable Linux user. You can always ask for help, but maintaining a do-it-yourself mentality is crucial to advance your learning. Spending a little extra time to make your computer fit you and fix the problems you encounter (or create) is a great way to become proficient.

Caution

  1. Read this document carefully.
  2. Backup your work regularly.
  3. Don't spill a drink on your laptop.
  4. Don't leave your laptop behind during a night out.
  5. Don't close your laptop screen on a foreign object.
  6. Do not drop your laptop or drop something on your laptop.

Installing Linux

The laptops come with Ubuntu 22.04 LTS, but we will be using Ubuntu 24.04 LTS.

I have distributed USB drives with the installer ready to go.

This will install a slightly-customized version of Ubuntu Linux 24.04 Noble Numbat. For more details see Ubuntu Minimal.

Booting

  1. Ensure that there is no ethernet cable plugged in.
  2. Ensure that the power cable is connected.
  3. Plug the USB drive into a USB port.
  4. Turn the computer on (hold the power button for about 1 second release, and wait 1 second for it light up).
  5. When the System76 Screen appears, with text on the bottom, press ESC to enter the UEFI setup.
  6. Select One Time Boot.
  7. Select the Third Option (Samsung PSSD T7)
  8. When the Grub menu appears select "Try or Install Ubuntu" (Press Enter)
  9. Wait for the Ubuntu Installer to open

Installation

The installation will bring you through a series of screens.

  • After making the proper selections (as per this guide), click Next.
  • It is crucial that you pay attention and enter the proper settings.
  • Each screen below is presented in-order and identified by the value of the installation window titlebar.

The Installation Screens

Welcome To Ubuntu
Keep the default (English).
  • You can setup other languages later, but use the default settings for the installation.
Accessibility
Keep the defaults.
  • If you need some accessibility features to get through the installation select them but let me know.
Keyboard Layout
Keep the default (English US).
Internet Connection
Keep the default (Do not connect to the internet). Do not, under any circumstances, connect to the internet.
Try or Install Ubuntu
Keep the default (Install Ubuntu).
Type of Installation
Keep the default (Interactive Installation).
Applications
Keep the default (Extended Installation)
Optimize your Computer
Keep the default: (Unchecked Install third-party and Unchecked Download and install)
Disk Setup
Select Erase disk and Install Ubuntu. Do not choose any advanced features.
Create Your Account
Do not accept the defaults here.
  • Enter your fullname for Your Name. This will auto-populate the other fields. DO NOT ACCEPT THE AUTO-FILLED VALUES
  • Your computer's name: choose a name that is between 4-15 characters, all lowercase letters and numbers, starting with a letter.
  • Your username: choose a username between 2 and 12 characters, all lowercase letters and numbers, starting with a letter.
  • Choose a Strong password that you will remember
  • The restrictions on computer name and username here are more restrictive than necessary but they make life easier in the future.
Select your timezone
Choose Chicago
  • See if you can click on the map at the location of Chicago! (Or you can type it)
  • Before proceeding, Location should say Chicago and Timezone should say America/Chicago
Ready to install
Click Install
(no term)
When the installation is complete restart the computer

First Boot

Login

  • Click your username and enter your password to login.

Terminal

  1. Type Ctrl-Alt-T to open a terminal window.
    • All commands will be entered from the terminal.
    • To paste to the terminal use Ctrl-Shift v.
    • To copy from the terminal use Ctrl-Shift c.
    • After typing a command press Enter to execute it.

Internet

  • List wireless connections with nmcli dev wifi list.
  • For on-campus WiFi connect to eduroam network (be sure to substitute <netid> with your netid):
    • I have provided an eduroam profile for you that just must be modified with your netid
    • Run nmcli --ask con mod eduroam autoconnect yes 802-1x.identity <netid>@northwestern.edu to setup your username
      • The <netid> (including the <>) should be replaced with your netID (same ID used to log on to Canvas).
    • Run nmcli con up eduroam to activate wireless
      • Enter your netID password when prompted (the one used to log into canvas)
  • Connect to most WiFi Networks with nmcli --ask dev wifi connect <ssid>.
    • Replace <ssid> (including the <>) with the name of the network.
    • You will be prompted for a password if the network is encrypted.
  • Wired connections automatically work when plugged into an active ethernet port.
Eduroam Details

The custom installation comes with a pre-filled in connection profile for eduroam, so you only need to change the username and password. Here are details on how to setup an eduroam connection from scratch.

nmcli con add type wifi \
          con-name eduroam \
          ssid eduroam \
          802-1x.eap peap \
          802-1x.identity <netid>@northwestern.edu \
          802-1x.phase2-autheap mschapv2 \
          wifi-sec.auth-alg open \
          wifi-sec.key-mgmt wpa-eap

System76 Setup

System76 provides drivers for their laptops

  • The driver enables you to switch graphics modes and change other settings
  • These instructions are adapted from System76 Ubuntu Installation

System76 Driver

Install the System76 Driver and nvidia drivers. All commands are entered in the Terminal:

sudo add-apt-repository -y ppa:system76-dev/stable
sudo apt install --no-install-recommends system76-driver
sudo apt install system76-driver-nvidia
sudo apt upgrade
reboot # will reboot your computer
  • The sudo apt upgrade command above may actually downgrade some packages. We are now getting some hardware-specific packages from System76 rather than Ubuntu so the versions do not match. Precisely what benefits the System76 versions of the packages provide is a bit of an open question but System76 makes its own Linux Distribution and makes (or at least specs-out) the hardware so presumably their versions work better with our hardware (and at least we can complain to them when they don't).
Graphics Modes
  1. These computers have two graphics cards: the NVIDIA and the integrated Intel, and several modes:
    • nvidia - exclusively use the NVIDIA graphics card. Most power usage, most performance, medium stability (nvidia drivers right now have some quirks)
    • integrated - intel only: least power usage, least performance, most stability (Intel's drivers are open-source and integrated with the Linux Kernel)
      • nvidia card is not visible to the operating system, the HDMI port will not work (external monitor via USB-C only)
    • hybrid - uses both, graphics are routed through the NVIDIA card but most rendering done on intel: medium power usage, tunable performace, worst stability (this is complicated)
    • compute - uses the intel card for graphics but the nvidia is available for compute tasks
      • HDMI port will not work (external monitor via USB-C only)
      • Maximizes compute on the GPU while still enabling a GUI (the desktop uses GPU resources, but its running on the intel GPU).
    • Change the setting by running sudo system76-power graphics <mode> and rebooting. By default you will be using hybrid
  2. Display Server:
    • X11 - Legacy display server. Still used because it has features not fully realized in its replacement. Highest-level of compatibility but worse performance
    • Wayland - Newest display server, some programs or features of programs not compatible. Best performance, worse compatibility (particularly with NVIDIA cards)
    • Change between X11 and Wayland by clicking the gear icon in the lower-left corner when logging in.
  3. As you can see, there are many combinations of Graphics Mode and Display Server.
    • Depending on what you are doing it may be advantageous to switch.
    • It is certainly easier to stick to one and stay with it.
    • The ideal in my view is hybrid and wayland but this tends to be the least-stable combination.
    • Use echo $XDG_SESSION_TYPE to determine if you are using X11 or Wayland

Web Browser

Firefox

Firefox is already installed. It comes from a package repository provided by Mozilla.

  • I highly recommend that you install the UBlock Origin extension to block ads.

Google Chrome

  • Google Chrome is not part of Ubuntu so it must be downloaded directly from Google.
  • It is also available as a snap, but these instructions assume we are avoiding snaps
  • Download and install the google chrome package:

    wget -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo apt install /tmp/chrome.deb
    

Turn Off The Beep

  • You may have already heard some annoying sound effects and beeping. (Try it by pressing Backspace several times on an empty terminal line).
  • To mute these sounds run gsettings set org.gnome.desktop.sound event-sounds false.

Development Environment

Text Editors

As computer programmers, you will be spending a lot of your time writing code in a text editor. Fortunately there are many choices available. Some suggestions are below: feel free to cycle through and choose one that you like.

Visual Studio Code

  1. The most popular choice for recent MSR students.
    • Widely used.
    • Relatively easy to setup.
    • Supported (or controlled by) Microsoft, some plugins are not open source.
  2. From the terminal:

    wget -O /tmp/code.deb "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"
    sudo apt install /tmp/code.deb
    
  3. Launch VSCode using code.
    • I opt-out of the telemetry collection (lower right) when first starting code.
  4. More details on VSCode

vim

If you like simplicity and modal text editing.

  • Install with apt install vim (terminal-only) or apt install vim-gtk3 (with gui).
  • There is also neovim, a popular fork of vim.
  • There is a steep learning curve for vim.

emacs

Eight Megabytes and Constantly Swapping (this is a dated joke).

  • My editor of choice: I use emacs with evil mode because …(insert hour-long discussion here)…
  • spacemacs and doomemacs are popular pre-configured versions of emacs.
  • sudo apt install emacs

Other

So many others to choose from.

real_programmers.png
Figure 1: https://xkcd.com/378/.

Version Control (git)

  1. Install git from apt (sudo apt install git gitk)
    • gitk allows you to visualize the git repository
    • For more information see Git Introduction.
    • sudo lets you run commands as the superuser. Enter your own password when prompted
  2. Setup your identity and the default branch name:

    • Remember, when replacing <Your Name> with your name, don't include the <>.
    git config --global user.name "<Your Name>"
    git config --global user.email "<Your email>"
    git config --global init.defaultBranch main
    
  3. Setup the program that you will use to edit git commit messages git config --global core.editor <editor>
    • If you are using code, add the --wait flag: (git config --global core.editor 'code --wait')

Python

Install pip, a package manager for python, ipython, an interactive python read-eval-print-loop (REPL), and support for virtual environments:

  • sudo apt install python3-pip ipython3 python3.12-venv.

Robot Operating System (ROS 2)

Here are some abbreviated instructions for installing ROS 2 on an x86 PC, Many steps are skipped, assuming you have completed the prior steps in this guide.

  • We'll learn more about ROS 2 later, these instructions are focused on getting it installed quickly.
  • The instructions below are summarized from Official ROS 2 Jazzy Install Instructions

    # Download ROS encryption keys
    sudo wget -O /usr/share/keyrings/ros-archive-keyring.gpg \
         https://raw.githubusercontent.com/ros/rosdistro/master/ros.key
    
    # Add the Repository by creating /etc/apt/sources.list.d
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
          http://packages.ros.org/ros2/ubuntu noble main" \
          | sudo tee /etc/apt/sources.list.d/ros2.list
    
    # Update the package list
    sudo apt update
    
    # Install the development tools
    sudo apt install ros-dev-tools
    
    # Install ros2 iron
    sudo apt install ros-jazzy-desktop
    
    # Initialize rosdep (makes it easy to install ros dependencies)
    sudo rosdep init
    rosdep update
    
    • Add the line source /opt/ros/jazzy/setup.bash to the end of ~/.bashrc file.
      • The ~ expands to /home/<user> where <user> is your username, so the file's path is /home/<user>/.bashrc.
      • Edit the file using the Text Editor of your choice, for example code ~/.bashrc.
      • This file is executed whenever you start bash and automatically configures the ROS environment.
    • Restart the terminal and echo $ROS_DISTRO. It should display jazzy.

Realsense

  1. Use sudo apt install ros-jazzy-realsense2-camera ros-jazzy-realsense2-description to install the realsense SDK and ROS packages.
    • ros-jazzy-realsense2-camera brings in ros-jazzy-librealsense2, the realsense library
    • You will be receiving a version of ros-jazzy-librealsense2 modified from the standard ROS 2 version, from the NUMSR PPA
    • The modified version of the library enables support for python, cuda, and installs the udev rules automatically

Interbotix Arms

One robot we will use is the PincherX 100 robot arm.

  • The software is not released as a binary package for ROS 2 so you will need to compile it yourself.
  • I have created a .repos file which lists all the git repositories needed to compile the packages required for the Interbotix arms.
    • You can use this file to automatically download all the code that is needed, even though it is spread out across multiple git repositories.
# Create the workspace
mkdir -p ~/ws/interbotix/src
cd ws/interbotix
vcs import --input https://nu-msr.github.io/hackathon/images/interbotix.repos src

# Install dependencies
sudo apt install python3-transforms3d
rosdep install --from-paths src --ignore-src -r -y

# Build the workspace
colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF

# Setup udev rules
sudo cp src/interbotix_ros_core/interbotix_ros_xseries/\
     interbotix_xs_sdk/99-interbotix-udev.rules /etc/udev/rules.d
sudo udevadm control --reload
sudo udevadm trigger

To use this new workspace, source ~/ws/interbotix/install/setup.bash.

Backups

You should frequently backup your work (e.g., the data in your home directory). Aside from hardware failures, as you experiment with the command-line it is easy to make a mistake.

First Line of Defense

  1. We have provided you with an external SSD. You can backup regularly.
  2. You can reformat the whole drive or you can keep it and use the 3rd partition for backups:
    • The advantage of using the third partition for backups is that you can boot the live Ubuntu environment anywhere and see your backup files
    • The MSR version of the Ubuntu Live CD also has Clonezilla installed (run it with clonezilla at the command prompt after booting to the live CD), which enables you to make snapshots of the full drive.
    • In general you only need to backup your data, but you could, after getting a good setup for your computer, create a Clonezilla image to be able to "factory reset" your computer to a basic installation with the other components you wanted installed.
  3. I use rdiff-backup (a backup program).
  4. Plug in the external drive to a USB 3 or USB c port
  5. Run rdiff-backup /home/<username> /media/<username>/<hdname>

Additional Options

  1. Restic does encrypted incremental backups to local devices or cloud services.
  2. The Cloud:
    • Dropbox: Has a good Linux client but costs money.
    • Google Drive: Your @u.northwestern account has unlimited storage, no official Linux support, web interface works.
    • rclone - can be used as unofficial client for Box, Google Drive, and many other systems.
  3. External Hard-drive
    • rdiff-backup - Stores incremental backups so you can go back in time without using much space.
    • Back In Time GUI backup program.
  4. A long list of backup programs.

Additional Customization

  • Here are some suggestions and ideas for customizing your computer further.
  • Almost nothing is required in Linux and everything is possible (with enough time).
  • With a little effort you can make your environment behave like either Windows or macOS, for example.

The Dock

  • The icons on the left of your screen allow you to switch between windows, and to open commonly-used applications.
  • The first few icons are always pinned to this bar, and the bar is called the Dock.
  • You can control which icons are pinned by right-clicking on any icon and then choosing either Add to Favorites or Remove from Favorites.
  • You can also re-arrange icons by left-clicking and dragging the icons.

Terminal Settings

  • You can add transparency and change terminal colors in the preferences.
  • A common choice is to have the terminal transparent enough to read text behind it but opaque enough to easily see text in it.
  • As with everything on Linux you have a choice. The default gnome-terminal is just one of many terminal emulators you can use.

System Settings

GUI

  1. Many settings are contained in the Settings menu. I encourage you to explore them.
  2. You can also install some additional tools. None are necessary (you can always edit configuration files)
    gnome-tweak-tool
    A GUI that provides several extra configuration options.
    gnome-extensions
    This package bundles several useful gnome extensions. Find out more at easily-developed extensions.
    dconf-editor
    Enables advanced editing of many settings.

Terminal

  • The gsettings command provides access to all settings via the command line.
  • Settings are grouped into schemas, and individual options are stored as keys under a schema
  • Use gsettings list-recursively to see all schemas and keys. The key is separated from the schema name by a space character
    • Use gsettings list-recursively | grep <something> to search for <something>
  • You can get the value of a key with gsettings get <schema> <key>
  • You can set the value of a key with gsettings set <schema> <key> <value>
  • For example, to undo "natural scrolling" on the touchpad use gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false

Keyboard shortcuts

  • GNOME (the default desktop environment) has several keyboard shortcuts.
  • See them and change them in the Devices->Keyboard under System Settings
  • Learning these shortcuts can save you time in the long run.
  • There are also other desktop environments available. With some work, the look and feel of the desktop can be made to mimic Windows, MacOS, or be completely custom.

Disable Graphical Boot

Why would you want to disable the graphical boot?

  • It can be a good debugging tool if there is something going wrong with your graphics/logging in.
  • Simplifies what is running on your system.
  • But, it doesn't look as good and requires some setup to get right.
# Disable Graphical login by default
sudo systemctl set-default multi-user

# Make it as if you booted into graphical mode
sudo systemctl isolate graphical

# Enable Graphical login by default
sudo systemctl set-default graphical

# Switch to a mode as if you booted without graphics
sudo systemctl isolate multi-user

Ooops!

If something really bad happens to your computer, fear not!

  1. You've been backing up your data (right? right!)
  2. You can restore system by re-installing Ubuntu and going through this computer setup process again.
    • Then restore your files from backup.
  3. I also have a Clonezilla disk image with a copy of the disk as the computer was shipped and can restore it to the factory state.
  4. After restoring the system, restore your data from the backup.

Northwestern IT

This section provides Linux-specific information for systems maintained by the IT department.

Northwestern VPN

  • The main reason for using the VPN is to access papers from sources such as IEEE and our internal servers while away from campus.

gp-saml-gui

  • This method has the easiest installation because it is distributed by Ubuntu.
  • It is also potentially less reliable because I do not know if the setup I describe will always work or if it is time or netID dependent (since it involves directly connecting to a server that was not mentioned by NUIT).
  • Install the vpn client sudo apt install gp-saml-gui
  • Connect to the vpn gp-saml-gui -vg -S vpn-connect2.northwestern.edu.
  • If the above does not work, try to find the server using gp-saml-gui -v -S vpn-connect.northwestern.edu
    • vpn-connect.northwestern.edu is the official connection point provided by NUIT.
    • When your login it told me to connect to the gateway at vpn-connect2.northwestern.edu, it might tell you something different.

GlobalProtect-openconnect

  • This client works, but is currently a pain to install due to dependency issues, so I am not currently recommending it.
  • To connect to Northwestern's VPN we use the free but unofficial program GlobalProtect-openconnect.
  • Here are the installation instructions:

    sudo add-apt-repository ppa:yuezk/globalprotect-openconnect
    sudo apt install globalprotect-openconnect
    
  • Run gpclient then use vpn-connect.northwestern.edu as the address.
  • Enter your netId and password in the window that pops up.
  • You will need Duo Authentication.

Official Instructions

If you want to try your luck with the official proprietary client see these instructions.

  • I have gotten the client to connect to VPN successfully; however, it is buggy. I have not successfully disconnected without manually killing the processes involved. By default, it also tries to connect to VPN every-time you login.
  • It supports only older versions of Ubuntu.

Printer

ME Office Printer

These are instructions for using the printer in the Mechanical Engineering office and only work while on campus. You will need a printer code (referred to as <USERCODE>).

  • Information on obtaining a printer code is available on canvas under "Resources/Printers".
  • Disable printer discovery to avoid seeing extraneous printers

    sudo systemctl disable --now cups-browsed
    
  • Setup the printer to use your <USERCODE>

    sudo lpadmin -p ME_Office -v "ipp://129.105.102.18/ipp" -m \
    "openprinting-ppds:0/ppd/openprinting/Ricoh/PDF/Ricoh-MP_C6004ex_PDF.ppd" \
    -o UserCode=Custom.<USERCODE>
    

    Replace <USERCODE> with your user code. (i.e., if your code is 1234, use Custom.1234)

  • Enable the printer

    sudo cupsenable ME_Office
    sudo cupsaccept ME_Office
    
  • The printer to print to is called ME_Office.

CRB Printer

  1. Setup the printer:

    sudo lpadmin -p CRB_Lab -v "hp:/net/HP_LaserJet_P4015?ip=129.105.69.122" -m \
    "hplip:0/ppd/hplip/HP/hp-laserjet_p4015x.ppd"
    
  2. Enable the printer

    sudo cupsenable CRB_Lab
    sudo cupsaccept CRB_Lab
    
  3. The printer to print to is called CRB_Lab.

Non-Free Applications

Free software tends to work much better on Linux than proprietary software (and when something goes wrong you can fix it!) However there are some applications that, (partially due to network effects), it is desirable or necessary to use. There are free alternatives to all of these but I have not tried any.

Zoom

  1. Zoom can be used from a web-browser.
    • Go to any zoom linke
    • When Zoom doesn't launch there is a tiny link below to join via a web browser.
  2. Zoom does make a Desktop client that can be installed on Ubuntu.
  3. wget -O /tmp/zoom.deb "https://zoom.us/client/latest/zoom_amd64.deb"
  4. sudo apt install /tmp/zoom.deb
  5. When you run zoom for the first time, sign in with SSO, using northwestern as the domain.
  6. You should then be prompted to enter your netId and password
  7. I recommend installing Zoom on your phone as a backup

Slack

  1. Slack has a web interface
  2. The Slack download page promotes the snap but there is also a package and installed:
  3. wget -0 /tmp/slack.deb https://downloads.slack-edge.com/desktop-releases/linux/x64/4.39.88/slack-desktop-4.39.88-amd64.deb
  4. sudo apt install /tmp/slack.deb
  5. For proprietary software there is an advantage to Snaps over .deb files: the program is more isolated from the rest of the computer.

Discord

  1. Discord has a web interface, but it can also be downloaded as a package and installed:
  2. wget -o /tmp/discord.deb https://dl.discordapp.net/apps/linux/0.0.60/discord-0.0.60.deb
  3. sudo apt install /tmp/discord.deb

Software Management

As you dive into robotics research and development, you will find yourself needing to install software, which is distributed in different ways (some better than others). This situation can get complicated, especially as you venture into lesser used scientific code (e.g., released by researchers as part of a publication). Here I outline methods of handling this complexity while maintaining your system in a functional state.

Apt

Ubuntu Linux comes with a strongly preferred method of managing packages: apt.1

Why Apt?

Most computer applications that you use are built using libraries: collections of code that is generally useful across applications. Rather than duplicating this code every time it is needing (wasting both hard drive space and RAM), Ubuntu distributes one copy of each library which any application (or even another) library can use.

These dependencies create a problem: if a program (e.g., Inkscape) depends on library (e.g., libcairo) and these are made by completely different organizations, then a user who wants to use the program would have to install both the program and the library separately (e.g., go to the Inkscape website, download and install, read that it requires libcairo, then go download and install libcairo). It is not unusual for large programs to have hundreds of dependencies, so this process would become tiresome quickly. Then factor program and library versions and the situation becomes even more untenable.

Apt solves this dependency problem in two ways:

  1. Providing a central repository of software (and it is quite extensive, search it at https://packages.ubuntu.com).
    • The versions of the software in the repository are designed to work together.
  2. Tracking dependencies between programs and libraries.
    • For example, when installing a inkscape its dependencies will automatically be installed if not already present.
    • If you then try to uninstall a dependency of inkscape you will be unable to unless you also agree to uninstall inkscape and any other dependent programs.

By staying within the apt ecosystem using only official Ubuntu repositories you get well-tested software that is easy to install, update, and uninstall. How I wish I could end the story there!

Why not Apt?

Unfortunately, people (especially in robotics) often need packages that are not distributed by Ubuntu, for a few reasons:

  1. Not everybody who creates software decides to put in the effort to create an Ubuntu package for it.
    • For key software Ubuntu may maintain its own packages but for others they won't.
  2. A project you are trying to compile might need a different version of a library than is offered by Ubuntu.
    • Ubuntu introduces new software versions on a fixed release schedule (typically every 6 months).
    • Every two years Ubuntu issues an LTS version, which are the only version ROS officially supports.
    • Thus, at the end of the release cycle, software in Ubuntu LTS is almost two years old!
  3. The software is proprietary and only packaged by the vendor.
    • We try to avoid this software but sometimes the sacrifice required too great.

In these cases alternative installation methods are required. One of your main goals when obtaining this software should be to minimize the effect such software has on the apt-managed part of the system.

Alternative Repositories

Ubuntu enables apt to download packages from servers other than the officially provide ones, enabling third parties to distribute software through apt. Ubuntu also has it's own service, called Personal Package Archives (PPAs), which hosts custom third-party packages for downloading by apt. You have already used some non-Ubuntu repositories: for example ROS provides its own repositories.

If available, using an alternative apt repository enables you to maintain many of the advantages of apt, such as tracking dependencies and an easy uninstall method, while expanding the packages that are available. The disadvantage is that the packages in these repositories are not tested by the Ubuntu team, which can cause some installed programs to break. If the alternative repository, rather than just providing additional packages, provides an alternative version of a standard Ubuntu package the consequences can be widespread.

Fortunately, the goal of people who maintain alternative Ubuntu repositories is for their software to work on Ubuntu, so usually these alternative repositories do not cause issues. However, prior to adding such a repository you should

  1. Trust the authors (by installing their package you are essentially allowing them to run code as root on your computer).
  2. Ensure that you understand what is being installed and potential sources of conflict.
  3. Through Pinning, you can control the repositories that get priority for each package.
  • Example Alternative Repositories
    1. The ROS repository.
    2. The Northwestern MSR repository
    3. The System76 PPA.
    4. The Intel librealsense repository.
    5. The VSCode repository (if using VSCode).
    6. The mozillateam repository (for firefox).
    7. The NVIDIA repository (if CUDA access outside of pytorch is needed).
    8. The Lambda Labs repository (on our GPU servers, not our laptops).
    9. The toolchain repository (to get latest compiler versions, if needed).

Standalone packages

Packages can also be distributed as standalone .deb packages and installed with apt. These packages can not generally be updated automatically via apt upgrade. However, some standalone .deb packages (such as the one for VSCode) actually function by adding an alternative repository to your system, which enables future updates.

Sandboxed Applications

Flatpack, AppImage, and snap are three competing standards for "sandboxed applications". These systems essentially include the program and all of its dependencies in a single directory and isolate themselves from the rest of the system. These systems enable the original application creator to have more control over the full software environment that a program runs in.

  1. These technologies allow a developer to package their program once for all Linux distributions, as opposed to making different packages for different distributions.
  2. Shipping all the dependencies ultimately uses more RAM, more disk space, and arguably makes security more difficult:
    • For example, if openssl has a vulnerability and Ubuntu fixes it is fixed for all applications that use openssl.
    • On the other hand, because each Flatpack ships its own dependencies, each vendor needs to update it separately.

A few alternatives are AppImage, Flatpak, and Snaps.

  • The Ubuntu Linux we installed was modified from the original version to remove Snaps.

Docker

Docker is containerization software that enables deploying a full Linux environment that is separate from the main system. For example, it can enable you to run Ubuntu 18.04 applications within Ubuntu 22.04. Discussing docker in detail is out-of-scope here, but from our perspective it provides a method for trying out a project while keeping it entirely separate from your system.

Overall, docker is less ergonomic for programs that you use every day on your system than some of these other methods, but it is a useful tool for deploying software to servers (or robots) and maintaining completely separate computing environments.

Language-specific Package Managers

Many programming languages have their own package managers (e.g., pip, cargo) designed for distributing software and libraries written in that language. These package managers often offer the same software that is available via apt but typically in a newer version.

Python

Python package management will come up a lot in this course. Furthermore doing things like trying to uninstall python or install another python version can cause great damage to the your system.

  1. Prefer python packages installed via apt over all other python packages.
    • ROS is designed to work with the versions of the python packages in apt.
  2. If what you are doing is unrelated to ROS, use a virtual environment.
  3. If you want your packages easily available in ROS use pip3.
    • Cross your fingers that a dependency does not override a system dependency with a version that is incompatible.
    • With some work it is possible to use a venv with ROS.
  4. NEVER install packages via anaconda or miniconda, no matter what you hear, read, or see from another source. DO NOT DO IT!

Build From Source

Most programs and libraries that we use are open source. This means we can modify and build them to suit our needs.

  • It is possible, for example, to compile an old version of OpenCV and use it with a specific package that requires an older version

Colcon Workspace

  • Colcon is the build tool for ROS 2, but it can compile a variety of ROS and non-ROS packages.
  • Many ROS packages are written in C++ which has no official package manager. There are some attempts (like vcpkg or conan) but they are far from standard or ubiquitous.
  • Sometimes a ROS 2 package will only be released for an older ROS 2 version. Often it is possible to compile the package for a later version with minimal modification.
  • For most packages, you can clone the package into a src directory and run colcon build. When you source that workspace everything you built in it will be available.
  • You will need to retrieve dependencies with rosdep, manually install them via apt, or clone them into src/

Compile By Hand

Compiling "by hand" means following the instructions provided in the source code for compiling that particular project (or figuring out what to do from reading if there are no instructions). The main difficulty is obtaining all the dependencies. Once the dependencies are installed the main program can be installed.

If you install as root the files will be installed under the /usr/local prefix (usually). While this arrangement keeps the files separate from files managed by apt, it may be difficult to uninstall because the files are not usually tracked.

An alternative pattern is to do the following

  1. Create a prefix directory. This directory mimics the structure under /usr but is typically placed in a user-accessible directory (e.g., /home/<user>/prefix).
  2. Compile each depency while specifying /home/<user>/prefix as the install prefix and the place where the program should be installed
    • How to change the install prefix depends on build system and how that was implemented
    • For cmake, specify -DCMAKE_INSTALL_PREFIX=/home/user/prefix and -DCMAKE_PREFIX_PATH=/home/user/prefix when generating the build system.
  3. Afterwards you can find the execuatables in /home/<user>/prefix/bin (and add them to your path if you would like).
  4. The advantage of this method is you can install without root and can delete the whole prefix directory to uninstall.

Modifying Source Code

If you need to modify source code, for the long run here is the procedure (assuming the project uses git):

  1. Clone the repository
  2. Create your own branch
  3. Make your modifications
  4. Push to a repository under your control (e.g., on github this will be a fork).
  5. You may want to contribute your changes to the project.
  6. You can now depend on your fork of the project and use whatever changes you made.

Building Custom Packages

If you can compile the code you can also package it as a Debian package and install it, enabling it to be managed by apt.

  • The ROS packaging tool bloom can be used (bloom generate rosdebian).
  • The Debian packaging guide provides information on how to create Debian packages.

Ubuntu Cleanup

After a regular Ubuntu 24.04 LTS install there would be some steps remaining to undo some annoying choices that Canonical has made for Ubuntu. However, the customized install that we used already cleared these items out of the base Ubuntu system. I outline the post-install cleanup steps here, although they are no longer needed, if the customized install was used.

  1. Preventing automatic updates: they pop-up frequently and we need full control of when we update the computer:
    • In our case, the risk of a "security breach" is much lower in our case then the risk of breaking our projects
    • I have also disabled phased updates, ensuring we all get the same updates after they have been tested.
  2. Removing snaps, a controversial feature of Ubuntu.
    • Removing them results in better performance and more control (since they update automatically).
    • Other Linux distributions do not use snaps, so learning them is Ubuntu-specific.
    • With each update to Ubuntu snaps become more integrated and harder to remove.
  3. Installing a Web-browser: Ubuntu no longer packages a mainstream webbrowser, unless you use snaps.
    • This installation has a snap-free firefox installed.

Footnotes:

1

Canonical is currently advocating for snaps but most software is still apt.

Author: Matthew Elwin.