From fea020da5b30fa45b8f5700886c871d7698b8c84 Mon Sep 17 00:00:00 2001 From: p0wer <2510748+p0wertiger@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:52:12 +0100 Subject: [PATCH 1/4] Create systemd socket override for systemd-journal-gatewayd As stated in https://github.com/home-assistant/supervised-installer/issues/247 the default action for systemd-journal-gatewayd is to listen on HTTP port while Supervisor needs Unix socket file that's bind mounted in Docker container. This override changes socket location. --- .../systemd-journal-gatewayd.socket.d/hassio-supervisor.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/hassio-supervisor.conf diff --git a/homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/hassio-supervisor.conf b/homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/hassio-supervisor.conf new file mode 100644 index 0000000..2674ad6 --- /dev/null +++ b/homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/hassio-supervisor.conf @@ -0,0 +1,3 @@ +[Socket] +ListenStream= +ListenStream=/run/systemd-journal-gatewayd.sock From 4a11e0c6c0d0429365e38be66f66ea529357e734 Mon Sep 17 00:00:00 2001 From: p0wer <2510748+p0wertiger@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:11:54 +0100 Subject: [PATCH 2/4] Check and fix systemd socket file As stated in #247 with the default setup the path /run/systemd-journal-gatewayd.sock may be a directory, not a file, we have to fix that --- homeassistant-supervised/DEBIAN/postinst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/homeassistant-supervised/DEBIAN/postinst b/homeassistant-supervised/DEBIAN/postinst index 6ff90de..0e2c0fa 100755 --- a/homeassistant-supervised/DEBIAN/postinst +++ b/homeassistant-supervised/DEBIAN/postinst @@ -31,6 +31,14 @@ if [ "$(systemctl is-active systemd-resolved)" = 'inactive' ]; then systemctl start systemd-resolved.service> /dev/null 2>&1; fi +# Check and fix systemd-journal-gatewayd socket location +if [ ! -S "/run/systemd-journal-gatewayd.sock" ]; then + info "Set up systemd-journal-gatewayd socket file" + if [ "$(systemctl is-active systemd-journal-gatewayd.socket)" = 'active' ]; then + systemctl stop systemd-journal-gatewayd.socket> /dev/null 2>&1; + fi + rm -rf "/run/systemd-journal-gatewayd.sock"; +fi # Enable and start systemd-journal-gatewayd if [ "$(systemctl is-active systemd-journal-gatewayd.socket)" = 'inactive' ]; then info "Enable systemd-journal-gatewayd" From 92c292afcff9cd711feb92cddf96d4140e5a06f0 Mon Sep 17 00:00:00 2001 From: p0wer <2510748+p0wertiger@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:14:21 +0100 Subject: [PATCH 3/4] Remove unnecessary unit file Socket location change has been moved to systemd override which is the suggested way of changing original packaged unit behavior --- .../system/systemd-journal-gatewayd.socket | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket diff --git a/homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket b/homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket deleted file mode 100644 index a48e519..0000000 --- a/homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Journal Gateway Service Socket -Documentation=man:systemd-journal-gatewayd(8) - -[Socket] -ListenStream=/run/systemd-journal-gatewayd.sock - -[Install] -WantedBy=sockets.target \ No newline at end of file From c464629bba24c789c8a9b5d1f2e06680beba9af3 Mon Sep 17 00:00:00 2001 From: p0wer <2510748+p0wertiger@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:28:34 +0100 Subject: [PATCH 4/4] Rename hassio-supervisor.conf to 10-hassio-supervisor.conf --- .../{hassio-supervisor.conf => 10-hassio-supervisor.conf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/{hassio-supervisor.conf => 10-hassio-supervisor.conf} (100%) diff --git a/homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/hassio-supervisor.conf b/homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/10-hassio-supervisor.conf similarity index 100% rename from homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/hassio-supervisor.conf rename to homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/10-hassio-supervisor.conf