我已经在 Ubuntu 18.04 Bionic Beaver 上安装了 CUPS,如下所示
$ sudo apt-get update
$ sudo apt-get install cups
我检查了 CUPS 的状态,它无法启动
$ systemctl status cups
● cups.service - CUPS Scheduler
Loaded: loaded (/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-09-10 16:29:40 EDT; 3s ago
Docs: man:cupsd(8)
Process: 2895 ExecStart=/usr/sbin/cupsd -l (code=exited, status=1/FAILURE)
Main PID: 2895 (code=exited, status=1/FAILURE)
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 5.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: Stopped CUPS Scheduler.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Start request repeated too quickly.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 16:29:40 chrisni-X456UJ systemd[1]: Failed to start CUPS Scheduler.
我编辑了 cupsd.conf,将 LogLevel 从“warn”更改为“debug”。我尝试手动启动 cups,但输出重复出现
$ systemctl start cups
$ systemctl status cups
这是日志,显示的块是重复的。
$ grep cups /var/log/syslog
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 1.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 2.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:36 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 3.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 4.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Service hold-off time over, scheduling restart.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Scheduled restart job, restart counter is at 5.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Start request repeated too quickly.
Sep 10 15:56:37 chrisni-X456UJ systemd[1]: cups.service: Failed with result 'exit-code'.
Sep 10 16:02:15 chrisni-X456UJ systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
有人知道我该如何开始喝杯子吗?
答案1
查看尾部/var/log/cups/error_log
:
X [14/Jul/2020:15:06:38 +0200] No valid Listen or Port lines were found in the configuration file.
确实,配置文件被其他一些设置破坏了,但幸运的是保留了备份:
ll /etc/cups/cupsd.conf*
-rw-r----- 1 root 4571 2020-07-01 19:53 /etc/cups/cupsd.conf.O
-rw-r----- 1 root 22 2020-07-01 19:54 /etc/cups/cupsd.conf
这对我有用(在 Ubuntu 18.04 中),可以恢复cupsd.conf
并重新启动 cups:
sudo -i
cd /etc/cups
cp cupsd.conf.O cupsd.conf
systemctl restart cups
验证方式:
systemctl status cups
答案2
我得到了 system-has-not-been-booted-with-systemd 错误。所以我搜索了错误并转到https://linuxhandbook.com/system-has-not-been-booted-with-systemd/.因此systemctl 重启 cups我用了 服务杯重启。然后我检查了服务杯状态。 都好。