So I just completed this task and thought I would share my experience in 2023 as the posts I got all seem outdated, mostly focussed on ver 9.3, the current version of HASSOS is 11.2.
Why I did this?
- I have an old laptop, Acer ONE Intel Atom N450, it was probably built somewhere in 2010 way before UEFI was mainstream. Unfortunately it is a core part of the HASSOS installation.
- I only have a 250GB drive, and the image file requires a 1TB drive (Disk application complains)
- I have been running a “supervised” installation for the last 3 years and have fallen behind on the maintenance (monthly updates of OS, and supervisor and core and add-ins) to the point that everything was becoming a mess. I highly recommend you DO NOT follow this path…
Assumptions:
You have already installed a version of linux on the machine which is bootable - you can find this process all over. (There are other shortcuts here like only installing a boot partition and GRUB, you only need GRUB to boot the machine, you dont really need a full linux install)
Step 1:
Boot into a linux distro with flash drive. Any distro, they are very much the same (for this task - please dont hate me). I used Linux Mint 20 XFCE, the GUI runs better on older hardware. On the official X86 installation they explain how to use Ubuntu.
Note: May have to change your BIOS setup to allow flash drive to boot before hard drive.
Step 2:
Download the latest version of the disk image. It is available as point 5 under METHOD 1 on official website: X86 installation.
Step 4:
Unzip (xz) the image with: xz -d -c img_file_name.img.xz
You will be left with a disk image file. Note: the zipped file is around 400MB but after unzipping, it is about 7GB.
Note: Flashdrives are notoriously slow, you could mount your hard drive and extract there. Google it, in short create a directory under your /mnt folder, call it whatever you want. I used my drive partition, so mkdir /mnt/sda7 then mount /dev/sda7 /mnt/sda7.
Step 5:
Mount the img file: losetup --find --partscan img_file_name.img
This will now (hopefully) mount 8 partitions. First is the “boot” partition, the next 4 are kernel and OS “pairs” (an A & B version for fallback). The next is a “Bootstate” and then an “overlay” for configs and a “data” for add-ons and other storage. Partitions are detailed here. PS: Mine only mounted 4 partitions: kernel, OS, overlay and data.
Note: In the link above they state that the alternate 2 “boot” partitions are empty on a first install. I manually mounted partition 1 to get access to the EFI boot partition.
Step 6:
You now have to create partitions on your local drive to mirror the above. Running: “df -h” is helpful to see the required sizes of the partitions. I used the “Disk” tool in Mint (also available in most distros) which is a nice GUI interface to disk partitioning. I then resized my existing Linux partitions to open up space for the new partitions I need. I created a 25MB partition for my kernel(FAT), and a 250MB partition for my OS(FAT), a 500MB partition for overlay (NB to label this correctly as HASSOS-OVERLAY), and a 15GB partition for my data (NB to label this correctly as HASSOS-DATA).
Note: You will notice I did not create the “A & B” setup, perhaps I will in future need to come update this post…this is what I needed to get up and running. Technically, you should be creating the additional 2 partitions which will probably be an issue when I upgrade.
Step 7:
Copying data to your partitions: I tried using dd command to write the partitions using the mounted volumes as input but that did not work well, and I had 2 corrupted drives (squashFS issues). I therefore just recursively copied (with permissions) the data from the mounted partitions (above) to the new partitions. using: cp -pdRx /media/mint/DISK/* /media/mint/KERNEL/. - just an example, my kernel drive (with the bzImage file was mounted as DISK, the OS was mounted as DISK1, overlay and data as per above by label mounted as HASOS-OVERLAY and HASSOS-DATA).
If you have gotten this far, you are well on your way
Step 8:
Configuring the boot file: Technically, you just need to hand the BIOS the kernel image, and the rest should just run. I opened the grub.cfg file from the HASSOS image mounted BOOT partition located in EFI/boot/grub/grub.cfg and copied everything after the first 2 lines (which were setting default and timeout) into my existing grub.cfg file located in /boot/grub/grub.cfg at the end of the file.
Step 9:
Making it boot: This was the most complex bit that took me time to figure out. The way drives are labelled and named depends on the architecture and bootloader version being used. The boot config in step 8 is pretty straight forward. There is an “A” and a “B” option, and then 2 “recovery” versions of same. The trick was in selecting the right drive and partition for the kernel (bzImage) and then identifying the root partition correctly so the kernel can handover to the OS. What worked in the end was to reboot, then hit “c” for command line when the GRUB menu came up. There I could run “ls” to see how my drives are being labelled. I had to change (HD0, GPT1) to (AHCI0,msdos7). The “root=” is defined by UUID (unique hardware reference to the partition) but this gave me a “Waiting on root” message and hanged for hours even after updating the UUID to the one matching the new partition. I replaced it with “root=/dev/hda7” (7th partition on the first hard drive), which worked!
Step 10 (extra):
If you had started like me with a previous basically unusable install, and had made backups using Google drive, you will find your backups on your Google drive. They are basically zipped files of the configs of apps and even the full homeassistant config. You can restore these files if you feel comfortable…I unzipped them and took out the files I needed to config my new installation as clean as possible.