linux memcached未在Ubuntu 18上运行:memcached.service:无法设置装载命名空间:无此文件或目录[已关闭]

ygya80vv  于 2023-10-16  发布在  Linux
关注(0)|答案(1)|浏览(132)

已关闭此问题为not about programming or software development。它目前不接受回答。

这个问题似乎不是关于a specific programming problem, a software algorithm, or software tools primarily used by programmers的。如果你认为这个问题与another Stack Exchange site的主题有关,你可以留下评论,解释在哪里可以回答这个问题。
8天前关闭
Improve this question
在Ubuntu 18.04上,我在启动memcached服务时遇到了以下问题(在全新/新安装memcached软件包后),即使在启动/重新启动服务后也根本无法运行,memcached服务(journalctl -xe)记录了以下错误:

Sep 29 13:52:27 mail systemd[22986]: memcached.service: Failed to set up mount namespacing: No such file or directory
Sep 29 13:52:27 mail systemd[22986]: memcached.service: Failed at step NAMESPACE spawning /usr/share/memcached/scripts/systemd-memcached-wrapper: No such file or directory
-- Subject: Process /usr/share/memcached/scripts/systemd-memcached-wrapper could not be executed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The process /usr/share/memcached/scripts/systemd-memcached-wrapper could not be executed and failed.
-- 
-- The error number returned by this process is 2.
Sep 29 13:52:27 mail systemd[1]: memcached.service: Failed with result 'exit-code'.

但是在上面的错误中提到的文件(/usr/share/memcached/scripts/systemd-memcached-wrapper),实际上存在:

# ls -la /usr/share/memcached/scripts/systemd-memcached-wrapper
-rwxr-xr-x 1 root root 1423 Sep  5  2019 /usr/share/memcached/scripts/systemd-memcached-wrapper

我猜memcached看起来是以正确的方式设置的:

  • memcached配置文件:
# grep -v ^# /etc/memcached.conf  | grep -v ^$
-d
logfile /var/log/memcached/memcached.log
-m 64
-p 11211
-u memcache
-l 127.0.0.1
-P /var/run/memcached/memcached.pid
  • memcached的run文件夹(用于PID文件):
# ls -lad /var/run/memcached/
drwxr-xr-x 2 memcache memcache 40 Aug 11 20:57 /var/run/memcached/
  • memcached的log文件夹:
# ls -lad /var/log/memcached/
drwxr-xr-x 2 memcache memcache 4096 Sep 29 14:04 /var/log/memcached/
  • memcached服务配置:
# grep -v ^# /lib/systemd/system/memcached.service | grep -v ^$
[Unit]
Description=memcached daemon
After=network.target
Documentation=man:memcached(1)
[Service]
ExecStart=/usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached.conf
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
MemoryDenyWriteExecute=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictNamespaces=true
PIDFile=/var/run/memcached/memcached.pid
Restart=always
[Install]
WantedBy=multi-user.target

但是如果我启用systemd日志的调试,我会得到更多奇怪的错误,这些错误可能与memcached(使用systemd-analyze log-level debug)有关,并有更多细节:

Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state UNSET → OPENING
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state OPENING → AUTHENTICATING
Sep 29 13:58:23 mail systemd[1]: Accepted new private connection.
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state AUTHENTICATING → RUNNING
Sep 29 13:58:23 mail systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1/unit/multi_2duser_2etarget interface=org.freedesktop.DBus.Properties member=Get cookie=1 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=v error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state RUNNING → CLOSING
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state CLOSING → CLOSED
Sep 29 13:58:23 mail systemd[1]: Got disconnect on private connection.
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state UNSET → OPENING
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state OPENING → AUTHENTICATING
Sep 29 13:58:23 mail systemd[1]: Accepted new private connection.
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state AUTHENTICATING → RUNNING
Sep 29 13:58:23 mail systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=RestartUnit cookie=1 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: memcached.service: Trying to enqueue job memcached.service/restart/replace
Sep 29 13:58:23 mail systemd[1]: memcached.service: Installed new job memcached.service/restart as 276141
Sep 29 13:58:23 mail systemd[1]: memcached.service: Enqueued job memcached.service/restart as 276141
Sep 29 13:58:23 mail systemd[1]: Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=o error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=org.freedesktop.systemd1 destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=JobNew cookie=2 reply_cookie=0 signature=uos error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=JobNew cookie=54848 reply_cookie=0 signature=uos error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=GetUnit cookie=2 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=3 reply_cookie=2 signature=o error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: memcached.service: Job memcached.service/restart finished, result=done
Sep 29 13:58:23 mail systemd[1]: memcached.service: Converting job memcached.service/restart -> memcached.service/start
Sep 29 13:58:23 mail systemd[1]: memcached.service: Failed to set blkio.weight: No such file or directory
Sep 29 13:58:23 mail systemd[1]: Detaching egress BPF program from cgroup failed: No such file or directory
Sep 29 13:58:23 mail systemd[1]: memcached.service: Passing 0 fds to service
Sep 29 13:58:23 mail systemd[1]: memcached.service: About to execute: /usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached.conf
Sep 29 13:58:23 mail systemd[1]: memcached.service: Forked /usr/share/memcached/scripts/systemd-memcached-wrapper as 23304
Sep 29 13:58:23 mail systemd[1]: memcached.service: Changed failed -> running
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=org.freedesktop.systemd1 destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=4 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54849 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: memcached.service: Job memcached.service/start finished, result=done
Sep 29 13:58:23 mail systemd[1]: Started memcached daemon.
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=org.freedesktop.systemd1 destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=JobRemoved cookie=5 reply_cookie=0 signature=uoss error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=JobRemoved cookie=54850 reply_cookie=0 signature=uoss error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=org.freedesktop.systemd1 destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=6 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=org.freedesktop.systemd1 destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=7 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54851 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54852 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: systemd-journald.service: Got notification message from PID 450 (FDSTORE=1)
Sep 29 13:58:23 mail systemd[1]: systemd-journald.service: Added fd 20 (n/a) to fd store.
Sep 29 13:58:23 mail systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=Get cookie=3 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=8 reply_cookie=3 signature=v error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state RUNNING → CLOSING
Sep 29 13:58:23 mail systemd[1]: Bus n/a: changing state CLOSING → CLOSED
Sep 29 13:58:23 mail systemd[1]: Got disconnect on private connection.
Sep 29 13:58:23 mail systemd[23304]: /sys/fs/cgroup is duplicate.
Sep 29 13:58:23 mail systemd[23304]: /sys/fs/cgroup is redundant by /sys
Sep 29 13:58:23 mail systemd[23304]: /sys/kernel/debug is redundant by /sys
Sep 29 13:58:23 mail systemd[23304]: /sys/kernel/tracing is redundant by /sys
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /bin → /bin.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /bin
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /bin to /bin
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /boot → /boot.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /boot
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /dev → /dev.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /dev
Sep 29 13:58:23 mail systemd[23304]: Failed to umount /dev: Device or resource busy
Sep 29 13:58:23 mail systemd[23304]: Successfully unmounted /dev/pts
Sep 29 13:58:23 mail systemd[23304]: Failed to umount /dev: Device or resource busy
Sep 29 13:58:23 mail systemd[23304]: Successfully unmounted /dev/shm
Sep 29 13:58:23 mail systemd[23304]: Failed to umount /dev: Device or resource busy
Sep 29 13:58:23 mail systemd[23304]: Successfully unmounted /dev/mqueue
Sep 29 13:58:23 mail systemd[23304]: Failed to umount /dev: Device or resource busy
Sep 29 13:58:23 mail systemd[23304]: Successfully unmounted /dev/hugepages
Sep 29 13:58:23 mail systemd[23304]: Successfully unmounted /dev
Sep 29 13:58:23 mail systemd[23304]: Path /efi does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /etc → /etc.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /etc
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /etc to /etc
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /lib → /lib.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /lib
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /lib to /lib
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /lib/modules → /lib/modules.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /lib/modules
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /run/systemd/inaccessible/dir to /lib/modules
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /lib64 → /lib64.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /lib64
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /lib64 to /lib64
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/acpi → /proc/acpi.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/acpi
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/acpi to /proc/acpi
Sep 29 13:58:23 mail systemd[23304]: Path /proc/apm does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Path /proc/asound does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/bus → /proc/bus.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/bus
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/bus to /proc/bus
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/fs → /proc/fs.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/fs
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/fs to /proc/fs
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/irq → /proc/irq.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/irq
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/irq to /proc/irq
Sep 29 13:58:23 mail systemd[23304]: Path /proc/latency_stats does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/mtrr → /proc/mtrr.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/mtrr
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/mtrr to /proc/mtrr
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/sys → /proc/sys.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/sys
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/sys to /proc/sys
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /proc/sysrq-trigger → /proc/sysrq-trigger.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /proc/sysrq-trigger
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /proc/sysrq-trigger to /proc/sysrq-trigger
Sep 29 13:58:23 mail systemd[23304]: Path /proc/timer_stats does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /sbin → /sbin.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /sbin
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /sbin to /sbin
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /sys → /sys.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /sys
Sep 29 13:58:23 mail systemd[23304]: Path /sys/fs/selinux does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /tmp → /var/tmp.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /var/tmp
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /tmp/systemd-private-c6154307c03945e792ddb202b487b400-memcached.service-1yoPns/tmp to /var/tmp
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /usr → /usr.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /usr
Sep 29 13:58:23 mail systemd[23304]: Successfully mounted /usr to /usr
Sep 29 13:58:23 mail systemd[23304]: Path /usr/lib/modules does not exist, ignoring.
Sep 29 13:58:23 mail systemd[23304]: Followed symlinks /var/tmp → /var/tmp.
Sep 29 13:58:23 mail systemd[23304]: Applying namespace mount on /var/tmp
Sep 29 13:58:23 mail systemd[23304]: Failed to mount /var/tmp/systemd-private-c6154307c03945e792ddb202b487b400-memcached.service-eecRNh/tmp to /var/tmp: No such file or directory
Sep 29 13:58:23 mail systemd[23304]: memcached.service: Failed to set up mount namespacing: No such file or directory
Sep 29 13:58:23 mail systemd[23304]: memcached.service: Failed at step NAMESPACE spawning /usr/share/memcached/scripts/systemd-memcached-wrapper: No such file or directory
Sep 29 13:58:23 mail systemd[1]: systemd-journald.service: Received EPOLLHUP on stored fd 20 (stored), closing.
Sep 29 13:58:23 mail systemd[1]: Received SIGCHLD from PID 23304 ((-wrapper)).
Sep 29 13:58:23 mail systemd[1]: Child 23304 ((-wrapper)) died (code=exited, status=226/NAMESPACE)
Sep 29 13:58:23 mail systemd[1]: memcached.service: Child 23304 belongs to memcached.service.
Sep 29 13:58:23 mail systemd[1]: memcached.service: Can't open PID file /var/run/memcached/memcached.pid (yet?) after running: No such file or directory
Sep 29 13:58:23 mail systemd[1]: memcached.service: Main process exited, code=exited, status=226/NAMESPACE
Sep 29 13:58:23 mail systemd[1]: memcached.service: Failed with result 'exit-code'.
Sep 29 13:58:23 mail systemd[1]: memcached.service: Changed running -> failed
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54853 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: memcached.service: Unit entered failed state.
Sep 29 13:58:23 mail systemd[1]: memcached.service: Changed failed -> auto-restart
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54854 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Spawning thread to nuke /tmp/systemd-private-c6154307c03945e792ddb202b487b400-memcached.service-1yoPns
Sep 29 13:58:23 mail systemd[1]: Spawning thread to nuke /var/tmp/systemd-private-c6154307c03945e792ddb202b487b400-memcached.service-eecRNh
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54855 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54856 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: memcached.service: Service hold-off time over, scheduling restart.
Sep 29 13:58:23 mail systemd[1]: memcached.service: Trying to enqueue job memcached.service/restart/replace
Sep 29 13:58:23 mail systemd[1]: memcached.service: Installed new job memcached.service/restart as 276238
Sep 29 13:58:23 mail systemd[1]: memcached.service: Enqueued job memcached.service/restart as 276238
Sep 29 13:58:23 mail systemd[1]: memcached.service: Scheduled restart job, restart counter is at 1.
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54857 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54858 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=JobNew cookie=54859 reply_cookie=0 signature=uos error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: memcached.service: Changed auto-restart -> dead
Sep 29 13:58:23 mail systemd[1]: memcached.service: Job memcached.service/restart finished, result=done
Sep 29 13:58:23 mail systemd[1]: Stopped memcached daemon.
Sep 29 13:58:23 mail systemd[1]: memcached.service: Converting job memcached.service/restart -> memcached.service/start
Sep 29 13:58:23 mail systemd[1]: memcached.service: Failed to set blkio.weight: No such file or directory
Sep 29 13:58:23 mail systemd[1]: memcached.service: Passing 0 fds to service
Sep 29 13:58:23 mail systemd[1]: memcached.service: About to execute: /usr/share/memcached/scripts/systemd-memcached-wrapper /etc/memcached.conf
Sep 29 13:58:23 mail systemd[1]: memcached.service: Forked /usr/share/memcached/scripts/systemd-memcached-wrapper as 23325
Sep 29 13:58:23 mail systemd[1]: memcached.service: Changed dead -> running
Sep 29 13:58:23 mail systemd[1]: memcached.service: Job memcached.service/start finished, result=done
Sep 29 13:58:23 mail systemd[1]: Started memcached daemon.
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=JobRemoved cookie=54860 reply_cookie=0 signature=uoss error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54861 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Sep 29 13:58:23 mail systemd[1]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/systemd1/unit/memcached_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=54862 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a

我希望我没有错,但我猜相关的错误消息是:

Sep 29 13:58:23 mail systemd[23304]: Failed to mount /var/tmp/systemd-private-c6154307c03945e792ddb202b487b400-memcached.service-eecRNh/tmp to /var/tmp: No such file or directory
Sep 29 13:58:23 mail systemd[23304]: memcached.service: Failed to set up mount namespacing: No such file or directory
Sep 29 13:58:23 mail systemd[23304]: memcached.service: Failed at step NAMESPACE spawning /usr/share/memcached/scripts/systemd-memcached-wrapper: No such file or directory

如果我从/var/tmp/列出任何文件/文件夹,没有一个看起来像上面的路径:

# ls -lad /var/tmp/systemd-private-*
drwx------ 3 root root 4096 Aug 11 20:57 /var/tmp/systemd-private-c6154307c03945e792ddb202b487b400-systemd-resolved.service-3zZdcP
drwx------ 3 root root 4096 Aug 11 20:57 /var/tmp/systemd-private-c6154307c03945e792ddb202b487b400-systemd-resolved.service-zlhKMB

但是看到这样的日志消息也很奇怪,systemd试图将/var/tmp/var/tmp/systemd-private-c6154307c03945e792ddb202b487b400-memcached.service-eecRNh/tmp)的子文件夹装入父文件夹/var/tmp
同样,文件/usr/share/memcached/scripts/systemd-memcached-wrapper存在:

# ls -la /usr/share/memcached/scripts/systemd-memcached-wrapper
-rwxr-xr-x 1 root root 1423 Sep  5  2019 /usr/share/memcached/scripts/systemd-memcached-wrapper

您以前是否遇到过此问题,可能是使用其他Linux systemd服务?如果是的话,你是怎么解决这个问题的?
关于上述例外情况,例如以这些奇怪的方式挂载命名空间文件夹,你知道为什么会发生这种情况吗?

bd1hkmkf

bd1hkmkf1#

我刚想起我在Apache2服务上也有类似的问题,所以我这样修复了它:

# cat << EOF > /etc/systemd/system/memcached.service.d/fix-namespace-error.conf 
[Service]
PrivateTmp=false
NoNewPrivileges=yes
EOF

systemctl daemon-reload
service memcached restart

相关问题