Hassio booting off ssd on a Raspberry Pi 3b+

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.

  1. Plug in media to the Chromebook USB port
  2. Open Chromebook Recovery Utility (available in the Google Chrome Web Store)
  3. Click on the gear icon at the top of the window
  4. Erase recovery media (your media)
  5. Eject the media from the Chromebook

Format the drive

  1. Plug your media back into the USB port on your Chromebook. The media will be recognised by the system.
  2. 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).
  3. Right-click on the media you wish to format and select the ‘Format Device‘ option from the menu.
  4. 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.

Install Raspbian

  1. Download 32-bit Raspbian Stretch Lite from the Raspberry Pi website
  2. Return to the Chromebook Recovery Utility to write the image to your media
  3. Select the gear icon at the top of the window
  4. Select “Use local image” and follow the app directions.
  5. Now add a zero length file named “ssh” to the boot partition to enable SSH capability.
  6. 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.

  1. 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.
  2. Get the Raspi IP address via the router device table or some other method.
  3. 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 = pi@raspberrypi
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();

  1. Now change the Raspi’s password by typing the command below and following the prompts:

    $ sudo raspi-config

  2. Set a static IP address. Type the following at the command prompt to invoke the nano editor:

    $ sudo nano /etc/dhcpcd.conf

  3. 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=8.8.8.8     // your choice
  1. Then close the file and save it using ^x and pressing y, etc


  2. Now reboot the Raspi using the following command:

    $ sudo shutdown -r now

Install utilities required by Hassio

  1. 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.

  2. 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

  3. 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

Install Docker

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

  1. After rebooting update everything because
 why not!

    $ sudo su
    # apt-get update
    # apt-get upgrade

  2. 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

  3. Then, reboot using

    # shutdown -r now

    The Raspi will take ~10-20 minutes to reboot as it downloads HassIO and installs it.

  4. 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.

11 Likes

Is the configuration also available for hard disk and USB?

I don’t know about the power needs. The Kingston ssd drive I’m using is powered from the USB port of the raspi without any problem. Other than power I don’t think there is any issue with the setup running from a hard drive.

How do you verify Hassio has been installed?

You can open HA in the browser. It will show a maintenance page until it’s ready.

Very structured and informative post. Well done !!!

I have not managed to make a browser connection. Can I verify using terminal commands?

Which interface settings must I enable with raspi-config?

I only changed the password although I believe you can also set the wifi physical location to remove a system message. Nothing else is required.

Hassio should pretty much just start up after the final reboot. Need to use either raspberrypi.local:8123 or ipaddress xxx.xxx.xxx.xxx:8123. Hassio.local:8123 will not work as the system is running on stretch lite not the hassio default minimal OS.

It worked! But I had to change “raspberrypi.local:8123” to the-changed-name-of-my-pi.local:8123

Excellent! I’m glad you were successful. Yes, if you changed the hostname then you access it as you stated. Sorry, I had left mine with the default naming. Using the raspi-ipaddress:8123 should always work no matter the hostname.

“In each of the commands below, replace each occurrence of get with test.”
Why?
What would this do?
What if I use “get”?

This looks like a great method to run hassio from an ssd on my pi3b+. However, what to do with existing configs? Is it as simple as restoring a snapshot taken from the previous (sd based) install, or no?

If you were previously running Hassio then I don’t see any reason why a restore wouldn’t work. If it doesn’t you still have your original sd card so nothing lost.

micque, I did actually have a problem with restoring a snapshot when I was experimenting with a dev image, but that was just a fluke. I was later able to restore everything back as it was on the said dev image after a second try. I think something just got borked from my impatience, but I trust the snapshots. :wink:

On a happy side note, I am currently running hassio on hassos off of an ssd successfully. Yes, you read that right, hassos without an sd card! I’m posting about that here:

This method doesn’t replace the OP’s method, but it is better suited for hass newbs who would otherwise just do the officially recommended user friendly hassos sd card thing. It doesn’t expose the same capabilities as running hassio in docker under raspbian, but it does allow hassos users to get away from relying on sd cards without having to rely on scripts, terminal commands, or maintaining raspbian. The devs are looking to include hassos USB boot in the coming release. I bet in the near future hassos on pi + USBssd will become the new officially recommended setup.

Nice, thanks a lot! I have followed the tutorial from 1st post. In add-on store I can see “Community Hass.io Add-ons”, but how to add standard add-on like configurator and duckDNS?

@truglodite, I am confused. It is possible to run HA from guides of https://www.home-assistant.io/getting-started/, but instead SD using SSD, without the whole raspbian and docker thing? On 3b+

@Bartek_Pes, more or less
 however the currently officially recommended hassio 2.12 rpi image won’t work
 instead you have to install the hassos 3.4 rpi image (the github link is in my older posts on this subject). Depending on your specific hardware there are also some additional setup procedures you may also have to do before you can boot from ssd (enabling USB boot on the pi’s OTP, and copying bootcode.bin to an sd if your particular ssd isn’t supported by uboot).

So bottom line, there is a way right now for pretty much everyone to move their pi3 based hassio to ssd (without raspbian and docker). The exact detailed steps depend on hardware choices, but with the 2 steps mentioned above almost any USB ssd hardware can be used. I have been getting lots of questions on this subject since posting about it. My setup has been running perfectly on ssd for several weeks now (my database is 2.8GB so far). So I think it may be a safe time for me to invest in writing a ‘howto’ guide.

2 Likes

Thanks for response. I have managed to instal it without any issue. It is just a matter of burning the hassos 3.4 on ssd. Everything else was the same as hassio on SD.

It should be now recommended way for beginners. SD sucks and my go to garbage after only few months . Even with my small number of sensor and switches.

P.S. I still don’t know why hassio on rasbian didn’t show te basic addons in the store. But with hassOS i don’t have that problem.

great tutorial 
 since Pi3B+ is able to boot from USB (when removing SD Card), will it be possible to etch HASSIO on SSD like I did on the SD card? Or a docker is required? (PS. I will be migrating HASSIO from SD to SSD)

Running on a harddrive without problems.
Needed bootbin only on sdcard