Setting up a Raspberry Pi (3)
Part 3: Updating the Raspberry Pi, and setting up for USB boot.
So now you got the Raspberry Pi all set up, and are connected with it via SSH.
You could start doing anything you are planning to do with it from this point, but there are a few things I like to do with my Raspberry Pi’s, you could skip these steps if they do not apply to your situation, although Step 1 is something you should do each time you connect to your Raspberry Pi, just to keep the software/operating system up to date.
- Step 1: Keeping your Operating System and packages/software up to date.
- a. Type:
sudo apt update
.sudo
> Superuser Do, elevate your rights to administrator for this command.apt
> Command Line Interface (CLI) utility for installing, updating, removing, and otherwise managing deb packages on Raspberry Pi OS (a Debian related Linux distribution). It combines the most frequently used commands from theapt-get
andapt-cache
tools with different default values of some options. go here to read more about it.
What I have noticed that most guides or YouTubes usingapt-get
, are older and found some of them out of date, made by people that are Linux veterans and stuck in their old ways, or really knowledgeable people and actually know the difference, the last category is mostly recognizable, by all the extra options they use with the command.update
> Pulls information on all the latest versions of all the packages/software installed on your system, and creates a index/list of what could be upgraded.
– It does not update/upgrade the packages/software on your Raspberry Pi itself it only indexes. - b. Type:
sudo apt upgrade
.sudo
> Superuser Do.apt
> Utility for managing packages on Raspberry Pi OS.upgrade
> Downloads all the (indexed withupdate
) packages and than apply the upgrades. - c. Type:
y
.
To allow for the process to continue to start the download and upgrade of all the things.
If you want to skip this you could next time typesudo apt upgrade -y
, the option-y
answers the question if you want to proceed. - d. Type:
sudo reboot
.
If there were a lot of updates, or seemingly important ones.
!!! Not (really/always) needed, but I tend to do it anyway, just to make sure everything is running the updated packages/software. !!!
- a. Type:
- Step 2: Setting up the Raspberry Pi 4 to be able to boot from USB.
This is only applicable to the Raspberry Pi 4, it does not work on the Raspberry Pi Zero, with out jumping thru to many hoops.
– You do need to have run,sudo apt update
andsudo apt upgrade
form the previous Step.
Because at the moment of writing this post, the (32 bit, Raspberry PI OS) image used by the Raspberry Pi Imager, does not include the latestraspi-config
(Raspberry Pi Software Configuration tool) that supports the USB boot options (yet).
Even if your Raspberry Pi has the latest Firmware, which mine did not, I needed thesudo apt upgrade
to get the latest firmware as well, you have no way to modify the needed settings.
And trying tosudo apt upgrade
, without expanding the file system first, will get you in a mess of error messages, because it runs out of disk space.
That is why, I do the things I do in this guide, in this order.- a. Type:
sudo raspi-config
.sudo
> Superuser Doraspi-config
> the “Raspberry Pi Software Configuration tool” - b. Use [↑] and [↓] keys to go to option:
3 Boot Options ....
- c. Use [↑] and [↓] keys to go to option:
B5 Boot ROM Version ....
- d. Use [↑] and [↓] keys to go to option:
E1 Latest ....
- e. Select <No> and press [Enter] on the question:
Latest version boot ROM selected - will be loaded at next reboot.
Reset boot ROM to defaults?
I have no idea what really is the right answer, I have seen both, but it seems <no> is the most suggested option, so if it does not work try <yes> ?? - f. Press [Enter].
- a. Type:
- !!! note of caution, as of writing of this post, the following setting is the the default option, so you can leave it and skip these 3 steps (g,h, and i).
If you still decide to set it, it will be permanently, as in irreversible, for it will write it to a one time writable bit or so.
The result will be that, if the default option changes, this Raspberry Pi 4 will keep booting from “USB if there is no Micro SD card”.
Do skip these steps, if you might want to boot from network, or whatever order they might come up with in the future, or when not sure why you would want to set it !!!
- g. Use [↑] and [↓] keys to go to option:
3 Boot Options ....
- h. Use [↑] and [↓] keys to go to option:
B4 Boot Order ....
- i. Use [↑] and [↓] keys to go to option:
B1 USB Boot ....
, and Press [Enter], till you are back in the main configuration screen. - j. Press [Tab] to go to the <Select> , press [↓] key to go to <Finish> and press [Enter], to close the configuration tool.
- k. On the question if you want to reboot now, select:
- <Yes>if you do not want to connect a USB storage device now.
– You will get disconnected while the Raspberry Pi reboots. - <No> if you do want to connect a USB storage device now.
– Type:sudo shutdown
, to safe shutdown the Raspberry Pi.
– You will get disconnected while the Raspberry Pi shuts down.
– Remove the power from the Raspberry Pi.
- <Yes>if you do not want to connect a USB storage device now.
- g. Use [↑] and [↓] keys to go to option:
Optional: Switch form Micro SD card, to a USB Storage device.
Once the power is disconnected, you can connect the USB Storage device.
If the Raspberry Pi has already rebooted, just connect to it with SSH, and type: sudo shutdown
, to safe shutdown the Raspberry Pi, than disconnect the power supply.
Yes I know, you can just pull the power as well, nowadays often without corrupting the Micro SD card, but it is just good practice to do it the safe way, the Right way.
The USB Storage device needs to have the Raspberry Pi OS on it.
You can use the Raspberry Pi Imager from Part 1, Step 2 , to burn/etch the OS image to the USB device.
!!! remember to make sure it is the right device for it will erase all data on it !!!.
Redo all the steps, till this point.
Hmm, I did not test this, so it might give you problems, I will need to look into it myself once I got another large USB storage device.
Why you might ask,
I ordered my external KingSpec 120GB SSD/USB3.1 via Aliexpress,
I have heard to many horror stories about, “cheap” storage devices from China, corrupting/damaging PC’s etc. so I did do my due diligence and ordered one that a source (YouTuber) I somewhat trust recommended, I did read the feedback of buyers, but still I’m not going to plug it just into my (only) PC, I first want to make sure it is working.
Right now I can confirm that it works, and it works great, running this blog and the other blogs and my website App’s and it is way faster than my Micro SD cards (Sandisk Extreme). That is why I feel good about linking to the SSD.
What I did was:
Connect the USB Storage device to a Raspberry Pi, that was to become my Server Pi, with a keyboard/mouse/monitor attached,
Booted it in the desktop, there I launched the [Menu] > [Accessories] > [SD Card Copier]
.
Selected the SD card and the USB Storage device, and pressed [Start].
Added benefit of doing it this way is, no need to do most of the steps in Part 1 , Part 2, Step 1 and Step 2 of this Part 3 all again,
After the “SD Card Copier” was done:
shutdown via menu option,
disconnect the power supply,
disconnect keyboard/mouse/monitor,
remove the Micro SD card,
reconnect the power supply.
This way if the USB storage device was bad/corrupted or anything, it could only take out my Raspberry Pi, that was a risk I was willing to take.
Once the Raspberry Pi had booted.
I connected to it with SSH.
I redid the Part 2, Step 4, Expanding Storage Space / File system.
Because the USB Storage device was much bigger than the Micro SD card I had used, and I wanted to make sure I got it allllll (insert maniacal laughter) available to me.
Then rebooted the Raspberry Pi.
<< Part 2: Starting up the Raspberry Pi for the 1st time.
Part 4: Setting up SSH, Encrypted Key, Disable Password use, SSH Alias >>