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.

1
  • it probably does not do steps 2 and 3
    – jsotola
    Commented Nov 23 at 18:25

2 Answers 2

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.

4
  • Cool, that sounds easy enough... Do you know how to configure the image before putting it in the Pi? (Like what is stated in the docs) From what I'm reading, config.txt is now obsolete...
    – loco.loop
    Commented Nov 23 at 20:53
  • 1
    It isn't obsolete, just some of it's functionality is on bookworm, so the docs have split off those "legacy" options (those will work on the legacy image, which is intended for older models, and isn't debian bookworm based) from the rest. WRT configuring the image, you can do whatever you like to it, that's just a matter of expertise -- you'd have to ask specific questions about specific things.
    – goldilocks
    Commented Nov 23 at 22:24
  • ...There are various configuration/deployment management tools like https://en.wikipedia.org/wiki/Progress_Chef and puppet that can be used on a Pi, but how worthwhile that is depends on your needs; if it is just to have a single system "just so" when you first fire it up, probably not. I've amended my remark about the imager moving toward elimating the need for raspi-config, BTW, as I'm not sure this is entirely possible (or desirable).
    – goldilocks
    Commented Nov 23 at 22:35
  • If you have a decent amount of linux experience and understand POSIX shell, raspi-config is a long script full of short functions that will make it plain how all the stuff it does is done (which isn't anything and everything, but it is a fair bit).
    – goldilocks
    Commented Nov 23 at 22:41
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.

3
  • When you say "until you have run the setup", you mean after doing something like dd to copy the image into the SD and running that SD into the Pi?
    – loco.loop
    Commented Nov 23 at 21:48
  • Yes. The image includes commands to run on 1st boot. The preconfiguration creates data used by these commands.
    – Milliways
    Commented Nov 23 at 21:52
  • I just configured an SD with Imager and I see it creates a script called firstrun.sh . With the information asked in the Settings...
    – loco.loop
    Commented Nov 24 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.