How to increase the swap file size on Home Assistant OS

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?

Just installed it and you’re correct, no ability to disable protection mode. Seems that addon is under stricter security control. Looks like you’re back to trying to install the other addon. Not sure why that fails for you.

I’m trying to update to HA Core 2021.11 and HA OS 6.5, let’s see if something changes.
I will also try to uninstall the official SSH add-on, not sure if they can conflict together

Ok I think I finally got further.
I updated to HA OS v6.6, uninstalled both the SSH add-ons (official and “SSH & Web Terminal”), then reinstalled only “SSH & Web Terminal”, and now it is up & running with a normal configuration (root user, set a password, enabled sftp, changed default SSH port, no init_commands).

If then I try to run it with the init_command you proposed I think it gets through all the lines but it fails at swapoff. From the add-on log I read:

swapoff: /backup/_swap.swap: Invalid argument
[23:53:17] FATAL: Failed executing init command: 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 ; else swapon /backup/_swap.swap ; fi
[cont-init.d] user.sh: exited 1.

I see the 2 GB _swap.swap file in /backup, it also has the correct chmod properties “600”.

From the SSH command line I also tried to manually execute swapoff -a, and I get the following error:

swapoff: /dev/zram0: Operation not permitted

Grab the command from the first post and try again. I removed the swapoff aspect as I was getting the same as you.

it works!
I modified the command as you wrote:

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

thanks for the support!

4 Likes

Awesome… Come back in a few and tell us how the stability is.