我有 Ubuntu 16.04,到目前为止一切正常。
从第一天起它就一直打印完美,但有一天我收到了一个错误,我愚蠢地没有记下来,也没有去查看/var/log/syslog
。
错误是由于 cups 目录丢失。此时我还没有弄乱任何配置,它自己就坏了。
我认为,与其手动创建丢失的东西,不如通过删除并重新安装软件来修复它。
我删除并重新安装了 HP 的打印软件“hplip”和“cups”。这似乎彻底毁掉了 cups。它再也无法启动了。
以下是启动命令之前和之后的systemctl status
输出: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 Sun 2016-11-06 10:06:50 GMT; 55min ago
Docs: man:cupsd(8)
Process: 1029 ExecStart=/usr/sbin/cupsd -l (code=exited, status=1/FAILURE)
Main PID: 1029 (code=exited, status=1/FAILURE)
Nov 06 10:06:50 vw-desk2 systemd[1]: Started CUPS Scheduler.
Nov 06 10:06:50 vw-desk2 systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Nov 06 10:06:50 vw-desk2 systemd[1]: cups.service: Unit entered failed state.
Nov 06 10:06:50 vw-desk2 systemd[1]: cups.service: Failed with result 'exit-code'.
Nov 06 10:06:50 vw-desk2 systemd[1]: cups.service: Start request repeated too quickly.
Nov 06 10:06:50 vw-desk2 systemd[1]: Failed to start CUPS Scheduler.
Nov 06 10:06:52 vw-desk2 systemd[1]: cups.service: Start request repeated too quickly.
Nov 06 10:06:52 vw-desk2 systemd[1]: Failed to start CUPS Scheduler.
vince@vw-desk2:~$
vince@vw-desk2:~$ systemctl start cups
vince@vw-desk2:~$
vince@vw-desk2:~$ systemctl status cups
cups.service - CUPS Scheduler
Loaded: loaded (/lib/systemd/system/cups.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2016-11-06 11:03:42 GMT; 24s ago
Docs: man:cupsd(8)
Process: 3664 ExecStart=/usr/sbin/cupsd -l (code=exited, status=1/FAILURE)
Main PID: 3664 (code=exited, status=1/FAILURE)
Nov 06 11:03:42 vw-desk2 systemd[1]: Started CUPS Scheduler.
Nov 06 11:03:42 vw-desk2 systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Nov 06 11:03:42 vw-desk2 systemd[1]: cups.service: Unit entered failed state.
Nov 06 11:03:42 vw-desk2 systemd[1]: cups.service: Failed with result 'exit-code'.
/var/log/syslog
没有说出任何让我印象深刻的话:
Nov 6 10:11:54 vw-desk2 anacron[786]: Job `cron.daily' terminated
Nov 6 10:11:54 vw-desk2 anacron[786]: Normal exit (1 job run)
Nov 6 10:17:01 vw-desk2 CRON[3371]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 6 10:19:11 vw-desk2 AptDaemon: INFO: Quitting due to inactivity
Nov 6 10:19:11 vw-desk2 AptDaemon: INFO: Quitting was requested
Nov 6 10:19:11 vw-desk2 org.debian.apt[843]: 10:19:11 AptDaemon [INFO]: Quitting due to inactivity
Nov 6 10:19:11 vw-desk2 org.debian.apt[843]: 10:19:11 AptDaemon [INFO]: Quitting was requested
Nov 6 10:21:52 vw-desk2 systemd[1]: Starting Cleanup of Temporary Directories...
Nov 6 10:21:52 vw-desk2 systemd-tmpfiles[3435]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring.
Nov 6 10:21:52 vw-desk2 systemd[1]: Started Cleanup of Temporary Directories.
Nov 6 10:28:01 vw-desk2 CRON[3481]: (root) CMD ( test -x /etc/cron.daily/popularity-contest && /etc/cron.daily/popularity-contest --crond)
Nov 6 10:30:29 vw-desk2 systemd-timesyncd[409]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).
Nov 6 10:30:29 vw-desk2 systemd-timesyncd[409]: Synchronized to time server 91.189.89.198:123 (ntp.ubuntu.com).
Nov 6 11:03:37 vw-desk2 gnome-session[2312]: Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Nov 6 11:03:42 vw-desk2 systemd[1]: Started CUPS Scheduler.
Nov 6 11:03:42 vw-desk2 systemd[1]: cups.service: Main process exited, code=exited, status=1/FAILURE
Nov 6 11:03:42 vw-desk2 systemd[1]: cups.service: Unit entered failed state.
Nov 6 11:03:42 vw-desk2 systemd[1]: cups.service: Failed with result 'exit-code'.
Nov 6 11:03:42 vw-desk2 kernel: [ 3413.846764] audit_printk_skb: 84 callbacks suppressed
Nov 6 11:03:42 vw-desk2 kernel: [ 3413.846767] audit: type=1400 audit(1478430222.644:39): apparmor="DENIED" operation="sendmsg" profile="/usr/sbin/cupsd" name="/run/systemd/journal/socket" pid=3664 comm="cupsd" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
再想想,最后一行看起来一定是相关的。
我怎样才能恢复打印功能?
答案1
我也遇到过这种情况。一直正常工作,然后重新启动,但什么都没有。我在系统日志中发现了几条 apparmor 被拒绝的消息,但没有任何帮助。
然后我发现/etc/cups/cupsd.conf
有人不见了。这就是问题所在。
cups-daemon
你可以把钱包和安装它确实提供了一个默认级别的配置文件,你可以直接复制过去。
sudo cp /usr/share/cups/cupsd.conf.default /etc/cups/cupsd.conf
sudo service cups restart
答案2
systemd 似乎没有提供很多额外的信息。
我不是 cups 专家,但一般的方法是尝试构建一个具有一定完整性的系统,方法是完全卸载 cups 包,然后重新安装并添加打印机