Setting Up Linux Environment

You will need a Linux machine or VM where you have root access via sudo in order to complete these lessons. They are impossible to do on Windows or Mac OS without a Linux Virtual Machine (VM). You can either run a VM locally on your machine if it isn’t Linux or a VM in a cloud setup. It is possible your instructor might be providing such VMs in bulk.

Attention

You must have a working Linux setup (machine or VM) where you have root access via sudo and the required additional software by the beginning of the actual course. If you do not, you WILL BE LEFT BEHIND!

Installing the Required Software

You need to check if you have the following programs available on the command line

  • Specific programs

    • busybox

    • chroot

    • findmnt

    • newgidmap

    • newuidmap

    • nsenter

    • pivot_root

    • unshare

    • useradd

    • userdel

    • usermod

  • Generic programs

    • Your preferred POSIX shell (e.g. bash, zsh, etc.)

    • Your preferred plain-text editor (e.g. nano, vim, emacs, etc.)

If any are missing, you will need to install the packages that have them. If you are missing busybox, you will need to install the package busybox on your distro or you can just download a compiled binary for your system from the BusyBox website. If you are missing chroot, you will need to install coreutils or core-utils for your linux distro (how it is even running without this is a mystery). If you are missing nsenter, pivot_root, and unshare; you need to install util-linux or util-linux-core for your Linux distro (can try one and do the other if it doesn’t work). If you are missing the rest, you will need to install shadow-utils. Depending on your distro, it is possible the right packages might have a bit different names. If you search for shadow and util-linux, you will likely find the right package name. The packages for the generic programs are generally just their names, though vim and emacs are often of the form NAME-INTERFACE where INTERFACE depends on whether it is GUI or terminal (e.g. nox would be terminal, gui or gtk would be GUI).

Checking That unshare Is New Enough

Old versions of util-linux have an unshare program that is very unwieldy and difficult to use. Run

unshare --version

to get its version. Version 2.37.0 is definitely new enough (the version on RHEL/Rocky/Alma 9). Version 2.32.x is too old (the version on RHEL/Rocky/Alma 8). If your version is in between, read the manual page for unshare on your machine by

man 1 unshare

and look to see you can find the --keep-caps and -c/--map-current-user options. If it doesn’t have those, it is too old.

If your util-linux is too old, try updating the package. If it is still too old, you should setup a Linux VM or find another Linux machine that has a new enough version and go through this page again with it.