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:
- Download an image (*.img).
- Format the SD card.
- Create a file system.
- Copy the image into the SD card.
- 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.
-
it probably does not do steps 2 and 3jsotola– jsotola2024年11月23日 18:25:13 +00:00Commented Nov 23, 2024 at 18:25
2 Answers 2
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.
-
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– loco.loop2024年11月23日 20:53:59 +00:00Commented Nov 23, 2024 at 20:53
-
1It 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– goldilocks2024年11月23日 22:24:44 +00:00Commented Nov 23, 2024 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– goldilocks2024年11月23日 22:35:22 +00:00Commented Nov 23, 2024 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– goldilocks2024年11月23日 22:41:34 +00:00Commented Nov 23, 2024 at 22:41
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.
-
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– loco.loop2024年11月23日 21:48:16 +00:00Commented Nov 23, 2024 at 21:48 -
Yes. The image includes commands to run on 1st boot. The preconfiguration creates data used by these commands.Milliways– Milliways2024年11月23日 21:52:36 +00:00Commented Nov 23, 2024 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– loco.loop2024年11月24日 00:39:08 +00:00Commented Nov 24, 2024 at 0:39
Explore related questions
See similar questions with these tags.