RPI Computers

Raspberry PI OS Lite: Headless Install, Setup and Configure

In this tutorial, I will show you how to install Raspberry PI OS Lite edition, the official Raspberry PI Foundation free Operating System without a graphical user interface.

Step-by-Step Instructions for Installing and Configuring Raspberry Pi OS Lite on Your Raspberry Pi Device: A Comprehensive Guide With Links to Optimizing Performance, Customizing Settings, and Exploring Advanced Features for Hobbyists, Makers, and Developers.

What is Raspberry PI OS Lite

Raspberry Pi OS Lite is a lightweight operating system designed for use on the Raspberry Pi single-board computer. It is a minimalist version of the full Raspberry Pi OS, optimized for users who want an operating system that doesn’t come pre-installed with a lot of unnecessary software.

It is ideal for projects that require a low-overhead operating system that can be customized to suit the user’s needs. With Raspberry Pi OS Lite, users have full control over their system and can add only the software packages they need, making it a popular choice for hobbyists, makers, and developers.

The OS is based on the Debian operating system and includes a range of powerful tools and utilities that make it easy to configure and manage the Raspberry Pi device.

Overall, Raspberry Pi OS Lite is a versatile, flexible, and lightweight operating system that provides a solid foundation for a wide range of Raspberry Pi projects.

More about Raspberry PI OS

The Raspberry PI Foundation released 3 different OS versions (you can also compare them in Raspberry PI OS Desktop vs Lite article), all based on the same Linux distribution (Debian).

Sometimes, Raspberry PI kits come with NOOBS pre-installed inside an SD card, but you can also choose to install directly a minimal core and use it from your external PC by SSH with only a command line.

In February 2022, Raspberry PI Foundation finally released its official 64-bit OS release. So, from this date, you can choose between the common 32-bit distribution and the new 64-bit one. Please note that you are forced to use a 32-bit image if you have Raspberry PI 1, Raspberry PI 2 and Raspberry PI Zero computer boards, as their CPU relies on armhf architecture and it doesn’t support the 64-bit instruction set. Newer Raspberry PI computer boards (including Raspberry PI Zero 2) can use both the 32 and 64 bit images.

With Raspberry PI Imager software, you don’t need to download the OS image to your PC. But if you need to download the image, you can get the 2 distributions with the following links:

Once get the distribution, the installation procedure will be the same in both cases.

If you are interested in Raspberry PI OS Desktop, please refer to install Raspberry PI OS Desktop guide, which will guide you to install a complete desktop computer.

What do you need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if to continue with the project or remove them from the shopping cart. So, hardware will be only:

I strongly suggest evaluating buying a case with cooling system (fan) if you are thinking of using your Raspberry PI for resource-intensive applications.

You also need a PC (notebook or desktop) with an SD card reader.

Step-by-step guide

There are 2 main methods to install Raspberry PI OS Lite. The first one is using the official Raspberry PI Imager tool. The second one is using flashing software like, for example, Etcher.

The first method is simpler, but sometimes (in really rare cases) I’ve found that, for a somewhat strange reason, some minor things on the same OS installed with RPI Imager don’t work as when installed with Etcher.

Please note that I suggest running the installation software with administrative permissions in both cases.

Method 1: Install Raspberry PI OS Lite with Raspberry PI Imager

Take the RPI Imager installation software from the Raspberry Pi download page and install it according to your OS. Once installed, please run the Imager with administrative permissions. You will get the RPI Imager open:

With the “Choose OS” button, please enter the sub-menu “Raspberry PI OS (other)“. Then select “Raspberry PI OS Lite (32-bit)” or “Raspberry PI OS Lite (64-bit)” according to your board and project needs.

With the Micro Sd storage plugged into the PC running the RPI Imager, you can now select the Storage with the “Choose Storage” button:

From Raspberry PI Imager 1.7.1, the Foundation added to its official flashing software the ability to pre-configure some settings in order to be ready from the very first boot. Press the gear button below the “Write button” to access the ability to pre-configure WiFi, enabling SSH, timezone and so on:

IMPORTANT NOTE: with my Windows 11 I had a lot of issues getting these advanced options working for the first boot in headless mode. For example, the Raspberry PI was performing the first boot without WiFi, making the installation “useless” instead of “headless”… The fix that worked for me was disabling the “Eject media when finished” option from advanced settings and, after writing the card, checking that the new “bootfs” partition, visible from your Windows PC, includes the “firstrun.sh” file into the root folder. Otherwise, please wait for it to appear before ejecting the card at the end of the flashing operations!

Set according to your preference and click Save. You can start the image writing with the “Write” button. Once write (and verification) operations are successfully completed, a notification will be shown.

If you find any errors here, please try again to write the image and/or try changing the Micro SD storage.

Now you can unmount and extract the storage from your PC, then insert it in your Raspberry PI and power on it. From here you can go to the “Final Operations” chapter of this tutorial.

Method 2: Install Raspberry PI OS Lite with Etcher

IMPORTANT NOTE: as of the “firstrun.sh” file issue, this method could not work at the date (May, 2023) in some Windows versions.

Download and install Etcher on your PC (if not already available).

Download the Raspberry PI OS Lite disk image (ZIP version) in a local folder. As mentioned above, you can get both the 64-bit and the 32-bit versions from the following links:

Insert your SD card into your PC/SD card reader.

Run Etcher on your PC.

Click Select Image and select Raspberry PI OS Lite disk image previously downloaded. Etcher should also have already recognised your SD card. Otherwise, click Change and select the correct SD card.

Click on “Flash! button and wait for the operation to be completed.

Pre-Configure WiFi and SSH Server

In my case, I don’t want to use an HDMI connection to my TV in order to finalize the system setup (my Raspberry will be connected only via Wi-Fi). So, before using it and after having flashed its SD, let’s configure Wi-Fi and SSH connection directly modifying files inside the SD card.

Extract the SD card and re-insert it into your PC. From your file explorer, in “This Computer” we can see 1 SD partition:

We will create a connection configuration file under the boot partition.

Open your notepad and paste the following lines:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=«your_ISO-3166-1_two-letter_country_code»

network={
        scan_ssid=1
        ssid="«your_SSID»"
        psk="«your_PSK»"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

Replace «your_ISO-3166-1_two-letter_country_code» with your ISO Country Code (such as US for the United States), «your_SSID» with your wireless access point name and «your_PSK» with your Wi-Fi password.

Save this file under the boot partition, naming it “wpa_supplicant.conf”.

In addition, we will create a new file named “ssh” (without extension) under the boot partition also to enable SSH in our Raspberry. It is not important what is contained in this file: when Pi boots, it looks for the “ssh” file and if it is found, SSH is enabled and then the file is deleted.

So, let’s open a new Notepad window:

Go to: File -> Save as

Select the boot partition from the SD card in the left column.

Insert in “File name” field value “ssh” and click “Save”. Be aware that Notepad sometimes saves files by adding “.txt” extension. So, control the saved file and be sure that its extension is NOT included.

In 2022, the Raspberry PI Foundation removed the default “pi” user with the password “raspberry” because of security problems with having this user created by default. Instead of this, you can create your very first user by generating an encrypted password from an OpenSSL terminal command:

openssl passwd -6

This command will ask you for the desired password and for confirmation. It will produce as output a characters string that is your encrypted password. put it in a file named “userconf.txt”, containing only the username you choose (plain text) and the encrypted password, divided by column:

my_user:my_enctypted_password

Close and save the file in the boot partition of your Raspberry PI micro SD card.

So, in the end, the files that you must save in the boot partition to get your Raspberry PI OS Lite working with a headless (without monitor/keyboard) setup will be:

wpa_supplicant.conf
ssh
userconf.txt

Extract the SD card from your SD reader and insert it into your Raspberry PI.

Updating Raspberry PI OS Lite

Power the Raspberry PI on and wait a few minutes for the first boot. Check its IP address in your router and connect to it from Putty (or whatever connection program you are using for ssh). Please remember, if required, that the default ssh port (22).

Use your Username / Password to login.

Make the Operating System up-to-date. From the command line:

sudo apt update -y && sudo apt upgrade -y

The “&&” symbol links two different commands in one line so that the upgrade operations will automatically follow the update ones.

Next Steps: Advanced Configurations

After finishing the Raspberry PI OS Lite installation, you may need advanced configurations available from the following links:

What’s Next

If you are interested in more Raspberry PI projects, look at my Raspberry PI tutorials.

Enjoy your Raspberry PI OS Lite edition!

peppe8o

Open source and Raspberry PI lover

View Comments

  • Same as all the articles I can find on Raspberry Pi OS Lite. Unfortunately for me while I can get the SSH prompt to come up it does not like these credentials. Not sure why. Any help would be greatly appreciated.

    • Hi Jeremy. With latest RPI OS releases, you are forced to set the user and password (the default pi user is no more available). Try flashing with RPI Imager and setting the user/pwd before writing the image or try connecting the RPI with a monitor to check if it is asking to set the user for first boot

  • Thanks for your help. I was running into the following issue when trying to flash either 32-bit or 64-bit Raspberry Pi OS Lite using Raspberry Pi Imager: "[FAILED] Failed to start Command from Kernel Command Line". Flashing with Balena Etcher instead and configuring WiFi and SSH using your methods stated above worked perfectly for me.

    • Hi Eoin,
      I've never experiences this issue, but found that some users in the Web get your same problem. For example, there's a GitHub issue here:https://github.com/raspberrypi/linux/issues/4458, but it was closed without a solving answer. The only interesting thing here is that the user wrote that flashing the image without Advanced settings allows to avoid the error. Another post pointing to the same workaround is the following, even if related to flashing an ubuntu image: https://github.com/raspberrypi/rpi-imager/issues/213.
      The only suggestion I can give you is trying to run the RPI imager with admin permission (sudo) or changing the rpi imager version

  • "IMPORTANT NOTE: with my Windows 11 I had a lot of issues getting these advanced options working for the first boot in headless mode....
    "The fix that worked for me was disabling the “Eject media when finished” option from advanced settings and, after writing the card, checking that the new “bootfs” partition, visible from your Windows PC, includes the “firstrun.sh” file into the root folder.
    Otherwise, please wait for it to appear before ejecting the card at the end of the flashing operations!"
    This suggests that your stupid Windows 11 software stack is lying to you about write operations being complete. Which is THE most basic function of an OS. See where the problem is? Using Windows, sold by liars, used by liars ("hey, privacy doesn't matter" is a lie people tell themselves, due to conditioning and brainwashing, so they tolerate spyware like Android, Facebook, Windows et al).
    Check Write Caching settings for your drive(s), however that slows-down performance.
    That said, when you first use a newly-purchased flash media (sd card, USB flash drive, or even ssd or external HDD) here is a tip to prove integrity as a basic baseline for any future troubleshooting:

    Use f3 in Linux (I think a Windows version exists). Fight Flash Fraud is what it stands for.
    It is a simple utility that writes to the whole disk, filling it to capacity. It then reads back the files and checksums them to prove their integrity.
    Whilst you wait. It also gives you an idea of the speed of your card under true load. Better to know up-front, rather than lose half your holiday photos as happened to a family member!
    In Linux, you can run the 'sync' command to flush the file system cache to disk. That way you know the write has finished.
    If Windows 11 is really that pathetic at performing properly, I would be running some utility to monitor filesystem I/O. iotop is useful on Linux, which tells you what processes are doing disk I/O and at what rate. Useful for diagnosing disk transfer issues in a basic way from the command line.
    But this fake progress bar crap is what Microsoft are notorious for.
    Only because idiots keep feeding that beast, does the beast not learn to behave.

    • Hi Langleyhooer,
      thank you for your feedback. As additional notes, from my experience I had better chances to get the image working by cancelling the whole SD card from the Raspberry PI Imager before writing the new one.
      Moreover, I should admit that the newest Raspberry PI Imager versions have less errors in providing a working image (the firstrun.sh file is correctly completed before closing the card).

      Many thanks again

Published by
peppe8o

Recent Posts

Some links in this post may be affiliate links. We may get paid if you buy something or take an action after clicking one of these, but without addictional costs for you compared to direct buying.

SPI communication between two Arduinos

In this tutorial, we will use two Arduino Uno to demonstrate the Serial Peripheral Interface…

1 week ago

Automatic irrigation system with Arduino and Sensors

In this tutorial, we will be making an automatic irrigation system (AIS) with Arduino and…

2 weeks ago

Beginner’s Guide to Use Python Virtual Environment with Raspberry PI (venv)

This tutorial will show you how to use Python Virtual Environment with Raspberry PI computer…

3 weeks ago

Get Betting Odds with Raspberry PI and Odds-API (free)

This tutorial will show you how to get betting odds with Raspberry PI by using…

1 month ago

Backup Raspberry PI (computer) Data with Rsync to Remote NAS

This tutorial will show you how to perform the backup of Raspberry PI (computer board)…

1 month ago

Honeygain and Raspberry PI: Earn by Sharing Internet Connection

This tutorial will show you how to install Honeygain on a Raspberry PI computer board…

1 month ago