Stage 4 of 6 · Lab, at the Raspberry Pi · about 40 minutes
Boot & configure
Your boot drive carries a complete system. Now you connect the Raspberry Pi in the right order, let it boot once to finish setting itself up, prove with two commands that it is running from your drive, and open a terminal to it from the lab PC.
Wire the station with the power unplugged
- Boot drive in place: the microSD card in its slot, or the SSD in a blue USB 3 port. With an SSD, confirm the card slot is empty: the bootloader tries the card before USB.
- Keyboard and mouse into the black USB 2 ports.
- Micro-HDMI cable from HDMI0 (the socket nearest the power socket) to the Pi screen. Switch the screen to that input.
- Ethernet cable if the class network is wired.
- Power supply into the wall, then USB-C into the Pi. On a Pi 5, press the power button if it does not start by itself.
First boot
The first boot is slower than every later one. The system expands its file system to fill the drive, applies your Imager settings, generates SSH keys and reboots itself once. Allow up to five minutes and do not touch the power. You will see, in order: a rainbow square or a Raspberry Pi logo, scrolling text, a black screen, and then the desktop or a login prompt.
What "normal" looks like
- A red LED lit steadily means power is present. A green LED flickering means the boot drive is being read.
- If Imager settings were applied, the desktop appears already logged in as your user, or a login screen shows your username.
- A first-run wizard may ask to confirm country, language and keyboard, and offer updates. Confirm the values you set; you can accept updates now or run them from the terminal below.
Open a terminal: click the terminal icon in the top bar or press Ctrl+Alt+T. You should see a prompt like username@lastname-pi:~ $, with your own username and hostname. That line already proves two things: they both made it onto the drive.
Prove it booted from your drive
Booting is not the same as booting from the intended device. Two commands settle it.
$ findmnt -no SOURCE /
/dev/sda2
$ lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS,MODEL
NAME SIZE TYPE MOUNTPOINTS MODEL
sda 238G disk Samsung Portable SSD T7
├─sda1 512M part /boot/firmware
└─sda2 238G part /
Read it this way: the root file system / is on the second partition of the boot device, and the NAME and MODEL columns tell you which device that is. sda means a USB disk, so /dev/sda2 with your SSD's model in the MODEL column proves an SSD boot. A microSD boot shows /dev/mmcblk0p2 on device mmcblk0, with the card's size and no USB model. Either is correct; what matters is that it matches the drive you wrote and its size matches the label. (On the Pi 5, an NVMe drive would appear as nvme0n1; you will not see that in this course.)
Record the OS version and the identity of the system as well; you will hand these in.
$ cat /etc/os-release | head -n 3
$ hostnamectl
$ uname -a
Configure the system
raspi-config: the Raspberry Pi settings menu
Most Pi-specific settings live in one text-mode menu. Arrow keys move, Enter selects, Tab jumps to Select/Finish, Esc backs out.
$ sudo raspi-config
| Menu | What you may need this week |
|---|---|
| System Options | Wireless LAN (join a network), Hostname (rename the Pi if two of you collided), Boot / Auto Login, Password |
| Interface Options | SSH (should already be enabled), VNC (enable for the remote desktop), later I2C, SPI and Serial Port for Week 4 and beyond |
| Localisation Options | Locale, Timezone, Keyboard, WLAN Country: fix here if a symbol key is wrong or the clock is off |
| Advanced Options | Expand Filesystem (normally done automatically at first boot), Boot Order (Week 3 and Troubleshoot only) |
| Update | Updates raspi-config itself |
The same settings are in the desktop under Menu → Preferences → Raspberry Pi Configuration, if you prefer a window.
Update the installed software
apt is the package manager of Raspberry Pi OS (Debian). The image on your drive was built weeks before today, so update it once now. It can take several minutes on the class network.
$ sudo apt update # refresh the list of available packages
$ sudo apt full-upgrade -y # install the newer versions
$ sudo reboot # if a kernel or firmware update was installed
The terminal page explains what those words mean; for now the pattern to remember is update the list, then upgrade the software.
Network and Wi-Fi
If Imager's Wi-Fi settings worked, the Pi is already online and the network icon in the top bar shows signal bars. To check, and to find the Pi's address:
$ hostname -I # the Pi's IP address(es), e.g. 192.168.4.23
$ ip -brief address # every interface: eth0 is Ethernet, wlan0 is Wi-Fi
$ ping -c 3 raspberrypi.com
- Class network not joined? Click the network icon in the top bar, pick the network, type the password. Or
sudo raspi-config→ System Options → Wireless LAN. - College enterprise Wi-Fi (asks for a username)? Click the network icon and choose the network; the desktop dialog can handle 802.1X credentials, Imager could not.
- Wi-Fi off entirely? Check
rfkill list. If it says "Soft blocked: yes", the WLAN country was not set: fix it in raspi-config → Localisation Options → WLAN Country. - The Pi announces
hostname.localon the local network (mDNS). Some routers block it; then use the IP address fromhostname -Iinstead.
Reach the Pi from another computer
From here on, you will do most of your work on the Pi through a terminal opened from the lab PC or your laptop. Both computers must be on the same network.
-
Find it
On the PC (Windows PowerShell, macOS Terminal or Linux terminal):
$ ping lastname-pi.local # your hostname + .local; Ctrl+C to stopReplies mean the Pi is reachable by name. "Could not find host" means mDNS is blocked on this network: use the IP address you got from
hostname -Ion the Pi. -
Open a terminal on it with SSH
$ ssh username@lastname-pi.local # your-username@your-hostname.local, or username@IPThe first time, SSH shows the Pi's key fingerprint and asks Are you sure you want to continue connecting? Type
yes. Then enter your Pi password (nothing appears while you type; that is normal). The prompt changes tousername@lastname-pi:~ $: you are now typing on the Pi.exitreturns to the PC.Windows 10 and 11, macOS and Linux all ship an
sshcommand. No extra software is needed. -
Optional: the Pi's desktop over the network with VNC
On the Pi:
sudo raspi-config→ Interface Options → VNC → Yes. On the PC, install RealVNC Viewer (a portable version needs no installation), connect tolastname-pi.local, accept the fingerprint, and log in with your Pi username and password. Useful when you have no spare screen; not needed for anything in this course that a terminal cannot do. The official remote-access documentation covers SSH and VNC in more depth. -
Fallback when there is no usable network: USB gadget mode
The Pi can present itself as a network device over a single USB cable to the PC. Follow the gadget mode procedure, documented for the Pi 4, then the
pingandsshsteps above work over the cable. The Pi 400 cannot do this; its USB-C port carries power only.
Shut down cleanly
Every time, no exceptions
Linux keeps writing to the boot drive until it is told to stop. Use one of these, wait until the green activity LED stops blinking (and the screen goes blank), and only then unplug the power and remove the drive.
$ sudo poweroff # or: sudo shutdown now, or the desktop menu → Shutdown
$ sudo reboot # restart without removing power
On the Pi 5, a short press of the power button opens the shutdown dialog; pressing it twice shuts down. Holding it forces power off and should be reserved for a frozen system.
Checklist for this stage
Check yourself
What is the difference between /dev/sda2 and /dev/mmcblk0p2 in the output of findmnt?
sda2 is the second partition of a USB disk (an SSD boot); mmcblk0p2 is the second partition of the microSD card. Both are valid; the output must match the drive you actually wrote, and lsblk's MODEL and SIZE columns confirm it.Why does the first boot take longer and restart on its own?
The Pi is on but ping hostname.local fails from the PC. Name two things to check.
hostname -I instead of the name; if that works, only name resolution is blocked.What must happen before you pull the power cable?
sudo poweroff or the desktop menu), then wait for disk activity to stop. Otherwise files being written are corrupted.