✔️🏃Run On Startup.d

That’s not the case. If I update that particular addon or restart only this single addon - will “Run On Startup.d” kick in and do it’s job? Or is it “only” run once the host starts up?

Only when the host or this addon starts/restarts. I don’t have a way to monitor and react to container restarts. It’s a bash script though, maybe someone cleaver could come up with something.

Is it possible to create an automation like "If addon addon_core_deconz starts, restart addon Run On Startup.d"? Supervisor should be aware of addon/container states, right?

Yep. It should be. The trick there would be to make sure it only runs once on startup. Even when the supervisor is doing its initial startup. You might be able to disable start at boot, and just use the supervisor signal.

I’m not sure how it would work. If you would, please follow up with that. Seems like something that should be useful for others, and could be linked into the first post.

Hmm, the thing is that it doesn’t run the script where bash is called. I.e. the fatal error happens when calling the admin script.

exec: fatal: unable to exec /tmp/addon_ccab4aaf_frigate-fa-beta.startup.sh: No such file or directory

When opening a bash session on frigate’s docker container, that doesn’t appear to work either:

root@oslpi400:~# docker exec -ti 9060e001fcb8 /usr/bin/bash
OCI runtime exec failed: exec failed: unable to start container process: exec: "/usr/bin/bash": stat /usr/bin/bash: no such file or directory: unknown
root@oslpi400:~# docker exec -ti 9060e001fcb8 /bin/bash
root@ccab4aaf-frigate-fa-beta:/opt/frigate# 

Do you have any other suggestions?

Also, in case I actually do get this running, which containers do you think I need to use the mount script with, so that the external media folder is usable both by frigate and homeassistant’s media storage? I’m guessing containers for frigate and homeassistant, any others?

Wish I found this add on sooner. Would have saved me nearly a day of attempts mounting a nfs share to my media directory. @adamoutler thank you!

1 Like

Last year, when I tried the Startup add-on, my HA upgrades stopped working with following error:


hassio.docker] Can't create container from homeassistant: 409 Client Error: Conflict ("Conflict. The container name "/homeassistant" is already in use by container "c9910f8be39b8d6bde9bfae9262979c36e9 b9c84cae2072dc0f24098bd49ae0a". You have to remove (or rename) that container to be able to reuse that name.")

I was able to uninstall the add-on and get upgrades working again. However, this time, even after uninstalling the Startup add-on, I am unable to get around the above error. Only way I can proceed with upgrade is with:

docker rename homeassistant homeassistant.old
ha core start

Any ideas on how to completely undo any unintended permanent effects of this add-on?

You have two containers with the same name?

Not on purpose. It’s when I try to update the Home Assistant core to a new version, the old one fails to delete and I end up with a stale homeassistant container - and this happens after I installed Run on Startup add-on. Even if I delete the add-on, the situation seems to persist).

Sounds like a permission problem. I don’t know how to handle that.

I try to use Run On startup.d for mounting nas drive on Debian with supervised Home Assistant system. It works very well on containers like homeassistant and ssh.
But I am unable to successfully use it on Plex container - mount command ends with error like:
mount: /media/syno: cannot mount //192.168.1.10/Media read-only.
Is there some specifics for Plex containers?

If the container that you were using does not have access to do certain things, You could hijack a container that has access to Docker, you could remotely connect and command any other container. There are ways to grant permissions to containers, but you have to restart them. However, from within the constraints of a single container, you are limited to the containers permissions.

Some some things you could try outside of the scope of this add-on would be to:

  1. Modify: grant that permission to the desired container.
  2. Submit Changes: create a pull request to enhance that plex container to allow mounting, or
  3. Fork: create a custom add-on that uses the latest Docker container with your permissions granted.

Basically your container doesn’t have the permissions you want, so you need to somehow grant that ability, or use another method.

Thank you, it sounds too complicate, especialy under Home assitant, I am not sure how to configure containers without Portrainer or docker compose or similar tools.

I am having similar issues concerning the error messages:

23-08-12 12:34:57 ERROR (SyncWorker_1) [supervisor.docker.manager] Can't create container from homeassistant: 409 Client Error for http+docker://localhost/v1.42/containers/create?name=homeassistant: Conflict ("Conflict. The container name "/homeassistant" is already in use by container "bbae19bd41713c1be4e1d99c02c5a986b77ff183abea5b06d4a80da69ce5d290". You have to remove (or rename) that container to be able to reuse that name.")
23-08-12 12:34:57 ERROR (MainThread) [supervisor.homeassistant.api] Error on call http://172.30.32.1:8123/api/config: Cannot connect to host 172.30.32.1:8123 ssl:False [Connect call failed ('172.30.32.1', 8123)]

At first I did not know where this is coming from, but it started after the installation of the add-on. I am using it to enable PWM fan modulation at HA start. Above error sadly causes me to be unable to update ha core in the usual way. A sequence I found which works is (via SSH on port 22222):

ha core stop
ha core update
ha host reboot
ha core update
ha core start

Having read shukkar’s reply, and narrowing down when the issue first appeared, it is striking me that the issue must be caused by the Run on Startup.d Add-on.

I have already tried installing portainer, as it was suggested somewhere to delete all containers and then to restart the host. This did not work for me, as the homassistant container could not be deleted.
Also stopping ha core and then performing a docker container prune command did not fix it.

Two main questions are coming two my mind:

  1. Any way to debug this?
  2. What is the official way to reverse the changes done by the add-on? I do not think it is an “uninstall”, as the doku mentions that the add-on may be uninstalled after activating it.

Obviously, the changes find its way back into my system whenever I restore a backup, which is complicating things as well…

docker stop homeassistant
docker rm homeassistant
Is the usual way to remove a container. Prune will remove unused images from removed containers.

I’ve had similar problems with portainer installed. I’d recommend not using that because it tries to install and manage your containers and supervisor doesn’t like that. It’s useful as a troubleshooting tool but don’t auto start it and don’t leave it running.

Thank you. I did the following steps and my errors have disappeared (I can update the core again):

  1. uninstall Run on StartUp.d
  2. Rename home assistant container
  3. Remove renamed home assistant container
  4. Full restart including host

To perform the function I wanted at home assistant startup, I defined an automation with startup as trigger and a shell command performing an internal ssh on port 22222: ena_pwm: 'ssh 127.0.0.1 -p22222 -i /config/misc/private_key -o StrictHostKeyChecking=no "/mnt/data/supervisor/homeassistant/pwm/pwmenable 0"'
Now, this triggers also at a container restart in contrast to your add-on, but I could ignore the error in the log via a filter with respect to the error thrown for my specific script if the change was already performed.

Any one had experiences of “Removal in progress” by the docker due to this addon locking the containers ?

No. You’d have to keep something running in the container for that. Make sure you set it up to run on a new thread if you’re running something in a loop.

`mycommand &|

@adamoutler

I get this error when trying to run the following in hassio_dns.sh

exec: fatal: unable to exec /tmp/hassio_dns.startup.sh: No such file or directory

Do you know what the issue is here?

Hi i have problem with running addon.
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Testing Docker access.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
You must disable protection mode. sleeping…

I enable advanced mode.(I think it will disable protect mode)
I use haos in quemu

Sorry all work, just need disable protection in addon)