fix(stirling-pdf): remove the LibreOffice listener that collides with unoserver on UNO port 2002 (#16460)

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.
This commit is contained in:
Tim Moore
2026-08-14 06:05:09 +10:00
committed by GitHub
parent d09a294ade
commit c92639eb89
2 changed files with 19 additions and 24 deletions

View File

@@ -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

View File

@@ -132,27 +132,12 @@ $STD fc-cache -fv
msg_ok "Font Cache Updated"
msg_info "Creating Service"
cat <<EOF >/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 <<EOF >/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 <<EOF >/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