From c92639eb89d81550d6c77953155081b4f1377541 Mon Sep 17 00:00:00 2001 From: Tim Moore <1232390+angusmaul@users.noreply.github.com> Date: Fri, 14 Aug 2026 06:05:09 +1000 Subject: [PATCH] fix(stirling-pdf): remove the LibreOffice listener that collides with unoserver on UNO port 2002 (#16460) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libreoffice-listener.service binds 127.0.0.1:2002, and unoserver — started with no --uno-port — defaults to the same port and launches its own LibreOffice. The second soffice.bin cannot bind and spins in its URP Acceptor thread indefinitely, burning a full core from boot. It stays invisible because unoserver's client side dials 127.0.0.1:2002 and reaches the listener's instance, so conversions succeed and systemctl --failed stays empty. unoserver supervises its own LibreOffice, so the separate listener is redundant; port 2002 is still served after the change. Both Requires=libreoffice-listener lines are dropped with it, and update_script() migrates existing installs, which all still carry the collision. --- ct/stirling-pdf.sh | 16 ++++++++++++++-- install/stirling-pdf-install.sh | 27 +++++---------------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/ct/stirling-pdf.sh b/ct/stirling-pdf.sh index 1730eaaa8..0ccf8263c 100644 --- a/ct/stirling-pdf.sh +++ b/ct/stirling-pdf.sh @@ -43,8 +43,20 @@ function update_script() { find /usr/lib -name "libicudata.so.*" -exec patchelf --clear-execstack {} \; || true msg_ok "Patched Native Libraries" + if [[ -f /etc/systemd/system/libreoffice-listener.service ]]; then + msg_info "Removing Conflicting LibreOffice Listener" + systemctl disable -q --now libreoffice-listener + rm -f /etc/systemd/system/libreoffice-listener.service + sed -i '/^Requires=libreoffice-listener.service$/d' /etc/systemd/system/stirlingpdf.service /etc/systemd/system/unoserver.service + sed -i 's/^After=syslog.target network.target libreoffice-listener.service$/After=syslog.target network.target unoserver.service/' /etc/systemd/system/stirlingpdf.service + sed -i 's/^After=libreoffice-listener.service$/After=network.target/' /etc/systemd/system/unoserver.service + systemctl daemon-reload + systemctl reset-failed libreoffice-listener.service 2>/dev/null || true + msg_ok "Removed Conflicting LibreOffice Listener" + fi + msg_info "Stopping Services" - systemctl stop stirlingpdf libreoffice-listener unoserver + systemctl stop stirlingpdf unoserver msg_ok "Stopped Services" if [[ -f ~/.Stirling-PDF-login ]]; then @@ -59,7 +71,7 @@ function update_script() { msg_ok "Font Cache Updated" msg_info "Starting Services" - systemctl start stirlingpdf libreoffice-listener unoserver + systemctl start unoserver stirlingpdf msg_ok "Started Services" msg_ok "Updated successfully!" fi diff --git a/install/stirling-pdf-install.sh b/install/stirling-pdf-install.sh index 6147fc61f..db45de1e0 100644 --- a/install/stirling-pdf-install.sh +++ b/install/stirling-pdf-install.sh @@ -132,27 +132,12 @@ $STD fc-cache -fv msg_ok "Font Cache Updated" msg_info "Creating Service" -cat </etc/systemd/system/libreoffice-listener.service -[Unit] -Description=LibreOffice Headless Listener Service -After=network.target - -[Service] -Type=simple -User=root -Group=root -ExecStart=/usr/lib/libreoffice/program/soffice --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --accept="socket,host=127.0.0.1,port=2002;urp;StarOffice.ComponentContext" -Restart=always - -[Install] -WantedBy=multi-user.target -EOF - +# unoserver starts and supervises its own LibreOffice on UNO port 2002, so a separate +# listener on that port only collides with it. Do not reintroduce one. cat </etc/systemd/system/stirlingpdf.service [Unit] Description=Stirling-PDF service -After=syslog.target network.target libreoffice-listener.service -Requires=libreoffice-listener.service +After=syslog.target network.target unoserver.service [Service] SuccessExitStatus=143 @@ -173,8 +158,7 @@ EOF cat </etc/systemd/system/unoserver.service [Unit] Description=UnoServer RPC Interface -After=libreoffice-listener.service -Requires=libreoffice-listener.service +After=network.target [Service] Type=simple @@ -186,9 +170,8 @@ EnvironmentFile=/opt/Stirling-PDF/.env WantedBy=multi-user.target EOF -systemctl enable -q --now libreoffice-listener -systemctl enable -q --now stirlingpdf systemctl enable -q --now unoserver +systemctl enable -q --now stirlingpdf msg_ok "Created Service" motd_ssh