2

How can you install Raspberry Pi OS without previously installing Imager?

(In either Linux or macOS using the command line ideally, without installing additional tools.)

I searched a bit online but I didn't find it. I guess the question has already been answered somewhere...

From intuition, it feels like what Imager does is:

  1. Download an image (*.img).
  2. Format the SD card.
  3. Create a file system.
  4. Copy the image into the SD card.
  5. Configure the OS so that it works on the Raspberry Pi.

I would like to be able to do this without using an external tool and would love to see that process documented. However, I understand that Imager might be doing something more sophisticated that I don't.

loco.loop
  • 147
  • 1
  • 5

2 Answers2

4

This is incredibly simple on linux. This is the only way I have ever created Pi cards, other than actually creating the partitions myself and copying filesystem content over (usually for backup-restores, duplications, pre-sizing, etc). I may have done it a hundreds times and have absolute confidence in it. I believe the same methodology works on Mac although I am not a Mac user so won't promise.

The images come zipped/compressed, extracted from which you get, eg., 2024-07-04-raspios-bookworm-arm64.img. You need to know the device node of the SD card; I normally use a USB adapter so it shows up as, eg., /dev/sdc. If the card is already formatted, there will be a /dev/sdc1 as well -- that is not what we are interested in, we need the card, not a partition on it.

Partition on the card should not be mounted when you do this. If your DE or something automounts, make sure it is "ejected"/unmounted first. What is currently on the card is irrelevent. You do not need to erase or format anything, doing so will be meaningless.

dd if=2024-07-04-raspios-bookworm-arm64.img of=/dev/sdc bs=4M

That's it. I'm not sure that the block size really matters (it may affect the speed of the write), that's the one I've always used. For information about dd, see man dd.

You can do a crude verification with fdisk -l by running it on the .img file and then on the device node. The partition names (the "Device" column) will be different but everything else should match up (for current Rpi OS images, two partions, the first small (< 1GB) one W95 FAT32 (LBA) and the second larger one Linux.

I understand that Imager might be doing something more sophisticated that I don't.

Potentially, but not necessarily, yes. I have never used it, but from my work here am aware it can do things like pre-configure networking, etc. The image as is, copied above, will boot to a raspi-config interface the first time (AFAIK the imager would not change that). You can mount the card before you use it and modify things yourself, of course.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
2

It is certainly possible; indeed this was originally the only way to create a SD Card and if you look at old posts on this site you would have found numerous examples.

This process is not without its drawbacks; it is easy to accidentally destroy the OS on the computer you are using; it can be glacially slow on macOS if you don't use the correct raw disk devices. For these reasons a few tools have been developed to simplify and safeguard the process.

No, you cannot preconfigure (at least to do anything worthwhile) until you have run the setup, which expands the image and also creates a user and guides you through the localisation etc. which could be done manually (indeed this is the way Linux was traditionally done) although you can elect to skip this.

NOTE it is at least theoretically possible to preconfigure by creating the data files created by the Imager for use on 1st boot but these are undocumented.

Milliways
  • 62,573
  • 32
  • 113
  • 225