Recently I was intrigued by the possibility of booting my Raspberry pi 3b+ off an ssd. After reading multiple online documents and forums I decided to give it a try. What follows is the process I used to create a Hassio installation that boots off an ssd connected to my Raspi 3b+ running Raspbian Stretch Lite. This same process should also work for any media such as an sd card or thumb drive, if you like.
I currently boot off a Kingston 120G SSD plugged into one of the USB ports. In addition to Hassio, I run the following add-ons: Caddy, Dnsmasq, DHCP server, DuckDNS, IDE, Samba share, Portainer, ESPHome, and Backup Hassio to Google Drive. Typical CPU usage is 3-5%. I’ve had no observed performance issues to date.
The update process for this system’s add-ons and Hassio is no different than for the typical Hassio environment. I suppose one caveat is Docker and Raspbian need to be maintained separately. On the other hand, I got rid of the sd card, I can mount USB drives, and I have control over the OS.
All the information below is available in bits and pieces on the web. At times I’ve cited where I got the information. Towards the end, this process jumps between su mode and not. This is because I patched several different processes together. You can likely just stay in su mode through the end of the process and modify commands appropriately.
Bonus: I have a Chromebook which added to the challenge as all processes I found use Windows or Mac machines. This process uses Chrome OS tools to create the image. Obviously substitute your system’s tools in place.
So let’s start.
Wipe the media (optional unless your media has a previous attempt at a system on it. In my research I made several attempts before getting a final process that worked )
Prepare the media for formatting. This is especially important if the media contains a previously installed OS. The Chromebook will be unable to format the drive unless it is wiped first. Enough said.
- Plug in media to the Chromebook USB port
- Open Chromebook Recovery Utility (available in the Google Chrome Web Store)
- Click on the gear icon at the top of the window
- Erase recovery media (your media)
- Eject the media from the Chromebook
Format the drive
- Plug your media back into the USB port on your Chromebook. The media will be recognised by the system.
- Next, open up the Files app (the blue folder icon). In the navigation sidebar find your media (if you have more than one connected make sure that it’s the correct one before proceeding).
- Right-click on the media you wish to format and select the ‘Format Device‘ option from the menu.
- Chrome OS will prompt you to confirm that you wish to format. To proceed click ‘OK’. The OS will then do its thing. Formatting on a 2GB USB drive happened in no time at all, but be patient if formatting something larger, such as an external USB drive. When formatting has completed you will see a small toast appear in the lower right hand corner. Devices are formatted to a FAT32 file system.
- Download 32-bit Raspbian Stretch Lite from the Raspberry Pi website
- Return to the Chromebook Recovery Utility to write the image to your media
- Select the gear icon at the top of the window
- Select “Use local image” and follow the app directions.
- Now add a zero length file named “ssh” to the boot partition to enable SSH capability.
- Eject the media from the Chromebook
Boot Raspi from USB
The following assumes the pi is hardwired to the network. This is not a requirement but it’s how mine is configured. There is nothing you need to do to a Raspi 3b+ to make it boot from one of it’s USB ports other than remove any sd card loaded in the slot. USB boot is enabled out of the box.
- Connect the media to a Raspi USB port and it power up. (remember no sd card in the slot) The nice thing is that if you’re having problems anywhere in the process, you can always unplug the media from the USB port and reinsert the sd card and you’re back to a working system.
- Get the Raspi IP address via the router device table or some other method.
- Now SSH into the Raspi via Chromebook Secure Shell Utility (available from the Google Chrome Web Store). The following needs to be loaded into the Utility’s window:
name = [email protected] port = 22 login username=pi password = raspberry
Hint: The two following commands are helpful in the Chromebook Secure Shell Utility. It was a time consuming search to locate these gems.
To get to the java script shell type: ctrl+shift+j
To erase all keys use: term_.command.removeAllKnownHosts();
Now change the Raspi’s password by typing the command below and following the prompts:
$ sudo raspi-config
Set a static IP address. Type the following at the command prompt to invoke the nano editor:
$ sudo nano /etc/dhcpcd.conf
The file contains commented out lines. Uncomment the appropriate lines and fill in the specifics for your system). Edit the config file to say the following:
interface eth0 static ip_address=192.168.1.xxx/24 // your IP address replaces at least xxx static routers=192.168.1.1 // your router IP static domain_name_servers=22.214.171.124 // your choice
Then close the file and save it using ^x and pressing y, etc…
Now reboot the Raspi using the following command:
$ sudo shutdown -r now
Install utilities required by Hassio
Once it reboots, SSH in again, hopefully at the same IP address as last time, as long as the static IP assigned is the same as the old IP address.
Probably a good time to make sure the latest and greatest is on the media so type the following commands at the prompt:
$ sudo apt-get update
$ sudo apt-get upgrade
The following is out of “Alternative: install on generic Linux host” from Home Assistant website instructions. Install utilities needed by Hassio with the following commands:
$ sudo -i
# apt-get install software-properties-common
# apt-get update
# apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat
Getting near the end of the process now. It is time to install Docker on the Raspi. I read somewhere that you need to install Docker via their convenience script for a Raspi (ARM). So that’s what I did. The following is from the Docker site:
This example uses the script at get.docker.com to install the latest release of Docker CE on Linux. To install the latest testing version, use test.docker.com instead. In each of the commands below, replace each occurrence of get with test.
Warning: Always examine scripts downloaded from the internet before running them locally. $ curl -fsSL https://get.docker.com -o get-docker.sh $ sudo sh get-docker.sh <output truncated> If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like: $ sudo usermod -aG docker your-user // insert pi for your-user Remember to log out and back in for this to take effect! Warning: Adding a user to the “docker” group grants them the ability to run containers which can be used to obtain root privileges on the Docker host. Refer to Docker Daemon Attack Surface for more information. Docker CE is installed. It starts automatically on DEB-based distributions.
Finally install Hassio
After rebooting update everything because… why not!
$ sudo su
# apt-get update
# apt-get upgrade
Now start the Hassio installation (the following is one long command… line wrapping happens)
# curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m raspberrypi3
Then, reboot using
# shutdown -r now
The Raspi will take ~10-20 minutes to reboot as it downloads HassIO and installs it.
Verify that HassIO Has Been Installed
The default HassIO location is hassio.local:8123, but since we installed it atypically, we need to access it via raspberrypi.local:8123. You may also use the IP address. – Finished –
Comments or questions welcome.