Computer Setup
Hardware Overview
- Northwestern's MS in Robotics program provides every student with a new Linux laptop!
- To build your Linux skills, use these laptops for everything.
- Most robots are computers, so the ability to use and maintain Linux systems is crucial.
Laptop Specifications
- System76 Gazelle (gaze20-PO-54-32-1T-NO)
- Intel Core 7 250H (24MB Cache, 6 P-cores, 8 E-cores, 5.4 GHz)
- Nvidia RTX 5050 Laptop 8GB
- 32 GB RAM (DDR5 5600 MHz)
- 1 TB PCIe4 Hard Drive
- 15.6" 1920x1080@144Hz LCD
- This laptop is big, heavy, and powerful. Think of it more like a portable desktop than a laptop.
Previous Versions
Laptops are updated every year, as are these instructions.
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
- Read this document carefully.
- Backup your work regularly.
- Do not spill a drink on your laptop.
- Do not leave your laptop behind during a night out.
- Do not close your laptop screen on a foreign object.
- Do not drop your laptop.
- Do not drop something on your laptop.
Citation for 3-7: All things that have happened within the first week of MSR :(.
Installing Linux
- The laptops come with Pop OS 24.04 LTS but we will be using Ubuntu 26.04 LTS.
- I have distributed USB drives with the installer ready to go, which will install a slightly-customized version of Ubuntu.
Booting
- Ensure that there is no ethernet cable plugged in.
- Ensure that the power cable is connected.
- Plug the USB drive into a USB 3.0 or a USB-C port.
- Turn the computer on (hold the power button for about 1 second release, and wait 1 second for it light up).
- Tap the
F2key slowly until you enter the BIOS screen- Select
Boot Manager - Select your USB device (the MSR USB stick appears as
Linpus Vendor C)
- Select
- When the Grub menu appears select "Try or Install Ubuntu" (Press Enter)
- Wait for the Ubuntu Installer to open
MSR USB Image
- The customized USB has these instructions available at
docs/computer_setup.html - To read from the LiveUSB Environment:
- Open a terminal (
CTRL-ALT-T) cp -a /cdrom/docs .firefox docs/computer_setup.html- The copying is required due to Firefox being a
snapand unable to read/cdrom.
- Open a terminal (
- To read from the USB stick after installation:
firefox /run/media/$USER/MSR_26_UBUNTU/docs/computer_setup.html
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, unless you need an accessibility option to complete the installation.
- Keyboard Layout
- Keep the default (English US).
- Internet Connection
- Select 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.
- Encryption and filesystem
Select either No Encryption or Encrypt with a passphrase
Details
- Encryption prevents unauthorized users from reading your files and is useful when the following conditions are met:
- An unauthorized user obtains physical access to your harddrive (e.g., your laptop is stolen or you want to dispose of it)
- Your laptop contains information that should not be in another person's possession.
- Encryption prevents you from accessing your files if you forget the password and/or lose the key
- Encryption requires you to enter an additional password whenever you boot the computer
- It is possible to decrypt the harddrive automatically (via the TPM, a USB flash drive, or the network)
- Automatic nullifies many of the protections provided by encryption
- It primarily protects the data when the harddrive is removed from the computer for disposal
- Encryption prevents unauthorized users from reading your files and is useful when the following conditions are met:
- 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.
- DO NOT MAKE YOUR COMPUTER NAME AND USERNAME THE SAME
- 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,
Locationshould say Chicago andTimezoneshould say America/Chicago
- Ready to install
- Click
Install - Finished
- When the installation is complete restart the computer
First Boot
Login
- If you chose to encrypt your harddrive, enter your harddrive passphrase
- Click your username and enter your password to login.
Terminal
- Type
Ctrl-Alt Tto 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
Enterto execute it.
Internet
- List wireless networks with
nmcli dev wifi list. - 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.
- Replace
- Wired connections automatically work when plugged into an active ethernet port.
Northwestern Wifi
- If on campus: connect to the eduroam-setup network
nmcli dev wifi connect eduroam-setup - If off campus, connect to the internet in some other way.
Download and run the JoinNow script:
wget --post-data 'request=deployLinux' 'https://cloud.securew2.com/public/35570/Northwestern/php/deploy.php' -O /tmp/wifi_setup sh /tmp/wifi_setup
- Firefox will open. Login with
<netid>@ads.northwestern.edu- Replace
<netid>with yournetId
- When redirected, enter your Northwestern NetID password
- Complete the DUO authentication
- Wait for the process to complete: you will then be on the network
- Optional Cleanup:
- It's annoying to have a network connection that is called
eduroam [1234]so we will rename it toeduroam:nmcli con mod eduroam\ [THENUMBER] connection.id eduroam - Delete the
eduroam-setupnetwork:nmcli con del eduroam-setup
- It's annoying to have a network connection that is called
- More Details are available from NUIT
System76 Setup
These instructions are for users with System76 Laptops System76 provides drivers for their laptops
- The driver enables you to switch graphics modes and change other settings
- These instructions are adapted from System76 Driver Installation
System76 Driver
Install the System76 Driver and nvidia drivers.
wget https://github.com/pop-os/system76-ubuntu-repo/releases/download/1.0.0/system76-ubuntu-repo_amd64.deb -O /tmp/sys76.deb sudo apt install /tmp/sys76.deb sudo apt update sudo apt install system76-driver --no-install-recommends sudo apt full-upgrade sudo apt install system76-driver-nvidia
- The
sudo apt full-upgradecommand 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 presumably System76 versions work better with their hardware.
- Reboot your computer to load the nvidia drivers
Graphics Modes
- These computers have two graphics cards: the NVIDIA and the integrated Intel, and several modes:
hybrid- (Default) Use both GPU's for rendering depending on individual application settings.nvidia- exclusively use the NVIDIA graphics card. Most power usage, most graphics performanceintegrated- Intel only: least power usage, least performancecompute- The nvidia card is visible but graphics are not rendered, it is only available for compute.
- The
nvidiacard must be active (eithernvidiaorhybrid) for the HDMI port to work because it is physically wired to that port. - The
system76-powerutility enables you to view and switch between graphics modes- Switching graphics modes requires a reboot
system76 power graphicsdisplays the current modeswitcherooctlallows you to launch an application on either GPU.
Web Browser
Firefox
Firefox is already installed. It comes from a package repository provided by Mozilla. This repository was added during installation.
- I highly recommend that you install the
UBlock Originextension to block ads.
Google Chrome
- Google Chrome is not part of Ubuntu so it must be downloaded directly from Google.
Download and install the
google chromepackage: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
Backspaceseveral times on an empty terminal line). - To mute these sounds run
gsettings set org.gnome.desktop.sound event-sounds false.
USB Wifi
If you ever need to purchase a USB WiFi card for linux, please consult with https://github.com/morrownr/USB-WiFi to ensure you have full comparability
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
- The most popular choice for recent MSR students.
- Widely used.
- Relatively easy to setup.
- Supported (and controlled by) Microsoft; some plugins are not open source.
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- Launch VSCode using
code.- I opt-out of the telemetry collection (lower right) when first starting
code.
- I opt-out of the telemetry collection (lower right) when first starting
- More details on VSCode
vim
If you like simplicity and modal text editing.
- Install with
apt install vim(terminal-only) orapt install vim-gtk3(with gui). - There is also
neovim, a popular fork ofvim. - There is a steep learning curve for
vim, but plenty of Tutorials
emacs
Eight Megabytes and Constantly Swapping (this is a dated joke).
- My editor of choice: I use
emacswithevilmode because …(insert hour-long discussion here)… spacemacsanddoomemacsare popular pre-configured versions ofemacs.sudo apt install emacs
Other
So many others to choose from.
Version Control (git)
- Install
gitfrom apt (sudo apt install git gitk)gitkallows you to visualize thegitrepository- For more information see Git Introduction.
sudolets you run commands as the superuser. Enter your own password when prompted- CAUTION! Make sure you know what you are doing when running
sudocommands
Setup your identity and the default branch name:
git config --global user.name "Your Name" git config --global user.email "Your email" git config --global init.defaultBranch main
- 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--waitflag: (git config --global core.editor 'code --wait')
- If you are using
Python
Robot Operating System (ROS 2)
Here are some abbreviated instructions for installing ROS 2 on an x86 PC, which should work assuming you have completed the previous 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 Lyrical Install Instructions
# Install the ROS repositories wget https://github.com/ros-infrastructure/ros-apt-source/releases/download/1.3.0/ros2-apt-source_1.3.0.resolute_all.deb sudo apt install ./ros2-apt-source_1.3.0.resolute_all.deb rm ./ros2-apt-source_1.3.0.resolute_all.deb # Update the package list sudo apt update # Install the development tools sudo apt install ros-dev-tools # Install ros2 sudo apt install ros-lyrical-desktop # Initialize rosdep (makes it easy to install ros dependencies) sudo rosdep init rosdep update
- Add the line
source /opt/ros/lyrical/setup.bashto the end of~/.bashrcfile.- 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 ~/.bashrcor - You can also append the line with
echo "source /opt/ros/lyrical/setup.bash" >> ~/.bashrc - This file is executed whenever you start
bashand automatically configures the ROS environment. - Restart the terminal and
echo $ROS_DISTRO. It should displaylyrical.
- The
Realsense
- The realsense library is used to interact with Realsense cameras
- For convenience, I have created packages to install the necessary Realsense library on the numsr ppa.
- Install the packages:
sudo apt install librealsense2-dkms librealsense2 ros-lyrical-realsense2-camera ros-lyrical-realsense2-description - For details see Realsense PPA Modifications
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
.reposfile 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.
Network Attached Storage
- MSR provides a Network Attached Storage (NAS) device to allow you to backup your work
- It is only accessible from the Northwestern network (or VPN)
- By backing up your work to this server regularly, you can avoid disaster!
- To enroll see Server Access
- For an easy method to backup your home directory see Rsync Backup
- To understand how to view old versions of files see Snapshots
- While the data is encrypted on the server, it is accessible to the server administrator
External Harddrives
- We have provided you with an external SSD. You can backup regularly.
- 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
clonezillaat 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.
- You can use
rsync(as done with the NAS, changing the destination where your external drive is mounted (e.g.,/run/media/$USER/UBUNTU_26_04) - Unlike the NAS, different versions are not tracked.
- A utility that works like
rsyncbut also lets you restore previous versions isrdiff-backup- Plug in the external drive to a USB 3 or USB c port and run
rdiff-backup /home/<username> /media/<username>/<hdname>, replacing the<paths>with the ones appropriate to your computer.
- Plug in the external drive to a USB 3 or USB c port and run
Additional Options
- Restic does encrypted incremental backups to local devices or cloud services.
- BorgBackup de-duplicating file backups
- 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.
- 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.
- 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 FavoritesorRemove 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-terminalis just one of many terminal emulators you can use.
System Settings
GUI
- Many settings are contained in the Settings menu. I encourage you to explore them.
- 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
gsettingscommand 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-recursivelyto 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>
- Use
- 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->KeyboardunderSystem 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
Notifications
- Graphical notifications in
gnomethat pop-up can be annoying - Remove them completely with
apt remove libnotify-bin
Ooops!
If something really bad happens to your computer, fear not!
- You've been backing up your data (right? right!)
- You can restore system by re-installing Ubuntu and going through this computer setup process again.
- Then restore your files from backup.
- 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.
- 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
There are a few alternatives for connecting to Northwestern VPN.
gp-saml-gui
- Install
openconnect:sudo apt install openconnect - Install the client:
sudo apt install gp-saml-gui - Connect
gp-saml-gui -vg -S vpn-connect2.northwestern.edu -- --disable-ipv6 - A web-browser window will pop-up asking for your NetID and password, followed by a Duo Authentication screen
- You remain connected to the VPN as long as the above
gp-saml-guicommand is running - The main advantage of this method is it is mostly command-line driven and simple
- The main disadvantage is there is not an easy way to see at a glance that you are connected to the VPN
Network Manager
- Install
openconnect:sudo apt install openconnect - Install the Network Manger Plugin:
sudo apt install network-manager-openconnect-gnome - Create a New VPN connection of type "OpenConnect (GlobalProtect)"
- The gateway is
vpn-connect.northwestern.edu - Authentication takes place in multiple steps:
- First login to the gateway
- Enter NetID, Password, and do DUO authentication
- After authentication, you choose the portal (there is only 1, vpn-connect2.northwestern.edu) and connect to that.
- The disadvantage of this method is there are some semi-awkward gui screens to go through: it is not just one-click and connect
- The advantage of this method is it is integrated with NetworkManager so it is easy to see VPN status and it works like other network connections.
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
gpclientthen usevpn-connect.northwestern.eduas the address. - Enter your netId and password in the window that pops up.
- You will need Duo Authentication.
Official client
The official proprietary client can be installed and used by following see these instructions.
- The client "works" but it is a buggy piece of proprietary software that I would never want to have on my computer.
- The official NUIT setup instructions have you manually editing a config file to use your system's default web browser because their built-in authentication method does not work!
- It's support often lags behind the version of Ubuntu we are using.
- It starts a background process whenever your computer starts, even when not using the VPN
- Disable this with
systemctl disable --now gpd. You will need tosystemctl start gpdto connect to the VPN
- Disable this with
-. It prompts you to connect to the VPN every time you login, which is very annoying.
- It sends a HIP report about the software you are running on your computer to Northwestern (and who knows who else) for "security" purposes.
- The information is gathered by a third-party proprietary binary program that runs with root privileges.
- My main use for this client is to debug the open-source alternatives when sometimes a new version of their server software breaks them.
SAML Authentication
Here is a brief summary of what I've learned about how GlobalProtect VPN works
- Authentication is done using the University's Single-Sign-On process with Two-Factor Authentication
- This authentication process uses something called SAML.
- You can manually see this authentication process by going to
vpn-connect.northwestern.eduin the web browser - Essentially the end-result of this authentication process is an authentication cookie
- You can manually see this authentication process by going to
- The open-source clients essentially wrap a web-browser to allow you to enter your credentials and obtain the cookie
- The cookie is then passed to
openconnectwhich uses the cookie to authenticate with the VPN.
- The cookie is then passed to
- Global protect has separate "portal" and "gateway" URLs.
- After authenticating with the
portal(vpn-connect.northwestern.edu) you are given a "choice" of gateways - The only gateway that seems to be used by Northwestern is
vpn-connect2.northwestern.edu - Some of the open-source clients don't properly redirect from portal to gateway, so instead it is easier to connect directly to the gateway
- After authenticating with the
- Version
9.12ofopenconnect(which comes with Ubuntu 24.04) has a bug that prevents it from working with the version of GlobalProtect currently deployed by NUIT- This bug is fixed and the fix will be in the next version of
openconnect - In the meantime, I have packaged a version
openconnecton the PPA which contains the necessary fix.
- This bug is fixed and the fix will be in the next version of
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
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"
Enable the printer
sudo cupsenable CRB_Lab sudo cupsaccept CRB_Lab
- 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
- 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.
- Zoom does make a Desktop client that can be installed on Ubuntu.
wget -O /tmp/zoom.deb "https://zoom.us/client/latest/zoom_amd64.deb"sudo apt install /tmp/zoom.deb- When you run zoom for the first time, sign in with SSO, using
northwesternas the domain. - You should then be prompted to enter your netId and password
Slack
- Slack has a web interface
- The Slack download page promotes the snap but there is also a package and installed:
wget -0 /tmp/slack.deb https://downloads.slack-edge.com/desktop-releases/linux/x64/4.39.88/slack-desktop-4.39.88-amd64.debsudo apt install /tmp/slack.deb- For proprietary software there is an advantage to Snaps over
.debfiles: the program is more isolated from the rest of the computer.
Discord
- Discord has a web interface, but it can also be downloaded as a package and installed:
wget -o /tmp/discord.deb https://dl.discordapp.net/apps/linux/0.0.60/discord-0.0.60.debsudo 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:
- 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.
- Tracking dependencies between programs and libraries.
- For example, when installing a
inkscapeits dependencies will automatically be installed if not already present. - If you then try to uninstall a dependency of
inkscapeyou will be unable to unless you also agree to uninstallinkscapeand any other dependent programs.
- For example, when installing a
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:
- 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.
- 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!
- 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
- Trust the authors (by installing their package you are essentially allowing them to run code as
rooton your computer). - Ensure that you understand what is being installed and potential sources of conflict.
- Through Pinning, you can control the repositories that get priority for each package.
- Example Alternative Repositories
- The ROS repository.
- The Northwestern MSR repository
- The System76 PPA.
- The Intel librealsense repository.
- The VSCode repository (if using VSCode).
- The mozillateam repository (for firefox).
- The NVIDIA repository (if CUDA access outside of pytorch is needed).
- The Lambda Labs repository (on our GPU servers, not our laptops).
- 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.
- These technologies allow a developer to package their program once for all Linux distributions, as opposed to making different packages for different distributions.
- Shipping all the dependencies ultimately uses more RAM, more disk space, and arguably makes security more difficult:
- For example, if
opensslhas a vulnerability and Ubuntu fixes it is fixed for all applications that useopenssl. - On the other hand, because each Flatpack ships its own dependencies, each vendor needs to update it separately.
- For example, if
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.
- Prefer python packages installed via
aptover all other python packages.- ROS is designed to work with the versions of the python packages in
apt.
- ROS is designed to work with the versions of the python packages in
- If what you are doing is unrelated to ROS, use a virtual environment.
- 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
venvwith ROS.
- NEVER install packages via
anacondaorminiconda, 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
srcdirectory and runcolcon 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 viaapt, or clone them intosrc/
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
- Create a
prefixdirectory. This directory mimics the structure under/usrbut is typically placed in a user-accessible directory (e.g.,/home/<user>/prefix). - Compile each depency while specifying
/home/<user>/prefixas 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/prefixand-DCMAKE_PREFIX_PATH=/home/user/prefixwhen generating the build system.
- Afterwards you can find the execuatables in
/home/<user>/prefix/bin(and add them to your path if you would like). - The advantage of this method is you can install without
rootand can delete the wholeprefixdirectory 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):
- Clone the repository
- Create your own branch
- Make your modifications
- Push to a repository under your control (e.g., on
githubthis will be a fork). - You may want to contribute your changes to the project.
- 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.
- 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.
- 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.
- Installing a Web-browser: Ubuntu no longer packages a mainstream webbrowser, unless you use snaps.
- This installation has a snap-free firefox installed.
Footnotes:
Canonical is currently advocating for snaps but most software is still apt.