CGCrumbs
Simbiotic - A Cyberpunk Thriller Novel

Setting Up Raspberry Pi without Monitor (Headless) with Access via SSH

Summary

This tutorial describes how I set up a Raspberry Pi 2 model B without a monitor (headless) with access via Secure Shell (ssh). This type of usage is common when the Raspberry Pi computer is used for tasks that do not require a monitor. For example a web server, personal weather station, or git source code server.

These steps were documented using a Kubuntu 24.04 GNU/Linux desktop computer and a Raspberry Pi 2 connected to the network via ethernet cable.

Written: November 29, 2025

Contents

Install RPi OS Lite

To minimize the resources required for our headless RPi, we chose to install the Lite version of the operating system as we do not plan to connect an HDMI monitor.

  1. Download Raspberry Pi OS Lite disk image.

  2. Insert the MicroSD card into your computer.

  3. Determine the /dev/device path.

    The device path is usually something like /dev/mmcblk0 or /dev/sdb.

    sudo dmesg | tail

    Example output:

    $ sudo dmesg | tail
    [  227.218363] sdhci-pci 0000:01:00.2: PCI INT A -> GSI 16 (level, low) -> IRQ 16
    [  227.218396] sdhci-pci 0000:01:00.2: Refusing to bind to secondary interface.
    [  227.218413] sdhci-pci 0000:01:00.2: PCI INT A disabled
    [  227.218884] jmb38x_ms 0000:01:00.3: enabling device (0000 -> 0002)
    [  227.218906] jmb38x_ms 0000:01:00.3: PCI INT A -> GSI 16 (level, low) -> IRQ 16
    [  227.218931] jmb38x_ms 0000:01:00.3: setting latency timer to 64
    [  227.617315] mmc1: new SDHC card at address 0001
    [  227.617720] mmcblk1: mmc1:0001 SD8GB 7.32 GiB
    [  227.621661]  mmcblk1: p1 p2
    [  228.753036] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)

    From above output the device is /dev/mmcblk1 (we ignore the partition portions p1 and p2).

    WARNING:   It is very important to identify the correct device. Use of the wrong device path can result in loss of data and/or the operating system.

  4. Ensure that the device is unmounted by checking the output from df to see if the device is in use.

    Example output:

    $ df
    Filesystem     1K-blocks    Used Available Use% Mounted on
    /dev/sda1        6734812 5612328    780368  88% /
    udev              499152       4    499148   1% /dev
    none              506428       8    506420   1% /tmp
    tmpfs             101288     844    100444   1% /run
    none                5120       0      5120   0% /run/lock
    none              506428      72    506356   1% /run/shm
    none              506428     572    505856   1% /var/log
    none              506428       0    506428   0% /var/tmp
    /dev/mmcblk0p1  15615056 1183088  14431968   8% /media/mmcard16gb
    /dev/mmcblk1p1    261868  111280    150588  43% /media/0F39-638F
    /dev/mmcblk1p2   7177771   83036   7094735   2% /media/0c0676d8-24f7-43c4-8bed-d19e6ea3a147

    If the device is in use then unmount each mount point.

    Using the example above we unmount two locations from mmcblk1:

    sudo umount /media/0F39-638F
    sudo umount /media/0c0676d8-24f7-43c4-8bed-d19e6ea3a147
  5. Write the image to the Micro SD Card.

    Be sure to use the correctly identified device! In this example the device path is /dev/mmcblk1.

    For example:

    xz --decompress --stdout ~/Downloads/2025-10-01-raspios-trixie-armhf-lite.img.xz | sudo dd bs=4M of=/dev/mmcblk1
    sudo sync

    or

    unzip -p ~/Downloads/2021-01-11-raspios-buster-armhf-lite.zip | sudo dd bs=4M of=/dev/mmcblk1
    sudo sync
  6. Enable and pre-create SSH password

    Note: These steps are required because we are planning to use RPi headless (without a monitor), and we do not plan to connect the RPi to a monitor even for initial setup.

    Use the following steps to pre-create ssh and userconf.txt files in first partition on the microSD card.

    sudo bash
    mount /dev/sd???1 /mnt
    touch /mnt/ssh
    # Create a password for account 'pi'
    mypassword=`openssl passwd -6`
    echo "pi:${mypassword}" > /mnt/userconf.txt
    umount /mnt
    exit

    On first boot on the RPi this enables ssh service and then removes ssh file.

  7. Remove the Micro SD Card from the desktop or laptop computer.

Determine IP Address of Raspberry Pi and Configure Localization

In the default raspios configuration, an IP address is acquired dynamically via a protocol called DHCP (Dynamic Host Configuration Protocol).

In order to connect to the RPi over the network we need to know the IP address that is assigned.

One way is to use an Android app, such as Port Authority, to scan the network IP address range. Another way (described below) is to use an app called nmap on our desktop/laptop computer.

  1. Ensure nmap command is installed.

    sudo apt install nmap

  2. Insert microSD card into RPi, connect ethernet cable to network, and power-up.

  3. Wait a minute or two for the Raspios operating system to run its initial setup.

  4. List devices on your network.

    If your network IP address range is 192.168.1.x, use:

    nmap -sn 192.168.1.1/24

    For example:

    $ nmap -sn 192.168.1.1/24
    Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-11-18 11:33 MST
    Nmap scan report for _gateway (192.168.1.1)
    Host is up (0.00090s latency).
    <snip>
    Nmap scan report for 192.168.1.101
    Host is up (0.0067s latency).
    Nmap scan report for 192.168.1.105
    Host is up (0.00057s latency).
    Nmap scan report for 192.168.1.106
    Host is up (0.00074s latency).
    Nmap done: 256 IP addresses (12 hosts up) scanned in 2.43 seconds

    Try connecting to the Raspberry Pi starting with the last IP address as it is most likely the most recent IP address assigned.

    ssh pi@192.168.1.106

    If the connection works you should be prompted for a password and the session may look similar to:

    The authenticity of host '192.168.1.106 (192.168.1.106)' can't be established.
    ED25519 key fingerprint is SHA256:Pmg9mS3kwDqMcLaWYwX8AQUYx45AQqs9DrpnfbHg24Y.
    This key is not known by any other names.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added '192.168.1.106' (ED25519) to the list of known hosts.
    pi@192.168.1.106's password:
    Linux raspberrypi 6.12.47+rpt-rpi-v7 #1 SMP Raspbian 1:6.12.47-1+rpt1 (2025-09-16) armv7l
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    pi@raspberrypi:~ $
  5. Update software

    sudo apt update && sudo apt upgrade

  6. Run raspi-config tool to configure RPi.

    sudo raspi-config

    Use arrows, space bar, tab, and enter keys to navigate and possibly change the following settings:

    1 System Options
       s2 Audio
           0 HDMI 0               # Leave at HDMI 0 or choose Headphones for 3.5mm jack
       S3 Password
           yourpwd                # Set/change new password for pi account
       S4 Hostname
           rpisvr                 # Use a hostname you prefer
       S5 Boot / Auto Login
           B4 Desktop Autologin
    
    3 Interface Options
       P2 SSH                     # enable SSH server
    
    5 Localisation Options
       L1 Locale
           en_CA.UTF-8            # Use your locale and set as default
       L2 Timezone
           America - Edmonton     # Use your timezone
       L3 Keyboard                       # This option doesn't appear to work over ssh
           Generic 105-key (Intl) PC     # Use your keyboard
             Other
               English (US)              # To fix tilde ~ key
                 Right Alt (AltGr)
                   No compose key
    
    6 Advanced Options
       A1 Expand Filesystem       # Ensure that all of the SD card is available.

    Choose Finish and reboot.

    sudo reboot

  7. [Optional] If using external speakers run alsamixer to boost volume for 3.5mm audio.

    Establish ssh connection.

    ssh pi@192.168.1.106

    Run alsmixer.

    alsamixer

    Use F3 for View: [Playback] for Item: Headphone and use Up arrow to increase volume to 100

    Use ESC key to exit

    Optionally test volume with:

    speaker-test -c2 -twav

    Use Ctrl+C to stop.

  8. Reboot

    sudo reboot

Conclusion

Congratulations, you should now have your RPi set up to run headless (without a monitor).

References

Note that I set up a dht22 sensor on a headless RPi2 using portions of the following tutorials:

The Medusa Deception novel - free first in series
News   Documentation     Copyright (c) 2013-2025 Curtis Gedak

Valid HTML 4.01! Correct CSS!