按照概述的程序这里,当我运行命令时,sudo systemctl start wsdd
响应是Job for wsdd.service failed because of unavailable resources or another system error. See "systemctl status wsdd.service" and "journalctl -xe" for details.
因此我检查了 journalctl,其中有以下内容:
Sep 07 19:40:35 kathy-Inspiron-3521 systemd[1]: wsdd.service: Failed to load environment files: No such file or directory
Sep 07 19:40:35 kathy-Inspiron-3521 systemd[1]: wsdd.service: Failed to run 'start' task: No such file or directory
Sep 07 19:40:35 kathy-Inspiron-3521 systemd[1]: wsdd.service: Failed with result 'resources'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit wsdd.service has entered the 'failed' state with result 'resources'.
Sep 07 19:40:35 kathy-Inspiron-3521 systemd[1]: Failed to start Web Services Dynamic Discovery host daemon.
-- Subject: A start job for unit wsdd.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit wsdd.service has finished with a failure.
--
-- The job identifier is 187013 and the job result is failed.
然后我跑过去systemctl status wsdd.service
看到了这个:
wsdd.service - Web Services Dynamic Discovery host daemon
Loaded: loaded (/etc/systemd/system/wsdd.service; disabled; vendor preset: enabled)
Active: failed (Result: resources)
Docs: man:wsdd(8)
Sep 07 19:18:27 kathy-Inspiron-3521 systemd[1]: wsdd.service: Failed to load environment files: No such file or directory
Sep 07 19:18:27 kathy-Inspiron-3521 systemd[1]: wsdd.service: Failed to run 'start' task: No such file or directory
Sep 07 19:18:27 kathy-Inspiron-3521 systemd[1]: wsdd.service: Failed with result 'resources'.
Sep 07 19:18:27 kathy-Inspiron-3521 systemd[1]: Failed to start Web Services Dynamic Discovery host daemon.
你要去哪里?请提供建议。
答案1
对于这个错误:
wsdd.service:无法加载环境文件:没有此文件或目录
使用此解决方案:
sudo touch /etc/default/wsdd
因为缺少一个环境变量,您可以在这里看到 /etc/systemd/system/wsdd.service
环境文件=/etc/default/wsdd
答案2
嘿 Kathy (我想是的,哈哈)
因此,我按照类似的指南操作,但遇到了完全相同的错误。我也从评论中找到了解决方案。
我关注的是这里:https://devanswers.co/discover-ubuntu-machines-samba-shares-windows-10-network/
因此,默认配置文件 (/etc/systemd/system/wsdd.service) 在某个时候发生了变化。不确定具体是什么,但只需用指南中的示例替换配置文件中的所有内容,就可以解决问题。
我喜欢使用 GUI 编辑器来做这种事,所以“sudo gedit /etc/systemd/system/wsdd.service”应该在 gedit 中打开它。
为了防止将来该指南消失,以下是该代码块包含的内容:
[Unit]
Description=Web Services Dynamic Discovery host daemon
; Start after the network has been configured
After=network-online.target
Wants=network-online.target
; It makes sense to have Samba running when wsdd starts, but is not required
;Wants=smb.service
[Service]
Type=simple
ExecStart=/usr/bin/wsdd --shortlog
; Replace those with an unprivledged user/group that matches your environment,
; like nobody/nogroup or daemon:daemon or a dedicated user for wsdd
; User=nobody
; Group=nobody
; The following lines can be used for a chroot execution of wsdd.
; Also append '--chroot /run/wsdd/chroot' to ExecStart to enable chrooting
;AmbientCapabilities=CAP_SYS_CHROOT
;ExecStartPre=/usr/bin/install -d -o nobody -g nobody -m 0700 /run/wsdd/chroot
;ExecStopPost=rmdir /run/wsdd/chroot
[Install]
WantedBy=multi-user.target