Error when restarting nodered container: The pid file "/run/dbus/dbus.pid" exists
riesenstiefel opened this issue · comments
Hi,
I'm running ct-smart-home on a Pi 4 and I keep experiencing an issue where restarting the nodered container will fail.
docker-compose ps
would tell me that nodered is unhealthy
and nodered would not be accessible via the configured ports. docker-compose logs nodered
would reveal that the container is stuck at the following point:
dbus-daemon[10]: Failed to start message bus: The pid file "/run/dbus/dbus.pid" exists, if the message bus is not running, remove this file
.
Looking at entrypoint.sh
reveals that prior to starting dbus /var/run/dbus.pid
is indeed removed, but not /run/dbus/dbus.pid
. Not sure if some update moved dbus.pid
to the new location ...
I probably could edit entrypint.sh
and build a custom docker image but atm I don't have the time, so I'm going with this quick & dirty workaround, which I apply manually whenever needed:
# container needs to run for this
docker-compose up -d nodered
# remove unhandled dbus pid file
docker-compose exec nodered sh -c 'su-exec root rm -f /run/dbus/dbus.pid'
# restart
docker-compose restart nodered
I would expect that adding somethin like the following line to entrypoint.sh
would fix this issue, but I haven't verified it.
[[ -e /run/dbus/dbus.pid ]] && su-exec root rm -f /run/dbus/dbus.pid
Just wanted to share my observations at this point.
Cheers!
Edit:
Note that I added container_name: nodered
to my docker-compose.yml
, so you will need to adapt my docker-compose commands to your container name.
i also have this problem since yesterday. nodered won't start anymore. Your workaround by removing pid file didn't work for me.
I found the following to work:
edit entrypoint.sh while container is running
docker-compose exec nodered sh -c 'nano /usr/src/node-red/entrypoint.sh'
and add the line on top of the file (added it as second line)
[[ -e /run/dbus/dbus.pid ]] && su-exec root rm -f /run/dbus/dbus.pid
After restarting the container docker-compose restart nodered
everything seems fine again. Thanks @riesenstiefel for report and inspiration.
I have the same issue, for me would be more interesting, why a start is needed.
After a run time of about 4-5 minutes, nodered always restart/crashed without any specific message.
Basically only this follow message is shown:
ct-smart-home-nodered-1 | 24 Feb 16:00:02 - [info] Stopped flows
Do you ( @ma4a , @riesenstiefel ) have the same issue?
I have the same issue, for me would be more interesting, why a start is needed.
After a run time of about 4-5 minutes, nodered always restart/crashed without any specific message.
Basically only this follow message is shown: ct-smart-home-nodered-1 | 24 Feb 16:00:02 - [info] Stopped flows
Do you ( @ma4a , @riesenstiefel ) have the same issue?
I step in here since I have the same issue as @ma4a and @riesenstiefel. Reason is obviously that the location of the file dbus.pid
has been moved to the folder dbus
, i.e. from /run/dbus.pid
to /run/dbus/dbus.pid
. The workarounds as described above work for me, too. You can also use Portainer, open a shell there (from container list) and just manually delete the dbus.pid
file. This is sufficient for restarts until the container is deleted.
So, taking this into account and your log entry "Stopped flows" there is almost certainly another issue you have. Uneducated guess: Wrongly configured flow or missing nodes. You could try to start the node red container in safe mode or with a specific set of flows, see e.g. official node red documentation.