You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker中因Service Exec类型不支持无法启动gsad服务

问题解决方案

问题原因

你使用的docker-systemctl-replacement是模拟systemd功能的脚本,它不支持原生systemd的Type=exec服务类型,这是启动报错的直接原因。

修复步骤

方法1:修改服务文件适配替代工具

  1. 编辑/etc/systemd/system/gsad.service文件,将[Service]段中的Type=exec替换为Type=simple(你的ExecStart命令用了--foreground前台运行模式,Type=simple完全匹配)。修改后的完整服务文件如下:
[Unit]
Description=Greenbone Security Assistant daemon (gsad)
Documentation=man:gsad(8) https://www.greenbone.net
After=network.target gvmd.service
Wants=gvmd.service

[Service]
Type=simple
User=gvm
Group=gvm
RuntimeDirectory=gsad
RuntimeDirectoryMode=2775
PIDFile=/run/gsad/gsad.pid
ExecStart=/usr/local/sbin/gsad --foreground --listen=127.0.0.1 --port=9392 --http-only
Restart=always
TimeoutStopSec=10

[Install]
WantedBy=multi-user.target
Alias=greenbone-security-assistant.service
  1. 重新加载systemctl配置:
systemctl daemon-reload
  1. 再次启动服务:
systemctl start gsad.service

方法2:直接运行进程(容器最佳实践)

容器环境更推荐直接运行服务进程,无需通过systemctl模拟:

su - gvm -c "/usr/local/sbin/gsad --foreground --listen=127.0.0.1 --port=9392 --http-only"

这种方式完全绕开了systemctl替代工具的兼容性问题,也更符合容器的运行逻辑。

内容的提问来源于stack exchange,提问作者LewlSauce

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 16:10:31