我正在尝试在 raspbian 11 上创建新的 systemd 服务,但出现以下错误:
sysctl: cannot stat /proc/sys/homeassistant@homeassistant/service: No such file or directory
sysctl: cannot stat /proc/sys/start: No such file or directory
以下是重现我的错误的步骤:
nano /etc/systemd/system/[email protected]
文件内容:
[Unit]
Description=Home Assistant
After=network-online.target mariadb.service
[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/%i/.homeassistant"
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
启用该服务:
sysctl [email protected] enable
我收到的输出:
sysctl: cannot stat /proc/sys/homeassistant@homeassistant/service: No such file or directory
sysctl: cannot stat /proc/sys/start: No such file or directory
答案1
您需要使用该systemctl
命令来启用 systemd 单元(而不是sysctl
用于在运行时修改内核参数)。