Установка cups
Устанавливаем cups
:
$ sudo pacman -S cups
Запускаем и добавляем в автозапуск:
[simterm]
$ systemctl start org.cups.cupsd.service $ systemctl enable org.cups.cupsd.service
[/simterm]
Проверяем — переходим на страницу http://localhost:631:
Файл настроек — /etc/cups/cups-files.conf
.
Добавляем группу:
[simterm]
$ sudo groupadd printadmin
[/simterm]
Пользователя в неё:
[simterm]
$ sudo usermod -a -G printadmin $USER
[/simterm]
Обновляем /etc/cups/cups-files.conf
, меняем группу sys
на printadmin
:
... # Administrator user group, used to match @SYSTEM in cupsd.conf policy rules... # This cannot contain the Group value for security reasons... SystemGroup printadmin root ...
Перезапускаем сервис:
[simterm]
$ systemctl restart org.cups.cupsd
[/simterm]
Доступные в cups
бекенды для подключения принтера:
[simterm]
$ ls -1 /usr/lib/cups/backend/ beh cups-brf dnssd driverless http https implicitclass ipp ipps lpd parallel serial smb snmp socket usb vnc
[/simterm]
Все утилиты cups
— тут>>>.
Поиск принтера в сети
Используем avahi
.
Запускаем сервис:
[simterm]
$ systemctl start avahi-daemon.service $ systemctl enable avahi-daemon.service
[/simterm]
У нас принтер HP P1606dn, ищем:
[simterm]
$ avahi-browse -a | grep Printer + enp0s25 IPv6 PRINT-KONICA Black @ CIKN3G8WNL Secure Internet Printer local + enp0s25 IPv4 PRINT-KONICA Black @ CIKN3G8WNL Secure Internet Printer local + enp0s25 IPv6 HP LaserJet Professional P1606dn UNIX Printer local + enp0s25 IPv4 HP LaserJet Professional P1606dn UNIX Printer local + enp0s25 IPv6 HP LaserJet Professional P1606dn Internet Printer local ...
[/simterm]
Находим его DNS имя:
[simterm]
$ lpinfo -l -v ... Device: uri = ipp://CIKPRINTER.local:631/printers/Laserjet class = network info = Hewlett-Packard HP LaserJet Professional P1606dn (driverless) make-and-model = Hewlett-Packard HP LaserJet Professional P1606dn device-id = MFG:Hewlett-Packard;MDL:HP LaserJet Professional P1606dn;CMD:PCLM,AppleRaster,URF; location =
[/simterm]
Резолвим его в IP:
[simterm]
$ avahi-resolve —name CIKPRINTER.local
CIKPRINTER.local 10.11.100.129
[/simterm]
Теперь — можно его подключить через веб-интерфейс cups
, или использовать hplib
. С cups
у меня не получилось — не нашёлся ppd файл, а вот с htplib
— заработало (правда — тоже не с первого раза).
Установка принтера с hplip
Устанавливаем hplip
:
[simterm]
$ sudo pacman -S hplip
[/simterm]
Устанавливаем принтер:
[simterm]
$ sudo hp-setup -i ... Num Connection Description Type -------- ---------- ---------------------------------------------------------- 0* usb Universal Serial Bus (USB) 1 net Network/Ethernet/Wireless (direct connection or JetDirect) 2 par Parallel Port (LPT:) Enter number 0...2 for connection type (q=quit, enter=usb*) ? 1 Using connection type: net Setting up device: hp:/net/HP_LaserJet_Professional_P1606dn?ip=10.11.100.129 ... Option Description ---------- -------------------------------------------------- d Download plug-in from HP (recommended) p Specify a path to the plug-in (advanced) q Quit hp-plugin (skip installation) Enter option (d=download*, p=specify path, q=quit) ? d ... Receiving digital keys: /usr/bin/gpg --homedir /root/.hplip/.gnupg --no-permission-warning --keyserver pgp.mit.edu --recv-keys 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9 error: Unable to recieve key from keyserver Do you still want to install the plug-in? (y=yes, n=no*, q=quit) ? y ... Please enter a name for this print queue (m=use model name:'HP_LaserJet_Professional_P1606dn'*, q=quit) ?m Using queue name: HP_LaserJet_Professional_P1606dn Locating PPD file... Please wait. Found PPD file: drv:///hp/hpcups.drv/hp-laserjet_professional_p1606dn.ppd Description: Note: The model number may vary slightly from the actual model number on the device. Does this PPD file appear to be the correct one (y=yes*, n=no, q=quit) ? y Enter a location description for this printer (q=quit) ? Enter additonal information or notes for this printer (q=quit) ? Adding print queue to CUPS: Device URI: hp:/net/HP_LaserJet_Professional_P1606dn?ip=10.11.100.129 Queue name: HP_LaserJet_Professional_P1606dn PPD file: drv:///hp/hpcups.drv/hp-laserjet_professional_p1606dn.ppd ... Would you like to print a test page (y=yes*, n=no, q=quit) ? y ... Created directory: /var/net-snmp Created directory: /var/net-snmp/mib_indexes Printing test page to printer HP_LaserJet_Professional_P1606dn... Test page has been sent to printer.
[/simterm]
Проверяем:
Но печать не идёт — «Filter failed«:
Проверяем лог /var/log/cups/error_log
:
D [08/Dec/2017:11:49:50 +0200] [Job 4] Start rendering…
D [08/Dec/2017:11:49:50 +0200] [Job 4] Set job-printer-state-message to «Start rendering…», current level=INFO
D [08/Dec/2017:11:49:50 +0200] [Job 4] Processing page 1…
D [08/Dec/2017:11:49:50 +0200] [Job 4] Set job-printer-state-message to «Processing page 1…», current level=INFO
D [08/Dec/2017:11:49:50 +0200] [Job 4] STATE: +connecting-to-device
D [08/Dec/2017:11:49:50 +0200] [Job 4] STATE: +hplip.plugin-error
D [08/Dec/2017:11:49:50 +0200] [Job 4] prnt/hpcups/HPCupsFilter.cpp 486: m_Job initialization failed with error = 48
D [08/Dec/2017:11:49:50 +0200] [Job 4] *** Error in `HP_LaserJet_Professional_P1606dn\’: free(): invalid pointer: 0x000055c586612c44 ***
D [08/Dec/2017:11:49:50 +0200] [Job 4] STATE: -connecting-to-device
D [08/Dec/2017:11:49:50 +0200] [Job 4] STATE: -media-empty-error,media-jam-error,hplip.plugin-error,cover-open-error,toner-empty-error,other
И в journalctl
:
Dec 08 12:21:22 setevoy-arch-work hpcups[9375]: common/utils.c 69: unable to open /var/lib/hp/hplip.state: No such file or directory
Dec 08 12:21:22 setevoy-arch-work hpcups[9375]: common/utils.c 119: validate_plugin_version() Failed to get Plugin version from [/var/lib/hp/hplip.state]
Dec 08 12:21:22 setevoy-arch-work systemd[1]: Started Process Core Dump (PID 9380/UID 0).
Dec 08 12:21:22 setevoy-arch-work hpcups[9375]: common/utils.c 157: Plugin version is not matching
Dec 08 12:21:22 setevoy-arch-work hpcups[9375]: prnt/hpcups/HPCupsFilter.cpp 486: m_Job initialization failed with error = 48
Dec 08 12:21:22 setevoy-arch-work hpcups[9375]: common/utils.c 220: Invalid Library hanlder pLibHandler = NULL.
Dec 08 12:21:23 setevoy-arch-work systemd-coredump[9381]: Process 9375 (hpcups) of user 2 dumped core.
Печаль 🙁
Dec 08 12:21:22 setevoy-arch-work hpcups[9375]: common/utils.c 157: Plugin version is not matching
А это что?
Устанавливаем плагин:
[simterm]
$ yaourt -S hplip-plugin
[/simterm]
Запускаем ещё раз печать, и — вуаля: