CSE 422S: Studio 2

Raspberry Pi Setup


"It's a dangerous business, Frodo, going out of your door. You step into the road, and if you don't keep your feet, there is no knowing where you might be swept off to."

—Bilbo, The Fellowship of the Ring by J. R. R. Tolkien, Book 1, Chapter 3

The aim of this studio to to set up your Raspberry Pi. We understand that your situation may be unique this semester, so this studio will be structured a little differently than others. We understand that you may not have access to a monitor, keyboard, and mouse, so we will provide optional instructions for headless setup of your Raspberry Pi, so you can access and control it from a laptop or desktop. Throughout this studio, we will be providing variant instructions based on the equipment and networks you have access to. In many places, you will be prompted to click on a header, which will expand the instructions relevant to your situation.

In this studio, you will:

  1. Set up your Raspberry Pi
  2. Boot, log into, and explore different configuration settings of the Raspberry Pi OS (previously called Raspbian).
  3. Install the kernel you compiled on day 1 to run on your Raspberry Pi.

Please complete the required exercises below, as well as any optional enrichment exercises that you wish to complete. We encourage you to please work in groups of 2 or 3 people on each studio (and the groups are allowed to change from studio to studio) though if you would prefer to complete any studio by yourself that is allowed.

As you work through these exercises, please record your answers, and when you finish them each and every person who worked on them should please log into Canvas, select this course in this semester, and then upload a file containing them and also upload any other files the assignment asks for, and submit those files for this studio assignment (there should be a separate submission from each person who worked together on them).

Make sure that the name of each person who worked on these exercises is listed in the first answer, and make sure you number each of your responses so it is easy to match your responses with each exercise.


Required Exercises

  1. As the answer to the first exercise, list the names of the (ideally 2 or 3) people who have worked together on this studio.

  2. To start, you need to assemble your Raspberry Pi. If you have the recommended starter kit from Canakit, watching the video that you can find in the course's Canvas site on the "Setting up your Raspberry Pi" page of the "Intro to Linux and the Raspberry Pi" module before you start may help you with the assembly. To avoid problems: make sure you put the Raspberry Pi card into the protective case, before you install the heat sinks and MicroSD card that were provided in the kit (this helps with their alignment, and also avoids potential issues with damage to them or shearing them off as you're putting the card into the case).

    As the answer to this exercise, please let us know whether or not you ran into any surprises, concerns, questions, or issues during the assembly, and if you did what those were.

  3. Now you are ready to install the Raspberry Pi OS.

    First, please specify how you will connect your Raspberry Pi to a network:


    Now, please specify how you will set up your Raspberry Pi:

    This in turn is strong motivation to back up copies of your work on other machines (possibly using svn, git, or another repository service, use multiple raspberry pi machines within your group for redundancy, etc. Starting with the next week's exercises, we will be making substantial changes to code etc. that you will need to manage effectively even if your Raspberry Pi should freeze up, lock you out, etc.

    Once you have successfully installed and booted the Raspberry Pi OS, and can see the desktop, please tell us briefly about your setup as the answer to this exercise. For example, are you using Washington University's WiFi network, or your home WiFi? Do you have a monitor, keyboard, and mouse connected, or did you perform a headless setup? If headless, are you connecting with SSH, RealVNC, or through another method? And, if headless, what operating system are you using on the computer that connects to the Raspberry Pi?

  4. Now, you are ready to configure location and user settings for your Raspberry Pi.

    When your Raspberry Pi first logs in, you will see a setup wizard titled "Welcome to the Raspberry Pi." Click Next.

    On the Set Country screen, use the following options:

    In its default configuration, the Raspberry Pi 3 is usually set up to boot automatically into a default account with username pi and password raspberry, which is not very secure for long-term use. To help avoid having your Raspberry Pi recruited into an evil bot swarm (or other undesirable and unauthorized use), the setup wizard now prompts you to enter a new password. Type in (and re-enter to confirm) a suitably strong new password that you should please also record somewhere so you can still get access to your Raspberry Pi.

    As the answer to this exercise please say yes or no for each of the following 5 items, to indicate whether your new password (1) contains at least one lowercase alphabetic character, (2) contains at least one uppercase character, (3) contains at least one numerical character, (4) contains at least one non-numeric, non-alphabetic character, and (5) is at least 8 characters long (if the answer to each of these is yes, then your password may be strong enough to be accepted - if not, keep trying until you succeed).

  5. On the next screen, please indicate if your screen shows a black border around the desktop. You should not need to check this box if you are running a headless Raspberry Pi and connected via VNC.

    The next screen will prompt you to connect to a WiFi network.

    The Raspberry Pi will now prompt you to Update Software. Click Next, which will allow the Raspberry Pi to automatically download and install the necessary updates.

    Finally, the setup wizard will indicate that your Raspberry Pi is now set up and ready to go. Do not restart it yet; there are a few more steps to complete.

    Click on the raspberry icon at the top left of your desktop, select the Preferences menu item and then from that menu select the Raspberry Pi Configuration menu item.

    If you are not using your own router, you may want to change your hostname from the default raspberrypi to something unique so that it does not conflict with others in the course. For example, choose a hostname that contains your username.

    Click OK to apply the settings and exit the Configuration menu. If your screen resolution is too small to see the OK button, you can close the settings window. Reboot your Raspberry Pi.

    As the answer to this exercise, please tell us the hostname assigned to your Raspberry Pi.

  6. We will now look at network settings on your Raspberry Pi.

    First, open up a terminal window on your Raspberry Pi, and in it enter the command

    ifconfig wlan0

    and note the MAC address that appears after the word ether. The MAC address should consist of six hexadecimal numbers separated by colons, like 00:00:00:00:00:00 (but with values from 0 to 9 and a through f for the digits).

    Once you have done that, in the terminal window on your Pi enter the command

    hostname -I

    and note the IP address that appears.

    As the answer to this exercise, give both the MAC address and the IP address for your Raspberry Pi.

  7. Finally, we need to transfer our recently compiled kernel and modules that we built in the previous studio to our Raspberry Pi in order to install them.

    To make the transfer process faster, you will first need to compress the files that you will be retrieving.

    Use ssh to connect to shell.cec.wustl.edu. Then, navigate to the directory where you compiled the Linux kernel with:

    cd /project/scratch01/compile/"your username"/linux_source

    Next, create two archives with the following commands:

    tar -C modules/lib -czf modules.tgz modules

    tar -C linux/arch/arm -czf boot.tgz boot

    Now, open a local terminal on your Pi.

    Alternatively, in this and all future assignments, you may use SSH to run terminal commands on your your Raspberry Pi.

    Create a directory called linux_source that will serve as a place to organize your code. (Note: this does not need to be created under /project/scratch01/compile, as only you will be running a kernel on your Pi.) Move inside your linux_source directory and run the following commands:

    sftp [your wustl key]@shell.cec.wustl.edu

    cd /project/scratch01/compile/"your username"

    cd linux_source

    get modules.tgz

    get boot.tgz

    quit (to get back to your Pi)

    Back up your directories /usr/lib/modules and /boot, because you will be modifiying their contents. To do this, we used sudo cp -r /usr/lib/modules ~/Desktop/modules_backup and a similar command for /boot.

    Note that on some versions of Linux, /lib may be a directory rather than a symbolic link to /usr/lib. In that case, please use

    sudo cp -r /lib/modules ~/Desktop/lib_backup

    to back up that directory instead.


    You should still be in your linux_source directory (if not, navigate there).

    Once you have backed up the /usr/lib/modules (or /lib/moduels) and /boot directories, run the following commands to install the kernel you built:

    tar -xzf modules.tgz

    tar -xzf boot.tgz

    cd modules

    sudo cp -rd * /usr/lib/modules (or sudo cp -rd * /lib/modules if /usr/lib does not exist)

    cd ..

    sudo cp boot/dts/*.dtb /boot/

    sudo cp boot/dts/overlays/*.dtb* /boot/overlays

    sudo cp boot/dts/overlays/README /boot/overlays

    Finally, if you are using a Raspberry Pi 3B+, run the command:

    sudo cp boot/zImage /boot/kernel7.img

    If you are using a Raspberry Pi 4 or 4B, run the command:

    sudo cp boot/zImage /boot/kernel7l.img

    At this point, your new kernel is installed. When you reboot, you'll be running your very own, custom kernel.

    Go ahead and reboot now. If everything went OK, the new system should look and feel the same as before. You can verify that your new kernel is running with the command uname -a. In particular, the build date should be the day you finished Studio 1, the version string should include the local version string you specifed during configuration, and your Linux source code version (as well as the characters "PREEMPT") should appear.

    As the answer to this exercise, give the output that was just produced by running uname -a for the new kernel.

  8. Things to Turn In:

    For this studio, please turn in the following:


    Optional Enrichment Exercise

  9. Please see the Linux Users - Raspberry Pi Documentation page for more information about how to add other user accounts to your Raspberry Pi, create home folders, etc.

    Be careful with some of the commands on that page, as they can remove accounts, remove passwords, etc. which can leave you without a way to get into your Raspberry Pi (forcing you to start all over by re-imaging your MicroSD card, etc.)

    As the answer to this exercise, describe what you did and what you saw when you did that.


Page updated Wed January 19 2022, by Marion Sudvarg, James Orr, and Chris Gill.