root@gcomputer:~# systemctl status x11-common
● x11-common.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
我尝试过
systemctl unmask x11-common
和 systemctl unmask x11-common.service
,但没有改变任何东西。我应该如何取消掩码?
root@gcomputer:~# systemctl status x11-common
● x11-common.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
systemctl unmask x11-common
和 systemctl unmask x11-common.service
,但没有改变任何东西。/dev/null
的符号链接之外没有现有的单元文件时,unmask
命令似乎会失败。如果你mask
一个服务,那么它会在/etc/systemd/system
中创建一个指向/dev/null
的新符号链接,systemd会在启动时在这个目录中查找要加载的单元文件。在这种情况下,实际上并不存在单元文件。
其他人似乎也遇到了类似的问题
在我的系统上,x11-common.service
也被屏蔽了。你可以像这样修复它:/dev/null
的符号链接。file /lib/systemd/system/x11-common.service
应该返回:
/lib/systemd/system/x11-common.service: symbolic link to /dev/null
sudo rm /lib/systemd/system/x11-common.service
由于您更改了一个单元文件,您需要运行以下命令:
sudo systemctl daemon-reload
systemctl status x11-common
sudo apt-get install --reinstall x11-common
sudo systemctl daemon-reload
systemctl status x11-common
/etc/init.d
中的脚本。/etc/init/
目录下有一个文件...)。你可能想要提一个新问题。我所做的似乎没有明显的区别,只是服务显示为已加载、已启用、已停止(在启动时处于活动状态)(绿色),而不是已加载、已屏蔽、已停止(红色)。我应该阅读我的日志... - Zanna/dev/null
的符号链接,这种情况也会发生吗?你对我的回答是正确的。我会将这个解决方案称为对systemd一个...令人困惑的行为...的一种变通方法。 - Zanna/dev/null
的位置,systemd在那里寻找具有适当名称的单元文件。我认为,在使用所描述的巧妙方法“修复”此类服务后,它将保持修复状态(即加载),而不受systemd更新的影响,但我不能完全确定 - 也许它会创建一个新的bitbucket符号链接,所以我想问问你是否知道。否则,我会在下一次systemd更新后自己检查。如果我说得不清楚,对不起,现在是睡觉时间了! - Zannasystemctl edit systemd-hostnamed
在编辑器中添加以下两行,然后退出(不要忘记在提示时保存):
[Service]
PrivateNetwork=no
这将在以下目录中创建一个带有上述两行的override.conf文件:
/etc/systemd/system/systemd-hostnamed.service.d/
更新systemd:
systemctl daemon-reload
然后重新启动服务:
systemctl restart systemd-hostnamed
hostnamectl
而不会卡住了。$ sudo systemctl status bluetooth.service
● bluetooth.service
Loaded: masked (Reason: Unit bluetooth.service is masked.)
Active: inactive (dead)
$ sudo systemctl unmask bluetooth.service
Removed /etc/systemd/system/bluetooth.service.
$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor preset: e>
Active: inactive (dead)
Docs: man:bluetoothd(8)
$ sudo systemctl start bluetooth.service
$ sudo systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor preset: e>
Active: active (running) since Sat 2022-07-30 08:50:04 +06; 2s ago
Docs: man:bluetoothd(8)
Main PID: 23191 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 9135)
Memory: 1.6M
CGroup: /system.slice/bluetooth.service
└─23191 /usr/lib/bluetooth/bluetoothd
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; masked; vendor preset: enabled)
Drop-In: /etc/systemd/system/redis-server.service.d
└─limit.conf