From 249b5477f466ad19e5b3135732e1faaf7e6f97d8 Mon Sep 17 00:00:00 2001 From: Jordan Herzstein Date: Sun, 16 Jun 2024 23:09:32 -0400 Subject: [PATCH] auto updating site --- content-org/index.org | 3 +- content-org/posts/home_assistant_setup.org | 86 +++++++ content/_index.md | 3 +- content/posts/home_assistant_setup.md | 101 ++++++++ public/index.html | 55 ++-- public/index.xml | 11 +- public/posts/home_assistant_setup/index.html | 250 +++++++++++++++++++ public/posts/index.html | 34 +++ public/posts/index.xml | 9 + public/sitemap.xml | 30 ++- public/tags/dietpi/index.html | 190 ++++++++++++++ public/tags/dietpi/index.xml | 19 ++ public/tags/home-assistant/index.html | 190 ++++++++++++++ public/tags/home-assistant/index.xml | 19 ++ public/tags/index.html | 7 +- public/tags/index.xml | 63 +++-- public/tags/rpi/index.html | 190 ++++++++++++++ public/tags/rpi/index.xml | 19 ++ public/tags/technology/index.html | 35 +++ public/tags/technology/index.xml | 11 +- public/tags/tutorial/index.html | 35 +++ public/tags/tutorial/index.xml | 11 +- references.bib | 55 ++++ 23 files changed, 1371 insertions(+), 55 deletions(-) create mode 100644 content-org/posts/home_assistant_setup.org create mode 100644 content/posts/home_assistant_setup.md create mode 100644 public/posts/home_assistant_setup/index.html create mode 100644 public/tags/dietpi/index.html create mode 100644 public/tags/dietpi/index.xml create mode 100644 public/tags/home-assistant/index.html create mode 100644 public/tags/home-assistant/index.xml create mode 100644 public/tags/rpi/index.html create mode 100644 public/tags/rpi/index.xml diff --git a/content-org/index.org b/content-org/index.org index b582a38..b530052 100644 --- a/content-org/index.org +++ b/content-org/index.org @@ -75,6 +75,7 @@ Hello, my name is Jordan, thank you for stopping by my website. * What am I up to? + I'm a full time student. + Getting into some [[https://www.home-assistant.io/][Home Assistant]] things. -+ Listening to [[https://www.connorgoldsmith.com/cerebro][CEREBRO]] podcast. Having recently watched X-Men '97 I +watched+ listened to their Magneto episode and now I think I love X-Men. This is coming from a hipster who hated 90% of superhero things since I was 15 being spoiled by [[https://parahumans.wordpress.com/][Worm]]. ++ Messing with a [[https://rentry.co/oraclevps][free oracle vps]] for funzies. Started a minecraft server as I haven't played it in since 2020-ish... This is how I figured out that [[https://www.minecraft.net/en-us/article/account-migration-last-call][Micrsoft stole my childhood]]. ++ Listening to [[https://www.connorgoldsmith.com/cerebro][CEREBRO]] podcast. Having recently watched X-Men '97 I +watched+ listened to their Magneto episode and now I think I love X-Men. This is coming from a hipster who hated 90% of superhero things since I was 15 being spoiled by [[https://parahumans.wordpress.com/][Worm]]. UPDATE Jun 16: I literally listened to 20 hours of Madelyne Pryor discussion, a character I have hardly heard of prior (ha) to this calendar year. + [[../images/hatedaylightsavings.png][I (STILL) HATE DAYLIGHT SAVINGS! I (STILL) HATE DAYLIGHT SAVINGS!]] diff --git a/content-org/posts/home_assistant_setup.org b/content-org/posts/home_assistant_setup.org new file mode 100644 index 0000000..fde66ba --- /dev/null +++ b/content-org/posts/home_assistant_setup.org @@ -0,0 +1,86 @@ +#+TITLE: Booting DietPi on an SSD and installing Home Assistant in Docker +#+date: 2024-06-07 +#+hugo_base_dir: ../../ +#+HUGO_AUTO_SET_LASTMOD: t +#+hugo_section: posts +#+HUGO_MENU: :menu "posts" +#+filetags: rpi home-assistant dietpi technology tutorial +#+HUGO_CODE_FENCE: +#+EXPORT_FILE_NAME: home_assistant_setup.org +#+hugo_front_matter_key_replace: description>summary +#+begin_description +Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. +#+end_description + +I have been eyeing home assistant for quite a bit but haven't had the oppourtunity to do something with it until a family member wanted to set up some iot appliances and wanted all of them to be integrated into one interface, and I was more than happy to get involved. I first wanted to get a more advanced router set up to isolate everything iot from the main lan. I ended up copying my an openwrt archive from the linksys router I got [[/posts/summer_2023_projects/#img-src-images-blog-openwrt-icon-dot-png-width-10-openwrt][last year]]. Unfortunately I got the wrong linksys router by accident at my first go at it which set me back by about a week. Alas, I was still able to boot up a Raspberry Pi 4 with Home Assistant to start tinkering with, which I spent a little time a couple of Saturdays ago doing. I since have moved over some lutron configurations which I may write about if I think it's interesting enough and doesn't divulge anything too private. This guide should get you to a simple starting place (most of which is just taken from DietPi and Home Assitant documentation) but I will document it here regardless. + +* Prerequisites + +This guide assumes that you already have the following: ++ A Raspberry Pi 4 ++ An external SSD ++ A usb to sata connector ++ A separate computer or laptop with a usb port. ++ Optional: Ethernet cable + +** Flashing DietPi onto an SSD +First it's important to mention that my choice to boot from an SSD was intentional, as Home Assistant will be doing a lot of writes, it's important to choose a storage device that is less prone to wearing out than a micro SD card. Additionally, despite needing to adapt from a USB 3.0 port, read/write speeds should also be faster than a micro SD card. Doing this from a Raspberry Pi 4 is fairly simple, it only required me to flash the operating system to the drive and then turn on the pi. You can download their Raspberry Pi 2/3/4/Zero 2 Dietpi image from their website and mostly follow documentation for the installation steps [[cite:&DietPi_download]]. The installation steps on their site show you how to install the image via balenaEtcher or rufus, though in my case using linux I simply used ~dd~ to flash the image [[cite:&DietPi_install]]. + +#+BEGIN_SRC bash +sudo dd bs=4M if=/path/to/DietPi_RPi-ARMv8-Bookworm.img of=/dev/xvdi oflag=sync status=progress +#+END_SRC + +Here ~bs~ denotes the block size, ~oflag=sync~ syncs after each output block, and ~status=progress~ shows the progress of writing the image to the SSD (though the full write should take only about 30 seconds). + +Next you should have two new partitions on your SSD, one will be your root file system and the other will contain the ~/boot~ partition. In my case I needed to make some changes to my system before booting to make sure that I could headlessly access the device, so I mounted the ~/boot~ partition to my computer to change some settings. Since I don't have the proper router I wanted at the time of doing this I didn't make any changes to the static ip settings in ~dietpi.txt~. You can change this later in a number of ways such as assigning the static ip on the router side or through ~dietpi-config~. I did enable ~AUTO_SETUP_NET_WIFI_ENABLED~ just in case ethernet didn't work, and I added my wifi SSID and password in ~dietpi-wifi.txt~ as the documentation tells you how to do [[cite:&DietPi_install]]. Keep in mind that ~dietpi-wifi.txt~ will remove itself after first boot so make sure you've entered everything correctly. + +After unmounting the drive, I connected the SSD to the USB 3.0 port which will be one of the blue USB ports on the pi 4. I connected an ethernet cable directly from the pi to my router. Be patient during the first boot process as it might take a bit to boot up, the pi should start with a small red and green led turning on, then the green port will turn off, and the red led will start slightly flickering but it's very subtle. If you look at the ethernet port on the router, a solid green LED means that a connection has been established, and the orange or green led flickering means that data is being transmitted. From here the dietpi documentation tells you how to find the pi using ~nmap~, though I was also able to find the pi through my router's web portal. If you haven't changed the DietPi's default hostname through ~dietpi.txt~, you should be able to find the proper device and it's local ip address easily by finding its hostname "DietPi". Then I simply used ssh to connect to the pi: + +#+BEGIN_SRC sh +ssh root@ +#+END_SRC + +** After booting up, installing docker and docker compose and creating a Home Assistant Container. +I followed the DietPi TUI setup process which was pretty straight forward [[cite:&DietPi_install]]. I installed the docker and docker compose packages through ~dietpi-software~ which should become available as the last step of the installation process [[cite:&DietPi_getting_started]]. I did this more or less because it was the laziest and most automatic way of doing it as DietPi has scripts to install everything needed which saved me 2 minutes. If you'd rather avoid using ~dietpi-software~ you can also follow the official steps to install docker [[cite:&docker_install]]. + +As an aside, after installation, I would suggest changing your ssh server to prevent root logins as this is generally good practice for preventing brute force ssh logins. Assuming you're using the default ssh server that DietPi uses, ~dropbear~, you can disable root password logins by going into ~/etc/default/dropbear~ and changing a single line in the configuration [[cite:&dietpi_dropbear]]. + +#+BEGIN_SRC +DROPBEAR_EXTRA_ARGS=-g -w +#+END_SRC + +~-w~ prevents root logins of any kind and ~-g~ prevents password root logins [[cite:&dropbear_man]]. + +Regardless, next I would switch to another user with sudo privilleges, such as ~dietpi~, using ~su - dietpi~. I created a new subdirectory in to put my ~compose.yml~ to launch home assistant in docker, and I launched the container in this directory as follows. + +#+BEGIN_SRC sh +mkdir -p ~/dockerapps/Home\ Assistant/ +cd ~/dockerapps/Home\ Assistant/ +#+END_SRC + +Using the template provided by Home Assistant, I made one minor change to their yml file to change the config directory to be the one I just created [[cite:&Home_Assistant_Linux_Install]]. +#+BEGIN_SRC yml +version: '3' +services: + homeassistant: + container_name: homeassistant + image: "ghcr.io/home-assistant/home-assistant:stable" + volumes: + - ./config:/config + - /etc/localtime:/etc/localtime:ro + - /run/dbus:/run/dbus:ro + restart: unless-stopped + privileged: true + network_mode: host +#+END_SRC + +Then start up docker compose. + +#+BEGIN_SRC sh +sudo docker compose up -d +#+END_SRC + +From here it should take a few minutes to pull all of the proper docker images and extract them. Once it has finished setting up, your home assistant onboarding portal should be at ~http://:8123~. You now have a starting place to use Home Assistant; happy home assisting! + +* References +[[bibliography:../../references.bib]] diff --git a/content/_index.md b/content/_index.md index 42721b5..707a22a 100644 --- a/content/_index.md +++ b/content/_index.md @@ -53,5 +53,6 @@ Hello, my name is Jordan, thank you for stopping by my website. - I'm a full time student. - Getting into some [Home Assistant](https://www.home-assistant.io/) things. -- Listening to [CEREBRO](https://www.connorgoldsmith.com/cerebro) podcast. Having recently watched X-Men '97 I ~~watched~~ listened to their Magneto episode and now I think I love X-Men. This is coming from a hipster who hated 90% of superhero things since I was 15 being spoiled by [Worm](https://parahumans.wordpress.com/). +- Messing with a [free oracle vps](https://rentry.co/oraclevps) for funzies. Started a minecraft server as I haven't played it in since 2020-ish... This is how I figured out that [Micrsoft stole my childhood](https://www.minecraft.net/en-us/article/account-migration-last-call). +- Listening to [CEREBRO](https://www.connorgoldsmith.com/cerebro) podcast. Having recently watched X-Men '97 I ~~watched~~ listened to their Magneto episode and now I think I love X-Men. This is coming from a hipster who hated 90% of superhero things since I was 15 being spoiled by [Worm](https://parahumans.wordpress.com/). UPDATE Jun 16: I literally listened to 20 hours of Madelyne Pryor discussion, a character I have hardly heard of prior (ha) to this calendar year. - [I (STILL) HATE DAYLIGHT SAVINGS! I (STILL) HATE DAYLIGHT SAVINGS!](../images/hatedaylightsavings.png) diff --git a/content/posts/home_assistant_setup.md b/content/posts/home_assistant_setup.md new file mode 100644 index 0000000..966d3c8 --- /dev/null +++ b/content/posts/home_assistant_setup.md @@ -0,0 +1,101 @@ ++++ +title = "Booting DietPi on an SSD and installing Home Assistant in Docker" +summary = "Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi." +date = 2024-06-07 +lastmod = 2024-06-16T23:08:16-04:00 +tags = ["rpi", "home-assistant", "dietpi", "technology", "tutorial"] +draft = false +[menu] + [menu.posts] + identifier = "booting-dietpi-on-an-ssd-and-installing-home-assistant-in-docker" ++++ + +I have been eyeing home assistant for quite a bit but haven't had the oppourtunity to do something with it until a family member wanted to set up some iot appliances and wanted all of them to be integrated into one interface, and I was more than happy to get involved. I first wanted to get a more advanced router set up to isolate everything iot from the main lan. I ended up copying my an openwrt archive from the linksys router I got [last year](/posts/summer_2023_projects/#img-src-images-blog-openwrt-icon-dot-png-width-10-openwrt). Unfortunately I got the wrong linksys router by accident at my first go at it which set me back by about a week. Alas, I was still able to boot up a Raspberry Pi 4 with Home Assistant to start tinkering with, which I spent a little time a couple of Saturdays ago doing. I since have moved over some lutron configurations which I may write about if I think it's interesting enough and doesn't divulge anything too private. This guide should get you to a simple starting place (most of which is just taken from DietPi and Home Assitant documentation) but I will document it here regardless. + + +## Prerequisites {#prerequisites} + +This guide assumes that you already have the following: + +- A Raspberry Pi 4 +- An external SSD +- A usb to sata connector +- A separate computer or laptop with a usb port. +- Optional: Ethernet cable + + +### Flashing DietPi onto an SSD {#flashing-dietpi-onto-an-ssd} + +First it's important to mention that my choice to boot from an SSD was intentional, as Home Assistant will be doing a lot of writes, it's important to choose a storage device that is less prone to wearing out than a micro SD card. Additionally, despite needing to adapt from a USB 3.0 port, read/write speeds should also be faster than a micro SD card. Doing this from a Raspberry Pi 4 is fairly simple, it only required me to flash the operating system to the drive and then turn on the pi. You can download their Raspberry Pi 2/3/4/Zero 2 Dietpi image from their website and mostly follow documentation for the installation steps (DietPi Team 2024a). The installation steps on their site show you how to install the image via balenaEtcher or rufus, though in my case using linux I simply used `dd` to flash the image (DietPi Team 2024c). + +{{< highlight bash >}} +sudo dd bs=4M if=/path/to/DietPi_RPi-ARMv8-Bookworm.img of=/dev/xvdi oflag=sync status=progress +{{< /highlight >}} + +Here `bs` denotes the block size, `oflag=sync` syncs after each output block, and `status=progress` shows the progress of writing the image to the SSD (though the full write should take only about 30 seconds). + +Next you should have two new partitions on your SSD, one will be your root file system and the other will contain the `/boot` partition. In my case I needed to make some changes to my system before booting to make sure that I could headlessly access the device, so I mounted the `/boot` partition to my computer to change some settings. Since I don't have the proper router I wanted at the time of doing this I didn't make any changes to the static ip settings in `dietpi.txt`. You can change this later in a number of ways such as assigning the static ip on the router side or through `dietpi-config`. I did enable `AUTO_SETUP_NET_WIFI_ENABLED` just in case ethernet didn't work, and I added my wifi SSID and password in `dietpi-wifi.txt` as the documentation tells you how to do (DietPi Team 2024c). Keep in mind that `dietpi-wifi.txt` will remove itself after first boot so make sure you've entered everything correctly. + +After unmounting the drive, I connected the SSD to the USB 3.0 port which will be one of the blue USB ports on the pi 4. I connected an ethernet cable directly from the pi to my router. Be patient during the first boot process as it might take a bit to boot up, the pi should start with a small red and green led turning on, then the green port will turn off, and the red led will start slightly flickering but it's very subtle. If you look at the ethernet port on the router, a solid green LED means that a connection has been established, and the orange or green led flickering means that data is being transmitted. From here the dietpi documentation tells you how to find the pi using `nmap`, though I was also able to find the pi through my router's web portal. If you haven't changed the DietPi's default hostname through `dietpi.txt`, you should be able to find the proper device and it's local ip address easily by finding its hostname "DietPi". Then I simply used ssh to connect to the pi: + +{{< highlight sh >}} +ssh root@ +{{< /highlight >}} + + +### After booting up, installing docker and docker compose and creating a Home Assistant Container. {#after-booting-up-installing-docker-and-docker-compose-and-creating-a-home-assistant-container-dot} + +I followed the DietPi TUI setup process which was pretty straight forward (DietPi Team 2024c). I installed the docker and docker compose packages through `dietpi-software` which should become available as the last step of the installation process (DietPi Team 2024b). I did this more or less because it was the laziest and most automatic way of doing it as DietPi has scripts to install everything needed which saved me 2 minutes. If you'd rather avoid using `dietpi-software` you can also follow the official steps to install docker (Docker Inc. 2024). + +As an aside, after installation, I would suggest changing your ssh server to prevent root logins as this is generally good practice for preventing brute force ssh logins. Assuming you're using the default ssh server that DietPi uses, `dropbear`, you can disable root password logins by going into `/etc/default/dropbear` and changing a single line in the configuration (Sarmisak 2015). + +{{< highlight nil >}} +DROPBEAR_EXTRA_ARGS=-g -w +{{< /highlight >}} + +`-w` prevents root logins of any kind and `-g` prevents password root logins (Johnson, n.d.). + +Regardless, next I would switch to another user with sudo privilleges, such as `dietpi`, using `su - dietpi`. I created a new subdirectory in to put my `compose.yml` to launch home assistant in docker, and I launched the container in this directory as follows. + +{{< highlight sh >}} +mkdir -p ~/dockerapps/Home\ Assistant/ +cd ~/dockerapps/Home\ Assistant/ +{{< /highlight >}} + +Using the template provided by Home Assistant, I made one minor change to their yml file to change the config directory to be the one I just created (Home Assistant 2024). + +{{< highlight yml >}} +version: '3' +services: + homeassistant: + container_name: homeassistant + image: "ghcr.io/home-assistant/home-assistant:stable" + volumes: + - ./config:/config + - /etc/localtime:/etc/localtime:ro + - /run/dbus:/run/dbus:ro + restart: unless-stopped + privileged: true + network_mode: host +{{< /highlight >}} + +Then start up docker compose. + +{{< highlight sh >}} +sudo docker compose up -d +{{< /highlight >}} + +From here it should take a few minutes to pull all of the proper docker images and extract them. Once it has finished setting up, your home assistant onboarding portal should be at `http://:8123`. You now have a starting place to use Home Assistant; happy home assisting! + + +## References {#references} + +
+
DietPi Team. 2024a. “DietPi - Lightweight Justice for Your SBC!” https://dietpi.com/#download.
+
———. 2024b. “Getting Started with DietPi - DietPi.Com Docs.” https://dietpi.com/docs/getting_started/#dietpi-software-choose-the-software-you-need.
+
———. 2024c. “How to Install DietPi - DietPi.Com Docs.” https://dietpi.com/docs/install/.
+
Docker Inc. 2024. “Install Docker Engine on Debian | Docker Docs.” https://docs.docker.com/engine/install/debian/#install-using-the-repository.
+
Home Assistant. 2024. “Linux - Home Assistant.” https://www.home-assistant.io/installation/linux#docker-compose.
+
Johnson, Matt. n.d. “Dropbear(8): Lightweight SSH2 Server - Linux Man Page.”
+
sarmisak. 2015. “Optional Security - Disable Root Login - General Discussion - DietPi Community Forum.” https://dietpi.com/forum/t/optional-security-disable-root-login/34.
+
diff --git a/public/index.html b/public/index.html index c720e43..83ca439 100644 --- a/public/index.html +++ b/public/index.html @@ -138,7 +138,8 @@

What am I up to?

  • I’m a full time student.
  • Getting into some Home Assistant things.
  • -
  • Listening to CEREBRO podcast. Having recently watched X-Men ‘97 I watched listened to their Magneto episode and now I think I love X-Men. This is coming from a hipster who hated 90% of superhero things since I was 15 being spoiled by Worm.
  • +
  • Messing with a free oracle vps for funzies. Started a minecraft server as I haven’t played it in since 2020-ish… This is how I figured out that Micrsoft stole my childhood.
  • +
  • Listening to CEREBRO podcast. Having recently watched X-Men ‘97 I watched listened to their Magneto episode and now I think I love X-Men. This is coming from a hipster who hated 90% of superhero things since I was 15 being spoiled by Worm. UPDATE Jun 16: I literally listened to 20 hours of Madelyne Pryor discussion, a character I have hardly heard of prior (ha) to this calendar year.
  • I (STILL) HATE DAYLIGHT SAVINGS! I (STILL) HATE DAYLIGHT SAVINGS!
@@ -151,13 +152,12 @@

Recent Posts

@@ -190,12 +187,13 @@

- 27 Apr 2024 Using adb to Delete Vanadium on GrapheneOS + 20 May 2024 New email/website domain!

- I wanted to delete the system browser app Vanadium on my phone running Grapheneos for productivity and mental health reasons. Do this at your own risk. + Friendship with .xyz has ended, .com is my new best friend. +Friendship with namecheap has ended, porkbun is my new best friend

#technology - #tutorial + #email - #adb + #dns - #android + #namecheap - #grapheneos + #porkbun + + + #updates

@@ -225,12 +226,12 @@

diff --git a/public/index.xml b/public/index.xml index 98b68cc..2f33c0f 100644 --- a/public/index.xml +++ b/public/index.xml @@ -5,7 +5,16 @@ / Recent content in Welcome on Jordan Herzstein Hugo -- gohugo.io - Mon, 20 May 2024 00:00:00 +0000 + Fri, 07 Jun 2024 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + New email/website domain! /posts/new_domain/ diff --git a/public/posts/home_assistant_setup/index.html b/public/posts/home_assistant_setup/index.html new file mode 100644 index 0000000..92e15fc --- /dev/null +++ b/public/posts/home_assistant_setup/index.html @@ -0,0 +1,250 @@ + + + + + + +

Jordan Herzstein + + + + + + + + + + + + + + + + +

Jordan Herzstein + +
+ + + + +
+ + +
+ + +
+
+

Booting DietPi on an SSD and installing Home Assistant in Docker

+
+ + + + + #rpi + + + #home-assistant + + + #dietpi + + + #technology + + + #tutorial + + +
+
+

I have been eyeing home assistant for quite a bit but haven’t had the oppourtunity to do something with it until a family member wanted to set up some iot appliances and wanted all of them to be integrated into one interface, and I was more than happy to get involved. I first wanted to get a more advanced router set up to isolate everything iot from the main lan. I ended up copying my an openwrt archive from the linksys router I got last year. Unfortunately I got the wrong linksys router by accident at my first go at it which set me back by about a week. Alas, I was still able to boot up a Raspberry Pi 4 with Home Assistant to start tinkering with, which I spent a little time a couple of Saturdays ago doing. I since have moved over some lutron configurations which I may write about if I think it’s interesting enough and doesn’t divulge anything too private. This guide should get you to a simple starting place (most of which is just taken from DietPi and Home Assitant documentation) but I will document it here regardless.

+

Prerequisites

+

This guide assumes that you already have the following:

+
    +
  • A Raspberry Pi 4
  • +
  • An external SSD
  • +
  • A usb to sata connector
  • +
  • A separate computer or laptop with a usb port.
  • +
  • Optional: Ethernet cable
  • +
+

Flashing DietPi onto an SSD

+

First it’s important to mention that my choice to boot from an SSD was intentional, as Home Assistant will be doing a lot of writes, it’s important to choose a storage device that is less prone to wearing out than a micro SD card. Additionally, despite needing to adapt from a USB 3.0 port, read/write speeds should also be faster than a micro SD card. Doing this from a Raspberry Pi 4 is fairly simple, it only required me to flash the operating system to the drive and then turn on the pi. You can download their Raspberry Pi 2/3/4/Zero 2 Dietpi image from their website and mostly follow documentation for the installation steps (DietPi Team 2024a). The installation steps on their site show you how to install the image via balenaEtcher or rufus, though in my case using linux I simply used dd to flash the image (DietPi Team 2024c).

+
sudo dd bs=4M if=/path/to/DietPi_RPi-ARMv8-Bookworm.img of=/dev/xvdi oflag=sync status=progress
+

Here bs denotes the block size, oflag=sync syncs after each output block, and status=progress shows the progress of writing the image to the SSD (though the full write should take only about 30 seconds).

+

Next you should have two new partitions on your SSD, one will be your root file system and the other will contain the /boot partition. In my case I needed to make some changes to my system before booting to make sure that I could headlessly access the device, so I mounted the /boot partition to my computer to change some settings. Since I don’t have the proper router I wanted at the time of doing this I didn’t make any changes to the static ip settings in dietpi.txt. You can change this later in a number of ways such as assigning the static ip on the router side or through dietpi-config. I did enable AUTO_SETUP_NET_WIFI_ENABLED just in case ethernet didn’t work, and I added my wifi SSID and password in dietpi-wifi.txt as the documentation tells you how to do (DietPi Team 2024c). Keep in mind that dietpi-wifi.txt will remove itself after first boot so make sure you’ve entered everything correctly.

+

After unmounting the drive, I connected the SSD to the USB 3.0 port which will be one of the blue USB ports on the pi 4. I connected an ethernet cable directly from the pi to my router. Be patient during the first boot process as it might take a bit to boot up, the pi should start with a small red and green led turning on, then the green port will turn off, and the red led will start slightly flickering but it’s very subtle. If you look at the ethernet port on the router, a solid green LED means that a connection has been established, and the orange or green led flickering means that data is being transmitted. From here the dietpi documentation tells you how to find the pi using nmap, though I was also able to find the pi through my router’s web portal. If you haven’t changed the DietPi’s default hostname through dietpi.txt, you should be able to find the proper device and it’s local ip address easily by finding its hostname “DietPi”. Then I simply used ssh to connect to the pi:

+
ssh root@<local-ip-address-of-pi>
+

After booting up, installing docker and docker compose and creating a Home Assistant Container.

+

I followed the DietPi TUI setup process which was pretty straight forward (DietPi Team 2024c). I installed the docker and docker compose packages through dietpi-software which should become available as the last step of the installation process (DietPi Team 2024b). I did this more or less because it was the laziest and most automatic way of doing it as DietPi has scripts to install everything needed which saved me 2 minutes. If you’d rather avoid using dietpi-software you can also follow the official steps to install docker (Docker Inc. 2024).

+

As an aside, after installation, I would suggest changing your ssh server to prevent root logins as this is generally good practice for preventing brute force ssh logins. Assuming you’re using the default ssh server that DietPi uses, dropbear, you can disable root password logins by going into /etc/default/dropbear and changing a single line in the configuration (Sarmisak 2015).

+
DROPBEAR_EXTRA_ARGS=-g -w
+

-w prevents root logins of any kind and -g prevents password root logins (Johnson, n.d.).

+

Regardless, next I would switch to another user with sudo privilleges, such as dietpi, using su - dietpi. I created a new subdirectory in to put my compose.yml to launch home assistant in docker, and I launched the container in this directory as follows.

+
mkdir -p ~/dockerapps/Home\ Assistant/
+cd ~/dockerapps/Home\ Assistant/
+

Using the template provided by Home Assistant, I made one minor change to their yml file to change the config directory to be the one I just created (Home Assistant 2024).

+
version: '3'
+services:
+  homeassistant:
+    container_name: homeassistant
+    image: "ghcr.io/home-assistant/home-assistant:stable"
+    volumes:
+      - ./config:/config
+      - /etc/localtime:/etc/localtime:ro
+      - /run/dbus:/run/dbus:ro
+    restart: unless-stopped
+    privileged: true
+    network_mode: host
+

Then start up docker compose.

+
sudo docker compose up -d
+

From here it should take a few minutes to pull all of the proper docker images and extract them. Once it has finished setting up, your home assistant onboarding portal should be at http://<local-ip-address-of-pi>:8123. You now have a starting place to use Home Assistant; happy home assisting!

+

References

+
+
DietPi Team. 2024a. “DietPi - Lightweight Justice for Your SBC!” https://dietpi.com/#download.
+
———. 2024b. “Getting Started with DietPi - DietPi.Com Docs.” https://dietpi.com/docs/getting_started/#dietpi-software-choose-the-software-you-need.
+
———. 2024c. “How to Install DietPi - DietPi.Com Docs.” https://dietpi.com/docs/install/.
+
Docker Inc. 2024. “Install Docker Engine on Debian | Docker Docs.” https://docs.docker.com/engine/install/debian/#install-using-the-repository.
+
Home Assistant. 2024. “Linux - Home Assistant.” https://www.home-assistant.io/installation/linux#docker-compose.
+
Johnson, Matt. n.d. “Dropbear(8): Lightweight SSH2 Server - Linux Man Page.”
+
sarmisak. 2015. “Optional Security - Disable Root Login - General Discussion - DietPi Community Forum.” https://dietpi.com/forum/t/optional-security-disable-root-login/34.
+
+ +
+ + +
+ + + + +
+ + + diff --git a/public/posts/index.html b/public/posts/index.html index 8d70ccb..c5dbdfe 100644 --- a/public/posts/index.html +++ b/public/posts/index.html @@ -121,6 +121,40 @@

Posts

+ +

diff --git a/public/posts/index.xml b/public/posts/index.xml index ac4e8fe..82db3e1 100644 --- a/public/posts/index.xml +++ b/public/posts/index.xml @@ -6,6 +6,15 @@ Recent content in Posts on Jordan Herzstein Hugo -- gohugo.io Wed, 01 Feb 2023 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + New email/website domain! /posts/new_domain/ diff --git a/public/sitemap.xml b/public/sitemap.xml index 7596d01..8e8e2b9 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -2,6 +2,27 @@ + /posts/home_assistant_setup/ + 2024-06-16T23:08:16-04:00 + + /tags/dietpi/ + 2024-06-16T23:08:16-04:00 + + /tags/home-assistant/ + 2024-06-16T23:08:16-04:00 + + /tags/rpi/ + 2024-06-16T23:08:16-04:00 + + /tags/technology/ + 2024-06-16T23:08:16-04:00 + + /tags/tutorial/ + 2024-06-16T23:08:16-04:00 + + / + 2024-06-16T23:08:16-04:00 + /tags/dns/ 2024-05-22T21:56:59-04:00 @@ -16,15 +37,9 @@ /tags/porkbun/ 2024-05-22T21:56:59-04:00 - - /tags/technology/ - 2024-05-22T21:56:59-04:00 /tags/updates/ 2024-05-22T21:56:59-04:00 - - / - 2024-05-22T21:56:59-04:00 /tags/adb/ 2024-04-27T16:52:30-04:00 @@ -34,9 +49,6 @@ /tags/grapheneos/ 2024-04-27T16:52:30-04:00 - - /tags/tutorial/ - 2024-04-27T16:52:30-04:00 /posts/adb_vanadium/ 2024-04-27T16:52:30-04:00 diff --git a/public/tags/dietpi/index.html b/public/tags/dietpi/index.html new file mode 100644 index 0000000..883ae8e --- /dev/null +++ b/public/tags/dietpi/index.html @@ -0,0 +1,190 @@ + + + + + + +

Jordan Herzstein + + + + + + + + + + + + + + + + +

Jordan Herzstein + +
+ + + + +
+ + +
+ + +
+

+
+
+ +
+ + + + + + + + + + + + + + + diff --git a/public/tags/dietpi/index.xml b/public/tags/dietpi/index.xml new file mode 100644 index 0000000..778a701 --- /dev/null +++ b/public/tags/dietpi/index.xml @@ -0,0 +1,19 @@ + + + + dietpi on Jordan Herzstein + /tags/dietpi/ + Recent content in dietpi on Jordan Herzstein + Hugo -- gohugo.io + Fri, 07 Jun 2024 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + + + diff --git a/public/tags/home-assistant/index.html b/public/tags/home-assistant/index.html new file mode 100644 index 0000000..60babb7 --- /dev/null +++ b/public/tags/home-assistant/index.html @@ -0,0 +1,190 @@ + + + + + + +

Jordan Herzstein + + + + + + + + + + + + + + + + +

Jordan Herzstein + +
+ + + + +
+ + +
+ + +
+

+ +
+ +
+ + + + + + + + + + + + + + + diff --git a/public/tags/home-assistant/index.xml b/public/tags/home-assistant/index.xml new file mode 100644 index 0000000..d81e6b4 --- /dev/null +++ b/public/tags/home-assistant/index.xml @@ -0,0 +1,19 @@ + + + + home-assistant on Jordan Herzstein + /tags/home-assistant/ + Recent content in home-assistant on Jordan Herzstein + Hugo -- gohugo.io + Fri, 07 Jun 2024 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + + + diff --git a/public/tags/index.html b/public/tags/index.html index e0bc357..be76306 100644 --- a/public/tags/index.html +++ b/public/tags/index.html @@ -107,12 +107,14 @@

Tags

anime 1 clown-moment 1 daylight-savings 1 + dietpi 1 dns 1 eclipse 2 emacs 1 email 2 github 1 grapheneos 1 + home-assistant 1 hugo 1 manga 1 namecheap 1 @@ -122,11 +124,12 @@

Tags

projects 1 proton 1 qubes-os 1 + rpi 1 skiff 1 switch 1 - technology 6 + technology 7 themes 1 - tutorial 2 + tutorial 3 updates 3 x11 1 diff --git a/public/tags/index.xml b/public/tags/index.xml index 2637b61..e2ae03d 100644 --- a/public/tags/index.xml +++ b/public/tags/index.xml @@ -6,6 +6,51 @@ Recent content in Tags on Jordan Herzstein Hugo -- gohugo.io Wed, 01 Feb 2023 00:00:00 +0000 + + dietpi + /tags/dietpi/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /tags/dietpi/ + + + + + home-assistant + /tags/home-assistant/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /tags/home-assistant/ + + + + + rpi + /tags/rpi/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /tags/rpi/ + + + + + technology + /tags/technology/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /tags/technology/ + + + + + tutorial + /tags/tutorial/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /tags/tutorial/ + + + dns /tags/dns/ @@ -42,15 +87,6 @@ - - technology - /tags/technology/ - Mon, 20 May 2024 00:00:00 +0000 - - /tags/technology/ - - - updates /tags/updates/ @@ -87,15 +123,6 @@ - - tutorial - /tags/tutorial/ - Sat, 27 Apr 2024 00:01:00 -0400 - - /tags/tutorial/ - - - eclipse /tags/eclipse/ diff --git a/public/tags/rpi/index.html b/public/tags/rpi/index.html new file mode 100644 index 0000000..142df24 --- /dev/null +++ b/public/tags/rpi/index.html @@ -0,0 +1,190 @@ + + + + + + +

Jordan Herzstein + + + + + + + + + + + + + + + + +

Jordan Herzstein + +
+ + + + +
+ + +
+ + +
+ +
+ +
+ + + + + + +
+ + + + +
+ + + diff --git a/public/tags/rpi/index.xml b/public/tags/rpi/index.xml new file mode 100644 index 0000000..c13500b --- /dev/null +++ b/public/tags/rpi/index.xml @@ -0,0 +1,19 @@ + + + + rpi on Jordan Herzstein + /tags/rpi/ + Recent content in rpi on Jordan Herzstein + Hugo -- gohugo.io + Fri, 07 Jun 2024 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + + + diff --git a/public/tags/technology/index.html b/public/tags/technology/index.html index f2c264b..a579a3b 100644 --- a/public/tags/technology/index.html +++ b/public/tags/technology/index.html @@ -105,6 +105,41 @@

Tag:technology

+ +

diff --git a/public/tags/technology/index.xml b/public/tags/technology/index.xml index 36e5388..e5c32c0 100644 --- a/public/tags/technology/index.xml +++ b/public/tags/technology/index.xml @@ -5,7 +5,16 @@ /tags/technology/ Recent content in technology on Jordan Herzstein Hugo -- gohugo.io - Mon, 20 May 2024 00:00:00 +0000 + Fri, 07 Jun 2024 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + New email/website domain! /posts/new_domain/ diff --git a/public/tags/tutorial/index.html b/public/tags/tutorial/index.html index 584a0c9..43efbc7 100644 --- a/public/tags/tutorial/index.html +++ b/public/tags/tutorial/index.html @@ -105,6 +105,41 @@

Tag:tutorial

+ +

diff --git a/public/tags/tutorial/index.xml b/public/tags/tutorial/index.xml index 6c10e3c..66df85c 100644 --- a/public/tags/tutorial/index.xml +++ b/public/tags/tutorial/index.xml @@ -5,7 +5,16 @@ /tags/tutorial/ Recent content in tutorial on Jordan Herzstein Hugo -- gohugo.io - Sat, 27 Apr 2024 00:01:00 -0400 + Fri, 07 Jun 2024 00:00:00 +0000 + + Booting DietPi on an SSD and installing Home Assistant in Docker + /posts/home_assistant_setup/ + Fri, 07 Jun 2024 00:00:00 +0000 + + /posts/home_assistant_setup/ + Setting up home assistant with docker compose on a Raspberry Pi 4 running DietPi. + + Using adb to Delete Vanadium on GrapheneOS /posts/adb_vanadium/ diff --git a/references.bib b/references.bib index 0c61216..b9bf417 100644 --- a/references.bib +++ b/references.bib @@ -160,3 +160,58 @@ @misc{molly note = {Online; accessed 27 April 2024} } +@misc{docker_install, + title = {Install Docker Engine on Debian | Docker Docs}, + author = {{Docker Inc.}}, + url = {https://docs.docker.com/engine/install/debian/#install-using-the-repository}, + year = {2024}, + note = {Online; accessed 16 June 2024} +} + +@misc{DietPi_download, + title = {DietPi - Lightweight justice for your SBC!}, + author = {{DietPi Team}}, + url = {https://dietpi.com/#download}, + year = {2024}, + note = {Online; accessed 16 June 2024} +} + +@misc{DietPi_install, + title = {How to install DietPi - DietPi.com Docs}, + author = {{DietPi Team}}, + url = {https://dietpi.com/docs/install/}, + year = {2024}, + note = {Online; accessed 16 June 2024} +} + +@misc{DietPi_getting_started, + title = {Getting Started With DietPi - DietPi.com Docs}, + author = {{DietPi Team}}, + url = {https://dietpi.com/docs/getting_started/#dietpi-software-choose-the-software-you-need}, + year = {2024}, + note = {Online; accessed 16 June 2024} +} + +@misc{Home_Assistant_Linux_Install, + title = {Linux - Home Assistant}, + author = {{Home Assistant}}, + url = {https://www.home-assistant.io/installation/linux#docker-compose}, + year = {2024}, + note = {Online; accessed 16 June 2024} +} + +@misc{dropbear_man, + title = {dropbear(8): lightweight SSH2 server - Linux man page}, + author = {Matt Johnson},{Gerrit Pape} + url = {https://linux.die.net/man/8/dropbear}, + year = {2024}, + note = {Online; accessed 16 June 2024} +} + +@misc{dietpi_dropbear, + title = {Optional Security - Disable root login - General Discussion - DietPi Community Forum}, + author = {sarmisak}, + url = {https://dietpi.com/forum/t/optional-security-disable-root-login/34}, + year = {2015}, + note = {Online; accessed 16 June 2024} +}