我正在以只读模式完成 Raspberry Pi 的设置,cups 服务似乎是最后一个给我带来问题的事情。
当 cups 将配置写入 /etc 时,我决定将 /etc/cups 挂载为覆盖系统:
$ mount
...
overlay on /etc/cups type overlay (rw,relatime,lowerdir=/etc/cups_org,upperdir=/etc/cups_rw/upper,workdir=/etc/cups_rw/work)
...
cups 服务成功启动,我能够访问 localhost:631 页面,但是转到 /admin 子页面会导致“内部服务器错误”,并且 /printer 子页面显示:无法获取打印机列表:错误的文件描述符。
在服务启动期间我在日志中看到:
E [03/Sep/2016:17:17:13 +0200] Unable to communicate with avahi-daemon: Daemon not running
当 avahi 守护进程处于活动状态并正在运行时
访问 /admin 子页面时,日志显示:
D [03/Sep/2016:18:22:39 +0200] [CGI] Started /usr/lib/cups/cgi-bin/admin.cgi (PID 5367)
I [03/Sep/2016:18:22:39 +0200] [Client 13] Started "/usr/lib/cups/cgi-bin/admin.cgi" (pid=5367)
D [03/Sep/2016:18:22:39 +0200] [Client 13] file=14
D [03/Sep/2016:18:22:39 +0200] [Client 13] Waiting for CGI data.
D [03/Sep/2016:18:22:39 +0200] Report: clients=1
D [03/Sep/2016:18:22:39 +0200] Report: jobs=0
D [03/Sep/2016:18:22:39 +0200] Report: jobs-active=0
D [03/Sep/2016:18:22:39 +0200] Report: printers=1
D [03/Sep/2016:18:22:39 +0200] Report: stringpool-string-count=654
D [03/Sep/2016:18:22:39 +0200] Report: stringpool-alloc-bytes=6392
D [03/Sep/2016:18:22:39 +0200] Report: stringpool-total-bytes=11720
D [03/Sep/2016:18:22:39 +0200] cupsd is not idle any more, canceling shutdown.
D [03/Sep/2016:18:22:39 +0200] [CGI] admin.cgi started...
D [03/Sep/2016:18:22:39 +0200] cupsd is not idle any more, canceling shutdown.
E [03/Sep/2016:18:22:39 +0200] [CGI] Unable to connect to cupsd: Bad file descriptor
E [03/Sep/2016:18:22:39 +0200] [CGI] Unable to connect to cupsd: Bad file descriptor
D [03/Sep/2016:18:22:39 +0200] [CGI] cupsServer()="/var/run/cups/cups.sock"
D [03/Sep/2016:18:22:39 +0200] [CGI] ippPort()=631
D [03/Sep/2016:18:22:39 +0200] cupsd is not idle any more, canceling shutdown.
D [03/Sep/2016:18:22:39 +0200] [CGI] cupsEncryption()=0
D [03/Sep/2016:18:22:39 +0200] cupsd is not idle any more, canceling shutdown.
D [03/Sep/2016:18:22:39 +0200] [Client 13] CGI data ready to be sent.
D [03/Sep/2016:18:22:39 +0200] PID 5367 (/usr/lib/cups/cgi-bin/admin.cgi) stopped with status 1.
但是,当我停止服务并手动运行程序时:
/usr/sbin/cupsd -f
问题根本不会发生。日志显示:
D [03/Sep/2016:18:25:33 +0200] Avahi server connection now available, registering printers for Bonjour broadcasting.
我可以访问 /admin (以及所有其他子页面):
D [03/Sep/2016:18:25:36 +0200] [CGI] Started /usr/lib/cups/cgi-bin/admin.cgi (PID 6269)
I [03/Sep/2016:18:25:36 +0200] [Client 17] Started "/usr/lib/cups/cgi-bin/admin.cgi" (pid=6269)
D [03/Sep/2016:18:25:36 +0200] [Client 17] file=18
D [03/Sep/2016:18:25:36 +0200] [Client 17] Waiting for CGI data.
D [03/Sep/2016:18:25:36 +0200] cupsd is not idle any more, canceling shutdown.
D [03/Sep/2016:18:25:36 +0200] [CGI] admin.cgi started...
D [03/Sep/2016:18:25:36 +0200] cupsd is not idle any more, canceling shutdown.
D [03/Sep/2016:18:25:36 +0200] [Client 19] Accepted from localhost (Domain)
D [03/Sep/2016:18:25:36 +0200] [Client 19] Waiting for request.
D [03/Sep/2016:18:25:36 +0200] [CGI] http=0x554e9db8
D [03/Sep/2016:18:25:36 +0200] [CGI] cgiSetVariable: SECTION="admin"
D [03/Sep/2016:18:25:36 +0200] [CGI] cgiSetVariable: REFRESH_PAGE=""
D [03/Sep/2016:18:25:36 +0200] cupsd is not idle any more, canceling shutdown.
D [03/Sep/2016:18:25:36 +0200] [CGI] org.cups.sid cookie is "72b5efbcd72416115613b87b329ce911"
D [03/Sep/2016:18:25:36 +0200] [CGI] No form data, showing main menu...
关于此行为的原因是什么以及如何解决问题(更改 cups.service 文件中的配置?)或至少进一步推进此故障排除的任何提示?
答案1
我遇到了类似的问题,对我有帮助的是我编辑了文件:/usr/lib/systemd/system/org.cups.cupsd.service
[Unit]
Description=CUPS Scheduler
Documentation=man:cupsd(8)
After=network.target
[Service]
ExecStart=/usr/bin/cupsd -f
[Install]
Also=org.cups.cupsd.socket org.cups.cupsd.path
WantedBy=printer.target
root
并按以下方式重新启动服务sudo
:
# systemctl daemon-reload
# systemctl restart org.cups.cupsd