创建了用户服务。返回错误“在步骤 GROUP 生成时失败:不允许操作”

创建了用户服务。返回错误“在步骤 GROUP 生成时失败:不允许操作”

我创建了一个服务。

admin@Xroklaus:~ $ cat /etc/systemd/user/duniter.service 
[Unit]
Description=Duniter node
After=network.target
ConditionPathExists=/home/folatt/.config/duniter/duniter_default/duniter.db

[Service]
Group=folatt
User=folatt
Type=forking
ExecStart=/usr/bin/duniter webstart
ExecReload=/usr/bin/duniter webrestart
ExecStop=/usr/bin/duniter stop
Restart=on-failure

[Install]
WantedBy=multi-user.target

重启后,无法加载。

folatt@Xroklaus:~ $ systemctl --user status duniter.service
● duniter.service - Duniter node
   Loaded: loaded (/etc/systemd/user/duniter.service; enabled)
   Active: failed (Result: start-limit) since Sun 2018-01-07 20:31:43 UTC; 1min 3s ago
  Process: 2212 ExecStart=/usr/bin/duniter webstart (code=exited, status=216/GROUP)

Journalctl 提供了更多有关错误的信息。

admin@Xroklaus:~ $ sudo journalctl -p 3 --no-pager
-- Logs begin at Sun 2018-01-07 20:30:33 UTC, end at Sun 2018-01-07 20:31:49 UTC. --
Jan 07 20:30:39 Xroklaus bluetoothd[876]: Sap driver initialization failed.
Jan 07 20:30:39 Xroklaus bluetoothd[876]: sap-server: Operation not permitted (1)
Jan 07 20:31:26 Xroklaus systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Jan 07 20:31:42 Xroklaus systemd[2203]: Failed at step GROUP spawning /usr/bin/duniter: Operation not permitted
Jan 07 20:31:42 Xroklaus systemd[2177]: Failed to start Duniter node.
Jan 07 20:31:42 Xroklaus systemd[2206]: Failed at step GROUP spawning /usr/bin/duniter: Operation not permitted
Jan 07 20:31:42 Xroklaus systemd[2177]: Failed to start Duniter node.
Jan 07 20:31:43 Xroklaus systemd[2208]: Failed at step GROUP spawning /usr/bin/duniter: Operation not permitted
Jan 07 20:31:43 Xroklaus systemd[2177]: Failed to start Duniter node.
Jan 07 20:31:43 Xroklaus systemd[2210]: Failed at step GROUP spawning /usr/bin/duniter: Operation not permitted
Jan 07 20:31:43 Xroklaus systemd[2177]: Failed to start Duniter node.
Jan 07 20:31:43 Xroklaus systemd[2212]: Failed at step GROUP spawning /usr/bin/duniter: Operation not permitted
Jan 07 20:31:43 Xroklaus systemd[2177]: Failed to start Duniter node.
Jan 07 20:31:43 Xroklaus systemd[2177]: Failed to start Duniter node.

但据我所知。我不知道这个问题的解决办法是什么。

答案1

我移动了服务文件并删除了用户和组,同时还更改了安装目标,如下所示:

/usr/lib/systemd/user/duniter.service

[Unit]
Description=Duniter node
After=network.target
ConditionPathExists=/home/folatt/.config/duniter/duniter_default/duniter.db

[Service]
Type=forking
ExecStart=/usr/bin/duniter webstart
ExecReload=/usr/bin/duniter webrestart
ExecStop=/usr/bin/duniter stop
Restart=on-failure

[Install]
WantedBy=default.target

答案2

如果您的服务的用户和/或组依赖于网络服务(例如 LDAP),则必须将相应的服务(例如 nslcd)添加到服务定义文件的 [Unit] 部分的 Wants 和 After 行。

如果在尚不可用的网络目录中定义用户或组,则服务将无法启动,并出现“在步骤 GROUP 生成时失败”错误。

相关内容