我目前在打印方面非常痛苦,但是我发现一个非常具体的问题,它似乎是我所有其他问题的根源。
CUPS 正在默默地取消共享我的打印机。 我停止 CUPS,手动将 /etc/cups/printers.conf 更改为对每台打印机都显示“共享是”,启动 CUPS,然后在约 2 分钟内重写了 Printers.conf 文件。
我无法解释这种行为。
我尝试使用其他方法(即,而不是直接编辑 Printers.conf)来共享打印机,例如:
cupsctl --share-printers
lpadmin -p SPDIALTO35501 -o printer-is-shared=true
它们似乎根本没有任何效果。
有人能帮帮我吗?我在下面尽可能详细地介绍了我的环境和配置。
lpoptions -p SPDIALTO35501 输出:
auth-info-required=none copies=1 device-uri=lpd://192.168.7.5
finishings=3 job-hold-until=no-hold job-priority=50
job-sheets=none,none marker-change-time=1429565893
marker-colors=#000000,none,none,none,none marker-levels=-1,-1,-1,-1,-1
marker-names='Black\ Toner,,,,Waste\ Toner'
marker-types=toner,unknown,unknown,unknown,wasteToner number-up=1
printer-info=SPDIALTO35501 printer-is-accepting-jobs=true
printer-is-shared=false printer-location
printer-make-and-model='Local Raw Printer'
printer-state=3 printer-state-change-time=1429565893
printer-state-reasons=none printer-type=2228230
printer-uri-supported=ipp://localhost:631/printers/SPDIALTO35501
操作系统:CentOS Linux 版本 6.0(最终版)
CUPS 版本:cups.x86_64 1:1.4.2-35.el6
SElinux 已禁用。
我的cupsd.conf在我看来,这个文件似乎正确,但我得承认我不是专家。它如下:
MaxLogSize 0
LogLevel debug
SystemGroup sys root
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseRemoteProtocols CUPS
BrowseAddress @LOCAL
BrowseLocalProtocols CUPS dnssd
DefaultAuthType Basic
<Location />
# Allow shared printing...
Order allow,deny
Allow all
</Location>
<Location /admin>
Order allow,deny
Allow ALL
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow ALL
</Location>
<Policy default>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy authenticated>
<Limit Create-Job Print-Job Print-URI>
AuthType Default
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
以下是我的 Printers.conf 文件中的示例条目:
<DefaultPrinter SPDIALTO35501>
Info SPDIALTO35501
DeviceURI lpd://192.168.7.5
State Idle
StateTime 1429565893
Type 6
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
Attribute marker-colors \#000000,none,none,none,none
Attribute marker-levels -1,-1,-1,-1,-1
Attribute marker-names Black Toner,,,,Waste Toner
Attribute marker-types toner,unknown,unknown,unknown,wasteToner
Attribute marker-change-time 1429565893
</Printer>
编辑:
有人问我是否检查过日志文件。我检查了,但并没有发现任何对我有意义的东西。以下是 /var/log/cups/error_log 的略微删减版本:
I [21/Apr/2015:11:27:48 -0600] Listening to 0.0.0.0:631 (IPv4)
I [21/Apr/2015:11:27:48 -0600] Listening to :::631 (IPv6)
I [21/Apr/2015:11:27:48 -0600] Listening to /var/run/cups/cups.sock (Domain)
I [21/Apr/2015:11:27:48 -0600] Remote access is enabled.
D [21/Apr/2015:11:27:48 -0600] Added auto ServerAlias vdb2
D [21/Apr/2015:11:27:48 -0600] Added auto ServerAlias localhost6.localdomain6
D [21/Apr/2015:11:27:48 -0600] Added auto ServerAlias localhost6
I [21/Apr/2015:11:27:48 -0600] Loaded configuration file "/etc/cups/cupsd.conf"
I [21/Apr/2015:11:27:48 -0600] Using default TempDir of /var/spool/cups/tmp...
I [21/Apr/2015:11:27:48 -0600] Configured for up to 100 clients.
I [21/Apr/2015:11:27:48 -0600] Allowing up to 100 client connections per host.
I [21/Apr/2015:11:27:48 -0600] Using policy "default" as the default!
I [21/Apr/2015:11:27:48 -0600] Full reload is required.
I [21/Apr/2015:11:27:48 -0600] Loaded MIME database from "/usr/share/cups/mime" and "/etc/cups": 35 types, 41 filters...
[剪辑了其他打印机;它们的行为完全一样]
D [21/Apr/2015:11:27:48 -0600] Loading printer SPDIALTO35501...
D [21/Apr/2015:11:27:48 -0600] cupsdMarkDirty(P-----)
D [21/Apr/2015:11:27:48 -0600] load_ppd: Loading /etc/cups/ppd/SPDIALTO35501.ppd...
D [21/Apr/2015:11:27:48 -0600] cupsdRegisterPrinter(p=0x7f2af8603410(SPDIALTO35501))
D [21/Apr/2015:11:27:48 -0600] cupsdMarkDirty(P-----)
D [21/Apr/2015:11:27:48 -0600] load_ppd: Loading /etc/cups/ppd/SPDIALTO35501.ppd...
D [21/Apr/2015:11:27:48 -0600] cupsdRegisterPrinter(p=0x7f2af8603410(SPDIALTO35501))
I [21/Apr/2015:11:27:48 -0600] Loading job cache file "/var/cache/cups/job.cache"...
D [21/Apr/2015:11:27:48 -0600] [Job 38077] Loading from cache...
[许多作业(例如 500 多个)都是从缓存中加载的]
I [21/Apr/2015:11:27:48 -0600] Full reload complete.
I [21/Apr/2015:11:27:48 -0600] Cleaning out old temporary files in "/var/spool/cups/tmp"...
I [21/Apr/2015:11:27:48 -0600] Listening to 0.0.0.0:631 on fd 7...
I [21/Apr/2015:11:27:48 -0600] Listening to :::631 on fd 8...
I [21/Apr/2015:11:27:48 -0600] Listening to /var/run/cups/cups.sock on fd 9...
I [21/Apr/2015:11:27:48 -0600] Resuming new connection processing...
D [21/Apr/2015:11:27:48 -0600] Discarding unused server-started event...
D [21/Apr/2015:11:27:49 -0600] Report: clients=0
D [21/Apr/2015:11:27:49 -0600] Report: jobs=499
D [21/Apr/2015:11:27:49 -0600] Report: jobs-active=0
D [21/Apr/2015:11:27:49 -0600] Report: printers=18
D [21/Apr/2015:11:27:49 -0600] Report: printers-implicit=0
D [21/Apr/2015:11:27:49 -0600] Report: stringpool-string-count=2343
D [21/Apr/2015:11:27:49 -0600] Report: stringpool-alloc-bytes=7832
D [21/Apr/2015:11:27:49 -0600] Report: stringpool-total-bytes=38128
I [21/Apr/2015:11:28:18 -0600] Saving printers.conf...
D [21/Apr/2015:11:28:18 -0600] cupsdSetBusyState: Not busy
因此,CUPS 似乎正在重建 Printers.conf 文件,但我不知道为什么,也不知道为什么每台打印机的共享状态都被重置。当我首先添加打印机时(通过将新条目粘贴到 Printers.conf 中),CUPS 并没有重建它,因此它似乎不是从其他地方获取打印机列表。它只是真的、真的、真的不想共享。
编辑 #2:我配置了 CUPS 以允许我连接到其 Web 界面,并尝试通过这种方式修改打印机 - 但失败了。我在打印机的共享列中打勾,单击修改,它说修改成功,但打印机仍然未共享。有趣的是,我所做的其他更改(设置位置名称、选择驱动程序类型)确实出现在更新的 Printers.conf 文件中。出于某种原因,它根本不允许共享。