Systemd:作为服务运行时,Redis服务器无法启动 – 符号链接层次太多

我最近碰到这个问题。 我已经安装了Debian 9作为networking服务器(使用nginx,php7.0-fpm和其他一些东西),我想用我的PHP安装使用redis。 当从官方回购安装时,软件包安装正常,但systemd单元无法启动或启用。 当我尝试手动从单元文件的“ExecStart”运行命令时,redis开始正常工作。

这里是单元文件(由Debian软件包提供,我没有做任何修改):

[Unit] Description=Advanced key-value store After=network.target Documentation=http://redis.io/documentation, man:redis-server(1) [Service] Type=forking ExecStart=/usr/bin/redis-server /etc/redis/redis.conf PIDFile=/var/run/redis/redis-server.pid TimeoutStopSec=0 User=redis Group=redis RunTimeDirectory=redis ExecStartPre=-/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d ExecStartPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-up.d ExecStop=-/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d ExecStop=/bin/kill -s TERM $MAINPID ExecStopPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-down.d UMask=007 PrivateTmp=yes LimitNOFILE=65535 PrivateDevices=yes ProtectHome=yes ReadOnlyDirectories=/ ReadWriteDirectories=-/var/lib/redis ReadWriteDirectories=-/var/log/redis ReadWriteDirectories=-/var/run/redis CapabilityBoundingSet=~CAP_SYS_PTRACE # redis-server writes its own config file when in cluster mode so we allow # writing there (NB. ProtectSystem=true over ProtectSystem=full) ProtectSystem=true ReadWriteDirectories=-/etc/redis [Install] WantedBy=multi-user.target Alias=redis.service 

这是运行“systemctl start redis”后journalctl -xe的输出:

 -- Subject: Unit redis-server.service has begun start-up -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- Unit redis-server.service has begun starting up. Aug 16 10:39:05 hathor systemd[9337]: redis-server.service: Failed at step NAMESPACE spawning /bin/run-parts: Too many levels of symbolic links -- Subject: Process /bin/run-parts could not be executed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- The process /bin/run-parts could not be executed and failed. -- -- The error number returned by this process is 40. Aug 16 10:39:05 hathor systemd[9340]: redis-server.service: Failed at step NAMESPACE spawning /usr/bin/redis-server: Too many levels of symbolic links -- Subject: Process /usr/bin/redis-server could not be executed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- The process /usr/bin/redis-server could not be executed and failed. -- -- The error number returned by this process is 40. Aug 16 10:39:05 hathor systemd[1]: redis-server.service: Control process exited, code=exited status=226 Aug 16 10:39:05 hathor systemd[1]: Failed to start Advanced key-value store. -- Subject: Unit redis-server.service has failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- Unit redis-server.service has failed. -- -- The result is failed. Aug 16 10:39:05 hathor systemd[1]: redis-server.service: Unit entered failed state. Aug 16 10:39:05 hathor systemd[1]: redis-server.service: Failed with result 'exit-code'. 

这里是“systemctl enable redis”给出的错误信息,这对我来说是最神秘的:

 root /lib/systemd/system $ systemctl enable redis Failed to enable unit: Refusing to operate on linked unit file redis.service root /lib/systemd/system $ systemctl enable redis-server Synchronizing state of redis-server.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable redis-server 

单元文件不是符号链接,它是一个常规文件:

 -rw-r--r-- 1 root root 1.2K Aug 16 10:32 redis-server.service 

/ etc /,/ var / run中的点不是符号链接或装载点。 此服务器上只有一个mount / mnt / backup存在。 我还应该提到这台服务器是OpenVZ主机上的VPS。 系统版本是232,Debian完全升级到内核3.16.6-042stab123.8的最新版本的软件包。

在此先感谢您的任何build议! 干杯,Johny