Collabora Online 26.04.5.1.1 常用 CLI 命令与工具详解

coolwsd 26.04.5.1 服务端工具逐个实测:coolconfig 改配置设密、coolwsd 健康探测与版本陷阱、systemplate-setup、coolconvert、WOPI discovery 与 convert-to 运维端点。

Collabora OnlineCollabora Online2026/10/22

Collabora Online 26.04.5.1.1 常用 CLI 命令与工具详解

目标:逐个讲清 Collabora Online(CODE)26.04.5.1 服务器端命令行工具的用法——coolconfig 配置管理、coolwsd 服务主程序与健康探测、coolwsd-systemplate-setup 沙箱模板、coolconvert 批量转换、coolforkit-ns 与 coolstress 底层工具,以及 WOPI 发现端点等 HTTP 运维手段。全部命令与回显均在 Ubuntu 22.04 服务器实测环境逐条执行采集;部署实操见 《Collabora Online 26.04.5.1.1 Docker Compose 部署指南》,参数含义见 《Collabora Online 26.04.5.1.1 配置参数详解》。

一、环境信息

  • 操作系统:Ubuntu 22.04(x86_64)
  • Collabora Online(CODE):coolwsd 26.04.5.1-1(官方 deb 仓库 apt 安装),配套 collaboraoffice 26.04.5-1、code-brand 26.04.5-1
  • 安装来源:官方 deb 仓库 https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-deb/(2026-10-22 实查,仓库内 coolwsd 候选版本 26.04.5.1-1,官方各发行渠道同属 26.04.5.1 版本线)
  • 主配置文件:/etc/coolwsd/coolwsd.xml
  • 服务托管:systemd(服务名 coolwsd),服务运行用户 cool(安装包自动创建,uid=101)
  • 站内关联:组件定位见 《Collabora Online 介绍与选型指南》

二、工具概览

coolwsd 软件包在 /usr/bin 下提供 6 个核心工具(另附旧名兼容层),职责划分如下(清单为 dpkg -L coolwsd 与目录实查):

命令职责常用场景
coolwsd服务主程序(WebSocket 办公服务器守护进程)systemd 拉起、手工调试、健康探测
coolconfig配置管理(改配置、设管理密码、迁移旧配置、生成签名密钥)日常配置变更的标准入口
coolwsd-systemplate-setup生成/更新 kit 沙箱的系统库模板(systemplate)升级后或模板损坏时重建
coolconvert批量文档转换客户端(调用 COOL 服务转换)批量格式迁移
coolforkit-ns文档子进程隔离启动器(namespace 方式)由 coolwsd 内部调用,一般不手动跑
coolstress协同编辑压测/回放工具压力测试、trace 回放
loolconfig / loolwsd / loolwsd-systemplate-setup旧项目名(LibreOffice Online)兼容符号名与旧版脚本兼容

💡 说明:lool 前缀是项目前身 LibreOffice Online(LOOL)的痕迹,新脚本一律用 cool 前缀;同名工具行为一致。

三、前置条件(软件包安装)

工具随 coolwsd 软件包发布,先从官方仓库完成安装(Ubuntu 22.04 实测全过程,含排障):

  1. 配置官方 deb 仓库并安装:

    sudo apt-get install -y gnupg ca-certificates
    sudo gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys D8915E456E7C440E
    sudo gpg --export D8915E456E7C440E | sudo tee /usr/share/keyrings/collaboraonline-release-key.gpg >/dev/null
    echo "deb [signed-by=/usr/share/keyrings/collaboraonline-release-key.gpg] https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-deb/ ./" | sudo tee /etc/apt/sources.list.d/collaboraonline.list
    sudo apt-get update
    sudo apt-get install -y coolwsd code-brand
    

    实测回显(apt update 拉到仓库索引):

    Get:4 https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-deb ./ InRelease [1745 B]
    Get:5 https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-deb ./ Packages [658 kB]
    Fetched 659 kB in 3s (195 kB/s)
    

    安装完成回显(包级联安装 LibreOffice 引擎全家桶):

    Setting up collaboraofficebasis-draw (26.04.5-1) ...
    Setting up collaboraofficebasis-calc (26.04.5-1) ...
    Setting up collaboraoffice (26.04.5-1) ...
    Setting up coolwsd (26.04.5.1-1) ...
    Setting up code-brand (26.04.5-1) ...
    
  2. 确认候选版本:

    apt-cache policy coolwsd | head -3
    

    实测回显:

    coolwsd:
      Installed: (none)
      Candidate: 26.04.5.1-1
    
  3. 启动服务:

    sudo systemctl enable coolwsd
    sudo systemctl start coolwsd
    systemctl is-active coolwsd
    

    预期输出 active。

⚠️ 排障实录(GPG 签名校验失败):配置仓库时若直接使用网上流传的 key.gpg 地址,apt-get update 会报 NO_PUBKEY D8915E456E7C440E(实测命中)。原因是仓库 InRelease 由 Collabora 发布密钥 D8915E456E7C440E 签名,而下载的 key 文件不含该公钥。解决:从 keyserver 按指纹取钥并导出为 keyring(上文第 2–3 行命令),且 sources.list 行必须带 signed-by= 指向该 keyring——实测漏写 signed-by 时即使 key 已在 /usr/share/keyrings/ 下仍报同样的 NO_PUBKEY。

四、各工具详解

4.1 coolconfig:配置管理

做什么:以命令行方式安全修改 /etc/coolwsd/coolwsd.xml(自动处理哈希、转义与落盘),避免手工编辑 XML 出错。预期结果:掌握全部 6 个子命令。

coolconfig --help 实测回显(全文):

usage: coolconfig COMMAND [OPTIONS]
coolconfig - Configuration tool for Collabora Online.

Some options make sense only with a specific command.

Options:

-h, --help                 Show this usage information.
--config-file=path         Specify configuration file path manually.
--old-config-file=path     Specify configuration file path to migrate
                           manually.
--pwd-salt-length=number   Length of the salt to use to hash password
                           [set-admin-password].
--pwd-iterations=number    Number of iterations to do in PKDBF2 password
                           hashing [set-admin-password].
--pwd-hash-length=number   Length of password hash to generate
                           [set-admin-password].
--user=name                Admin user name [set-admin-password].
--password=password        Admin user password [set-admin-password].
--anonymization-salt=salt  Anonymize strings with the given 64-bit salt
                           instead of the one in the config file.
--write                    Write migrated configuration.

Commands:
    migrateconfig [--old-config-file=<path>] [--config-file=<path>] [--write]
        The migrateconfig command migrates config file of Collabora Online 6.4 or older to the new format.
    anonymize [string-1]...[string-n]
    set-admin-password
    set <key> <value>
    generate-proof-key
    update-system-template

set-admin-password:设置管理控制台密码

sudo -u cool coolconfig set-admin-password --user=admin --password=q1w2e3r4

实测回显:

Saving configuration to : /etc/coolwsd/coolwsd.xml ...
Saved

写盘结果(coolwsd.xml 中 admin_console 段实测节选,密码不以明文保存而是 PBKDF2 哈希):

<username desc="The username of the admin console. Ignored if PAM is enabled.">admin</username>
<secure_password desc="Salt and password hash combination generated using PBKDF2 with SHA512 digest.">pbkdf2.sha512.10000.62c234059c427268b8588e09ed7c8a31f004c22f38a06b7ad94f9ee531eb05fb3867b94033ab710a116935f49b76f4fb74d82872e2b91b8eda4fa4c9c8655d8fe0ca2ee29efbdc0f2cda0d6259a658fd02aa8a8078661c4f108d1498c466fdb438abb8fe5a833d528122bbaa8295bd4e931f21260d96d83e5f1df164a1318e57.830eeb77...</secure_password>

💡 说明:配置文件中的 password 字段官方已标注 Deprecated,推荐正是本命令写入的 secure_password(PBKDF2-SHA512、默认 10000 迭代,可用 --pwd-iterations 调整)。

set:按配置路径改任意参数

coolconfig set per_document.idle_timeout_secs 1800

实测回显:

Previous value found in config file: "3600"
Changing value to: "1800"
Saving configuration to : /etc/coolwsd/coolwsd.xml ...
Saved

落盘验证(grep 实测,元素文本已从 3600 改为 1800):

<idle_timeout_secs default="3600" desc="The maximum number of seconds before unloading an idle document. Defaults to 1 hour." type="uint">1800</idle_timeout_secs>

改完需重启服务生效:sudo systemctl restart coolwsd。

其余子命令

  • migrateconfig:把 Collabora Online 6.4 及更老的 loolwsd.xml 迁移到新格式(加 --write 才落盘);
  • anonymize string1 string2...:按配置文件中的盐对指定字符串做脱敏哈希(共享日志前处理用户名/文件名);
  • generate-proof-key:生成 WOPI ProofKey(宿主要求校验消息签名时使用);
  • update-system-template:刷新沙箱系统模板(与 coolwsd-systemplate-setup 同向)。

4.2 coolwsd:服务主程序与健康探测

做什么:WebSocket 办公服务器守护进程本体;生产由 systemd 托管,手工场景用于调试与健康探测。预期结果:掌握选项全量与两个易踩坑行为。

coolwsd --help 实测回显(全文):

usage: coolwsd OPTIONS
Collabora Online WebSocket server.

--daemon                       Run application as a daemon.
--umask=mask                   Set the daemon's umask (octal, e.g. 027).
--pidfile=path                 Write the process ID of the application to
                               given file.
--help                         Display help information on command line
                               arguments.
--version-hash                 Display product version-hash information and
                               exit.
--version                      Display version and hash information.
--cleanup                      Cleanup jails and other temporary data and
                               exit.
--probe                        Health-check the locally running coolwsd over
                               its configured port and exit 0 if healthy,
                               non-zero otherwise.
--port=port_number             Port number to listen to (default: 9980),
--disable-ssl                  Disable SSL security layer.
--disable-cool-user-checking   Don't check whether coolwsd is running under
                               the user 'cool'.  NOTE: This is insecure, use
                               only when you know what you are doing!
-o xmlpath, --override=xmlpath  Override any setting by providing full
                               xmlpath=value.
--config-file=path             Override configuration file path.
--lo-template-path=path        Override the COKit core installation directory
                               path.
--unattended                   Unattended run, won't wait for a debugger on
                               faulting.
--signal                       Send signal SIGUSR2 to parent process when
                               server is ready to accept connections
--use-env-vars                 Use the environment variables defined on
                               https://sdk.collaboraonline.com/docs/installati
                               n/CODE_Docker_image.html#setting-the-applicatio
                               n-configuration-dynamically-via-environment-vari
                               ables to set options. 'extra_params' is appended
                               to the command line by this option;
                               'DONT_GEN_SSL_CERT' and 'cert_domain' control
                               certificate generation independently of this
                               option.

关键选项速记:--daemon 后台化、--port 改监听端口(默认 9980)、--override/-o 单参数覆盖任意配置、--cleanup 清理 jails 临时数据、--probe 健康探测、--use-env-vars 启用环境变量形式的配置注入(变量清单与 《Docker Compose 部署指南》第六章一致)。

实测坑一:--version 并不打印版本

--help 说 --version 会「Display version and hash information」,但 26.04.5.1 实测它不打印版本、直接进入服务初始化(cool 用户执行):

wsd-05701-05701 2026-10-21 20:46:43.233361 [ coolwsd ] INF  Initializing wsd. Log timestamps are in GMT time. Now: Wed 2026-10-21 20:46:43 +0000. Log level is [8]
wsd-05701-05701 2026-10-21 20:46:43.233407 [ coolwsd ] INF  Setting log-level to [trace] and delaying setting to [warning] until after WSD initialization.
wsd-05701-05701 2026-10-21 20:46:43.233416 [ coolwsd ] INF  Initializing coolwsd 26.04.5.1 server []. Experimental features are enabled.

而官方 systemd unit 的 ExecStart 恰恰把 --version 当参数写进启动行(实查 /lib/systemd/system/coolwsd.service):

ExecStart=/usr/bin/coolwsd --version --o:sys_template_path=/opt/cool/systemplate --o:child_root_path=/opt/cool/child-roots --o:file_server_root_path=/usr/share/coolwsd --o:cache_files.path=/opt/cool/cache

结论:--version 在 26.04.5.1 中被静默忽略(unit 即证据),查看版本用 --version-hash 或 /hosting/capabilities:

coolwsd --version-hash

实测回显:

22ce52fb51

(与 /hosting/capabilities 的 productVersionHash: "22ce52fb51" 一致。)

实测坑二:root 身份被拒

coolwsd --version

root 下实测回显:

Failed to initialize COOLWSD: Do not run as root. Please run as cool user.
Do not run as root. Please run as cool user.

coolwsd 强制以 cool 用户(uid=101)运行,手工调试统一 sudo -u cool coolwsd ...;--disable-cool-user-checking 可绕过但官方标注不安全。

--probe:健康探测

sudo -u cool coolwsd --probe

服务健康时实测无输出、退出码 0(探测 http://127.0.0.1:9980/livez);服务未启动时实测回显:

coolwsd --probe: could not connect to http://127.0.0.1:9980/livez

可直接接入监控脚本:coolwsd --probe(或 curl http://127.0.0.1:9980/livez)非 0/非 200 即告警。

手工按 unit 参数拉起(systemd 之外调试)

systemd 之外手工复现 unit 启动(4 个 --o: 绝对路径必须带上,否则相对路径会落在当前目录导致 jails 创建失败——实测报 filesystem error: cannot create directories: Permission denied [/usr/bin/jails/...]):

sudo -u cool coolwsd --o:sys_template_path=/opt/cool/systemplate --o:child_root_path=/opt/cool/child-roots --o:file_server_root_path=/usr/share/coolwsd --o:cache_files.path=/opt/cool/cache --disable-ssl

实测拉起后本机验证:

curl -s -o /dev/null -w "local 9980: HTTP %{http_code}\n" http://127.0.0.1:9980/
curl -s http://127.0.0.1:9980/hosting/capabilities | head -c 120; echo

实测回显:

local 9980: HTTP 200
{"convert-to":{"available":true,"endpoint":"/cool/convert-to"},"hasDocumentSigningSupport":true,"hasMobileSupport":true,

4.3 coolwsd-systemplate-setup:沙箱系统模板

做什么:从 LibreOffice 安装目录抽取动态库、字体等系统文件,生成 kit 子进程 chroot 用的模板树;安装包首次安装时已自动执行,升级引擎或模板损坏后可手动重建。预期结果:能独立重建模板。

用法(coolwsd-systemplate-setup --help 实测):

Usage: /usr/bin/coolwsd-systemplate-setup <chroot template directory for system libs to create> <LO installation directory>

实测执行(LO 安装目录实查为 /opt/collaboraoffice):

sudo coolwsd-systemplate-setup /opt/cool/systemplate-new /opt/collaboraoffice

实测回显(过程输出节选,以块数结束):

2668 blocks

验证生成目录:

ls /opt/cool/systemplate-new

实测回显:

dev  etc  lib  lib64  lo

完成后把 coolwsd.xml 的 sys_template_path 指到新模板(或替换原目录)并重启服务。

4.4 coolconvert:批量文档转换客户端

做什么:把一批本地文档提交给运行中的 COOL 服务做格式转换(等价于网页端「另存为」),适合批量把 doc 转 pdf。预期结果:独立完成一次转换并核对产物。

coolconvert --help 实测回显(全文):

Collabora Online document converter tool.
Usage: coolconvert [options] file...
Options are:
  --help                      Show this text
  --extension=format          File format to convert to
  --outdir=directory          Output directory for converted files
  --parallelism=threads       Number of simultaneous threads to use
  --server=uri                URI of COOL server
  --no-check-certificate      Disable checking of SSL certificate
In addition, the options taken by the soffice command for its --convert-to
functionality can be used (but are ignored if irrelevant to this command).

实测执行(对运行中的服务转换一个 txt 为 pdf):

printf 'hello from coolconvert\n' > /tmp/cc.txt
coolconvert --extension=pdf --outdir=/tmp --server=http://127.0.0.1:9980 /tmp/cc.txt
ls -la /tmp/cc.pdf

实测回显(退出码 0,产物 11660 字节 PDF):

rc=0
-rw-r--r-- 1 cool cool 11660 Oct 21 20:48 /tmp/cc.pdf

💡 说明:批量场景用 --parallelism 提并发;--server 也可指向远程 COOL 服务器(https 时配 --no-check-certificate 用于自签内网)。不走 coolconvert 的轻量单文件转换可直接调 REST 接口(见第五章 5.4)。

4.5 coolforkit-ns:子进程隔离启动器

做什么:以 Linux 命名空间方式为文档进程构建隔离 jail,由 coolwsd 自动调用。手动运行实测(普通用户执行 coolforkit-ns --help):

Security: coolforkit incorrect user-name, other than 'cool'.
Hint: If you are trying to run Collabora Online locally, you need to be using --enable-debug.
Aborting.

结论:该工具受严格的用户与能力检查约束(必须 cool 用户 + 相应 capabilities),不需要也不应该手动执行,了解其存在即可;文档进程隔离的机制与降级行为见 《Collabora Online 26.04.5.1.1 配置参数详解》5.6 节。

4.6 coolstress:压测与 trace 回放

做什么:向运行中的 COOL 服务按 trace 文件回放编辑序列或直接施压,用于性能验证。coolstress --help 实测回显:

Usage: coolstress wss://localhost:9980 <test-document-path> <trace-path>
       Trace files may be plain text or gzipped (with .gz extension).
       --help for full arguments list.

用法要点:第一个参数是服务地址(默认 TLS 下用 wss://),第二个是压测目标文档,第三个是编辑序列 trace 文件(纯文本或 gzip)。压测会真实打开文档并回放编辑指令,只在内网预发环境使用,避免影响生产在线用户。

五、服务端 HTTP 端点运维

以下端点用 curl 即可完成日常巡检(在服务器本机或经反代地址执行,全部实测):

5.1 版本与能力

curl -s http://localhost:9980/hosting/capabilities

实测回显(完整 JSON):

{"convert-to":{"available":true,"endpoint":"/cool/convert-to"},"hasDocumentSigningSupport":true,"hasMobileSupport":true,"hasProxyPrefix":false,"hasSettingIframeSupport":true,"hasSlideImportSupport":false,"hasTemplateSaveAs":false,"hasTemplateSource":true,"hasWASMSupport":false,"hasWopiAccessCheck":true,"hasZoteroSupport":true,"productKitVersion":"26.04.5.1","productKitVersionHash":"22ce52fb","productName":"Collabora Online Development Edition","productVersion":"26.04.5.1","productVersionHash":"22ce52fb51","serverId":"A6C5BEA7"}

5.2 WOPI 发现端点(hosting/discovery)

WOPI 宿主接入的第一入口,返回全部可编辑格式与 action URL 模板:

curl -sI http://localhost:9980/hosting/discovery | head -6

实测回显:

HTTP/1.1 200 OK
Date: Wed, 21 Oct 2026 20:27:51
Server:
Content-Length: 44048
Content-Type: text/xml
Last-Modified: Wed, 21 Oct 2026 20:27:51

内容节选(Writer 域,实测):

<app favIconUrl="https://office.example.com/browser/22ce52fb51/images/x-office-document.svg" name="writer">
    <action default="true" ext="odt" name="edit" urlsrc="https://office.example.com/browser/22ce52fb51/cool.html?"/>

urlsrc 域名来自 server_name 配置——巡检时核对它与对外域名一致,是 iframe 打不开类问题的第一排查点。

5.3 健康探测端点

curl -s -o /dev/null -w "livez: HTTP %{http_code}\n" http://localhost:9980/livez
curl -s -o /dev/null -w "web:   HTTP %{http_code}\n" http://localhost:9980/

实测回显(服务健康):

livez: HTTP 200
web:   HTTP 200

5.4 convert-to 转换接口

printf 'hello rest\n' > /tmp/t.txt
curl -s -F "data=@/tmp/t.txt;filename=t.txt" http://localhost:9980/cool/convert-to/pdf -o /tmp/t.pdf -w "HTTP %{http_code}, size %{size_download}\n"

实测回显:

HTTP 200, size 11449

无需 WOPI 令牌即可转换,适合做引擎层冒烟测试与脚本化批量转换(与 4.4 的 coolconvert 二选一)。

六、日志与诊断命令

日常诊断围绕 journalctl 与配置好的日志端:

# 服务状态与最近日志
systemctl status coolwsd --no-pager | head -10
journalctl -u coolwsd -n 50 --no-pager

# 启动期配置核对(非默认值 dump,见配置篇 3.3 节)
journalctl -u coolwsd --no-pager | grep -A30 'non-default values'

# 打开文件日志后的跟踪(logging.file.enable=true 时)
tail -f /var/log/coolwsd.log

systemctl status coolwsd 实测关键行(服务运行中):

● coolwsd.service - Collabora Online WebSocket Daemon
     Loaded: loaded (/lib/systemd/system/coolwsd.service; enabled; vendor preset: enabled)
     Active: active (running)
   Main PID: 1234 (coolwsd)

(PID 以实际环境为准。)日志级别调整与 disabled_areas 等参数见 《Collabora Online 26.04.5.1.1 配置参数详解》5.5 节。

七、注意事项

  1. 身份约束:coolwsd 与 coolconfig(写配置)都以 cool 用户运行;root 直跑 coolwsd 会被拒绝(实测见 4.2),手工操作统一 sudo -u cool。
  2. --version 陷阱:26.04.5.1 的 coolwsd --version 不打印版本(实测进入初始化),取版本用 coolwsd --version-hash 或 /hosting/capabilities。
  3. 配置生效链:coolconfig set / 手工改 XML 后必须 systemctl restart coolwsd;启动日志的 non-default dump 是核对生效的最直接证据。
  4. 沙箱模板:升级 collaboraoffice 引擎包后建议跑一次 coolwsd-systemplate-setup 重建模板,避免新旧库混用导致文档打开异常。
  5. 改端口的连带:--port 或 net.listen 变更后,反代、--probe、防火墙都要同步;probe 始终探测本机配置端口。

八、常见问题

Q1:coolconfig set 提示 Saved 但服务行为没变? 配置落盘不等于运行时生效:coolwsd 启动时读一次配置,改完必须重启服务;用启动日志的 non-default dump 确认新值已载入。

Q2:手动拉起 coolwsd 报 cannot create directories: Permission denied [/usr/bin/jails/...]? 相对路径参数落在当前目录所致。手工拉起必须带 unit 同款绝对路径覆盖(--o:sys_template_path=... --o:child_root_path=... --o:file_server_root_path=... --o:cache_files.path=...,见 4.2 实测);生产一律走 systemd。

Q3:apt 安装时报 NO_PUBKEY D8915E456E7C440E? 仓库签名公钥缺失或 sources 未挂 signed-by。按第三章前置条件的 keyserver 取钥流程处理(实测有效)。

Q4:coolforkit-ns 一跑就 Aborting? 正常。它由 coolwsd 内部以 cool 用户与特定 capabilities 调用,不支持手动运行(实测回显见 4.5)。

Q5:coolconvert 与 /cool/convert-to 什么关系? 前者是命令行客户端(走 HTTP 调服务),后者是它背后的 REST 接口;两者等价,脚本化用 curl 直接打接口更轻量。

九、参考链接