firebird3 的作业。0.service 失败,因为超出了配置的资源限制

Job for firebird3.0.service failed because a configured resource limit was exceeded

安装时以及尝试启动 Firebird 3.0 服务后出现错误。

Job for firebird3.0.service failed because a configured resource limit was exceeded. See "systemctl status firebird3.0.service" and "journalctl -xe" for details.

invoke-rc.d: initscript firebird3.0, action "start" failed.

dpkg: error processing package firebird3.0-server (--configure):
 subprocess installed post-installation script returned error exit status 1

Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu7) ...
Processing triggers for ureadahead (0.100.0-19) ...

Errors were encountered while processing:
 firebird3.0-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

参见 "service firebird3.0 start" 中的 return:

Job for firebird3.0.service failed because a configured resource limit was exceeded. See "systemctl status firebird3.0.service" and "journalctl -xe" for details

参见 "journalctl -xe" 中的 return:

-- Unit firebird3.0.service has begun starting up.
Ago 26 15:41:22 server14 systemd[1]: firebird3.0.service: PID file /var/run/firebird/3.0default.pid not readable (yet?) after start: No such file or directory
Ago 26 15:41:22 server14 firebird[3509]: Security database error
Ago 26 15:41:22 server14 systemd[1]: firebird3.0.service: Daemon never wrote its PID file. Failing.
Ago 26 15:41:22 server14 systemd[1]: Failed to start Firebird Database Server ( SuperServer ).
-- Subject: Unit firebird3.0.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit firebird3.0.service has failed.
-- 
-- The result is failed.
Ago 26 15:41:22 server14 systemd[1]: firebird3.0.service: Unit entered failed state.
Ago 26 15:41:22 server14 systemd[1]: firebird3.0.service: Failed with result 'resources'.

我尝试了很多方法来解决,但目前唯一的方法是手动启动:

start-stop-daemon   --quiet --start --exec /usr/sbin/fbguard --pidfile /var/run/firebird/3.0/firebird.pid -b -m -- -daemon -forever -pidfile /var/run/firebird/3.0/firebird.pid

和手动停止:

start-stop-daemon --stop --signal KILL --exec /usr/sbin/fbguard 
start-stop-daemon --stop --signal KILL --exec /usr/sbin/firebird

有什么想法吗?

目录 /run/firebird/3.0 不是在基于 debian 的系统上安装时创建的。所以systemd脚本不起作用。

解决方法:

作为用户 root

  1. 创建目录: mkdir -p /run/firebird/3.0
  2. chown to firebird: chown -R firebird:firebird /run/firebird

执行此操作后,firebird 3.0 应该 运行 符合预期

由于 /运行 通常是 Debian 中的临时目录,您可以更改 sytemd 启动脚本以始终在服务启动之前执行目录创建:

/lib/systemd/system/firebird3.0 应该如下所示:

[Unit]
Description=Firebird Database Server ( SuperServer )
After=network.target
Conflicts=firebird3.0-classic.socket

[Service]
User=firebird
Group=firebird
Type=forking
# Run ExecStartPre with root-permissions
PermissionsStartOnly=true
ExecStartPre=-/bin/mkdir -p /run/firebird/3.0
ExecStartPre=/bin/chown -R firebird:firebird /run/firebird
PIDFile=/run/firebird/3.0/default.pid
ExecStart=/usr/sbin/fbguard -pidfile /run/firebird/3.0/default.pid -daemon -forever
RuntimeDirectory=firebird/3.0
StandardError=syslog

[Install]
WantedBy=multi-user.target

PermissionsStartOnly=true 是能够以 root 身份执行除服务本身 (ExecStart) 之外的所有语句所必需的。这对于在 /运行 中创建子目录很重要。 顺便说一下:第一行 ExecStartPre 中的 -(减号)使脚本 运行 脚本不会因目录创建返回的错误而停止,如果目录存在则有帮助,例如在服务重启后。

不要忘记重新加载 systemd: systemctl --system daemon-reload