{{tag>Brouillon Imprimante Matériel SNMP}} # Notes imprimante sous GNU/Linux Voir : * https://linuxfr.org/news/imprimantes-et-libertes * * * http://www.turrier.fr/articles/raspbian-imprimante/raspbian-hp-deskjet-3630.php * `system-config-printer` Voir aussi : * [CISS](https://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27alimentation_continue_en_encre) Si jamais CUPS n'est pas installé sur votre machine, installer les paquets cups et cups-client cups-bsd. Pour une imprimante HP il faut le paquet `hplip` (CUPS à besoin de /usr/lib/cups/backend/hp) Pour configurer une imprimante : \ Voir ~~~bash lsmod | grep usblp ~~~ Il se peut que l'imprimante ne soit pas reconnue dans l'interface de Cups (imprimantes locales). Ceci est dû au fait que le noyau cré un composant qui se trouve dans /dev/usb/lp0. Une règles udev résout ce problème et permet de faire un lien symbolique /dev/lp0 -> /dev/usb/lp0. `/var/log/cups/` ## Ajout imprimante en ligne de commande Exemple imprimante Zebra (langage ZPL) Install paquets ~~~bash apt-get install cups #lprng apt-get install cups-bsd # ou apt-get install lpr ~~~ Lister toutes les imprimantes connectées ~~~bash lpinfo -v ~~~ L'imprimante connectées en USB apparait ~~~ network ipp network http network lpd serial serial:/dev/ttyS0?baud=115200 serial serial:/dev/ttyS1?baud=115200 serial serial:/dev/ttyS2?baud=115200 serial serial:/dev/ttyS3?baud=115200 network ipps network socket network https network ipp14 direct usb://Zebra%20Technologies/ZTC%20GK420d?serial=28J162400192 network smb ~~~ Ajout de l'imprimante ~~~bash lpadmin -p GK420D -v usb://Zebra%20Technologies/ZTC%20GK420d?serial=28J162400192 -E ~~~ Ou ~~~bash chown root:lp /etc/cups/ppd/GK420d.ppd chmod 640 /etc/cups/ppd/GK420d.ppd lpadmin -p GK420D -v usb://Zebra%20Technologies/ZTC%20GK420d?serial=28J162400192 -m /usr/share/cups/model/HP/DeskJet_882C-cdj880.ppd ~~~ Vérif ~~~bash lpstat -p ~~~ ~~~ printer GK420D is idle. enabled since Thu 04 May 2017 04:32:45 PM CEST ~~~ Impression ~~~bash lp -d GK420D -o raw plop.zpl ~~~ Vérifier que l'impression est terminée et OK (Show completed job) ~~~bash lpstat -W completed ~~~ ~~~ GK420D-1 root 3072 Thu 04 May 2017 04:39:38 PM CEST ~~~ Lister toutes les impressions des utilisateurs ~~~bash lpstat -W all -o ~~~ ~~~ GK420D-2 unknown 3072 Thu 04 May 2017 04:55:46 PM CEST GK420D-1 root 3072 Thu 04 May 2017 04:39:38 PM CEST ~~~ La conf est ici `/etc/cups/printers.conf` ~~~ # Printer configuration file for CUPS v1.7.5 # Written by cupsd # DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING UUID urn:uuid:180e7105-f553-341a-6d6d-a8acdc5a89f4 Info GK420D DeviceURI usb://Zebra%20Technologies/ZTC%20GK420d?serial=28J162400192 State Idle StateTime 1493908365 Type 4 Accepting Yes Shared Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 OpPolicy default ErrorPolicy stop-printer ~~~ ### Supprimer une imprimante Lister les imprimantes ~~~bash lpstat -p ~~~ ~~~ printer GK420D is idle. enabled since Tue 09 May 2017 01:12:32 PM CEST printer GK420DD is idle. enabled since Tue 09 May 2017 02:20:21 PM CEST ~~~ Effacement ~~~bash lpadmin -x GK420DD ~~~ ## Réactiver l’imprimante Source : http://superuser.com/questions/280396/how-to-resume-cups-printer-from-command-line ~~~bash lpstat -p ~~~ ~~~ printer DeskJet-3630-series is idle. enabled since mar. 12 juil. 2016 21:21:34 CEST ready to print ~~~ ~~~bash cupsenable DeskJet-3630-series ~~~ ~~~bash lpc status ~~~ ~~~ DeskJet-3630-series: printer is on device 'hp' speed -1 queuing is enabled printing is enabled no entries daemon present ~~~ ## Effacer et annuler toutes les impressions ~~~bash cancel -a $NOM_DE_L_IMPRIMANTE # ou cancel -a -x ~~~ ## Administration Ajouter l'utilisateur dans les groupes lp, lpadmin et sys ? ~~~bash gpasswd -a jean lp gpasswd -a jean lpadmin ~~~ ## Supervision SNMP ~~~bash snmpget -c public -v 1 192.168.1.250 hrPrinterDetectedErrorState.1 ~~~ ## Autres Voir `/etc/printcap` `smb.conf` ~~~ini [global] print command = lpr -r -h -P%p %s ~~~ Try adding the 'sf' option to the printer definition in `/etc/printcap` The 'sf' stands for 'suppress form feeds'. Config client CUPS ~~~bash cat > /etc/cups/client.conf << EOF ServerName 192.168.1.1 EOF ~~~ ## Diag Pb https://forum.linuxchallans.org/topic/262/impression-vide-de-l-attestation-de-d%C3%A9placement-d%C3%A9rogatoire Voir * https://wiki.debian.org/CUPSDebugging * https://wiki.debian.org/CUPSTextToPdfFilter ~~~ $ lp attestation-deplacement-fr.pdf lp: Error - ~/.cups/lpoptions file names default destination that does not exist. $ lpstat -p -d printer HP_DeskJet_3630_series is idle. enabled since mer. 06 mai 2020 19:34:55 CEST no system default destination ~~~ `~/.cups/lpoptions` ~~~ #Default DeskJet-3630-series Default HP_DeskJet_3630_series ~~~ Ou ~~~bash lpoptions -d HP_DeskJet_3630_series ~~~ ~~~bash echo "Hello, world." | lp ~~~ ~~~bash sudo cupsctl --debug-logging #sudo cupsctl --no-debug-logging ~~~ Voir `/var/log/cups/error_log` ~~~bash service cups restart journalctl -u cups.service -f ~~~ HTTP_STATE_WAITING Closing for error 32 (Broken pipe) A tester https://forum.manjaro.org/t/printer-doesnt-work-closing-for-error-32-broken-pipe/40678 ~~~ cat attestation-deplacement-fr.pdf | /usr/lib/cups/filter/pdftopdf 1 1 1 1 ` >out.pdf DEBUG: pdftopdf: No PPD file specified, could not determine whether to log pages or not, so turned off page logging. DEBUG: PDF form flattening command line: pdftocairo -pdf - /tmp/032cf5ea697ad WARNING: temp file: file is damaged WARNING: temp file (object 6 0, offset 85): expected n n obj WARNING: temp file: Attempting to reconstruct cross-reference table WARNING: temp file: object 6 0 not found in file after regenerating cross reference table ~~~ ~~~bash pdftocairo -pdf original.pdf out.pdf ~~~ ## Hp Installer / Reinstaller une imprimante HP ~~~bash hp-setup -i ~~~ `hp-check` est fait pour RedHat. Pas très efficace. ## Pb ### Err invalid deviceid ret=-9: Resource temporarily unavailable Suite à passage de Debian 9 à Debian 10 ~~~ -- Boot b860f46144c6442c86d06b19bc47ea20 -- janv. 21 22:38:57 portable hpfax[131730]: [131730]: error: Failed to create /var/spool/cups/tmp/.hplip janv. 21 22:40:32 portable hp[136572]: io/hpmud/musb.c 770: invalid deviceid ret=-9: Resource temporarily unavailable déc. 28 18:20:35 portable hp[71827]: io/hpmud/musb.c 770: invalid deviceid ret=-9: Resource temporarily unavailable déc. 28 18:20:35 portable hp[71827]: io/hpmud/musb.c 561: released ff/4/1 interface déc. 28 18:20:35 portable hp[71827]: prnt/backend/hp.c 825: INFO: open device failed stat=12: hp:/usb/DeskJet_3630_series?serial=CN5CS2H5YV067P; will retry in 30 secon> déc. 28 18:21:05 portable hp[71827]: io/hpmud/musb.c 427: Found interface conf=0, iface=1, altset=0, index=1 ~~~ #### Solution Pas très clair, à vérif ~~~bash apt-get purge ipp-usb apt-get install cups apt-get reinstall hplip hplip-data hp-setup -i ~~~