How to increase the swap file size on Home Assistant OS

I dont know but only htop works. My system (RPI4) is new (restored snapshot from rpi3).

Yeah I’d still do it… Notice how your Mem/RAM is almost at max. Once it is that’s when swap is used.

1 Like

I know this has been a while, first of all, thanks for that piece of code, my HA on a RPi3 went from lagging out every few hours to working absolutely fine.

Is it possible to integrate a swapoff /backup/_swap.swap in case it already exists in the logic? I had the plugin failing to launch even after a reboot. Quick removal of the code, starting the plugin, run the swapoff and then re-add the code and restart it fixed it. Is there a way to add to the logic to do a swapoff in case the device busy error appears (See Pirol62 output with the error he posted in this thread, that was the error i faced)

Try this and LMK if it works…

init_commands:
  - if [ ! -f /backup/_swap.swap ]; then fallocate -l 2G /backup/_swap.swap && mkswap /backup/_swap.swap && chmod 0600 /backup/_swap.swap && swapoff /backup/_swap.swap && swapon /backup/_swap.swap ; elif [[ ! $(dmesg|grep _swap.swap) = *swap\ on* ]] ; then swapoff /backup/_swap.swap && swapon /backup/_swap.swap ; fi

This saved my raspberry.
Thanks!
I have a Pi 4, 1gb Ram, and it got constantly slugish, especially with InfluxDB installed.
Changed to SSD; changed different USB Sata adapters, but still the same.

Then i found this! Now my raspberry runs with no problems, only logs take some minutes to load. InfluxDB is still not installed, will use it it some weeks without changing much for testing.

This should be mentioned in the Docs, e.g. here:

I have a Rpi4 1Gb ram model. I recently changed to 64 bit OS and you could see HA struggling to survive. Without this change I would have rolled back to 32 bit OS. This should definitively be part of the HA OS parameters.

1 Like

I wasn’t able to replicate the error, but the command line worked.

If anyone here is looking for a native solution without addons, I have posted my findings at the original GH issue

1 Like

unfortunately I get this error after configuring this add-on and trying to run it:
Image ghcr.io/hassio-addons/ssh/armv7 not exists for addon_a0d7b954_ssh

I was using the official SSH add-on instead: can I do the same with that one?

@Vinz87 no, unfortunately you can’t use the official one. The on list in the OP is the only add-on that I know of that can do the trick.

Ok, then anyone is aware of this error I get?
I have HA OS 6.5 and latest versions of Supervisor and Core, I installed on a Pi 3 Model A+, from the 32 bit official HA OS image

Looks like the path of the addon may have changed… This is where it lives now. Hopefully a supervisor update will come out soon with the correct path referenced.

https://github.com/hassio-addons/addon-ssh

is there something I can do to point to that path? should I add it as a Repository?

oh well, I tried to uninstall it and reinstall, and now I get this error when trying to install it

Can't install ghcr.io/hassio-addons/ssh/armv7:9.0.1: 500 Server Error for http+docker://localhost/v1.41/images/create?tag=9.0.1&fromImage=ghcr.io%2Fhassio-addons%2Fssh%2Farmv7: Internal Server Error ("Get "https://ghcr.io/v2/": net/http: TLS handshake timeout")

Hey @Vinz87 — I installed the VMDK of HassOS onto my VMware, then enabled “advanced mode” for the user and easily installed the appropriate SSH add-on. Not sure why you are not succeeding. What platform are you running on? RPi or something else?

after another try I managed to install it, but then I get this error when i try to run the add-on:

Image ghcr.io/hassio-addons/ssh/armv7 not exists for addon_a0d7b954_ssh

I opened this github issue as well

my configuration is the following:
Home Assistant OS 6.5
supervisor-2021.10.0
core-2021.10.6
installed on a Raspberry Pi 3 Model A+, from the HA OS v6.5 32 bit image.

anyone has this issue?

I tried to go on with the manual way, and I get stuck at this point:
swapon /backup/_swap.swap
gives me the output:

swapon: /backup/_swap.swap: Operation not permitted

The unofficial addon with protection mode disabled is a requirement — at least for my instructions. The way you’re trying to do it will not survive a reboot but I understand that you’re trying to see if it’s even worth the trouble. Try the official SSH addon but disable protection mode, which is key.

I have the official SSH addon up & running, but I don’t see a “protection mode” flag, should it be there?