Impression

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Printing and the translation is 57% complete.
Outdated translations are marked like this.

Ce document couvre la mise en place et la maintenance des imprimantes en utilisant CUPS et Samba. Il permet une installation locale ainsi qu'une installation en réseau. Il permet aussi d'utiliser des imprimantes partagées depuis d'autres systèmes d'exploitation. Pour des informations à propos de l'utilisation des commandes pl ou lpr pour l'impression de documents, utilisez l'excellente documentation fournie par CUPS.

L'impression et Gentoo Linux

Utilisez les bons outils

Linux offre un bon support des imprimantes. Le meilleur outil pour réaliser des impression est appelé CUPS (Common Unix Printing System). Les procédures d'installation et de maintenance de CUPS se sont grandement facilitées depuis sa création, en 1999.

Ce document explique la mise en place de CUPS pour mettre en place une imprimante locale ou en réseau. Il ne rentrera pas dans les détails car le projet dispose d'une bonne documentation disponible pour une utilisation avancée.

Installation

Noyau

La première chose à connaître lorsqu'on veut installer une imprimante est de savoir comment elle va communiquer avec le système. On peut utiliser un port local comme le LTP ou l'USB ou le réseau. Si on choisit d'utiliser le réseau, il faut savoir si on doit utiliser le Protocole d'Impression depuis Internet (Internet Printing Protocol, IPP) ou le protocole CIFS mis en place par Microsoft Windows (Microsoft Windows Sharing).

Les prochaines parties vont détailler les configurations minimales qui doivent être faites au niveau du noyau pour connecter l'imprimante à Gentoo.

Rendez vous dans /usr/src/linux et lancez la commande make menuconfig pour configurer le noyau. On doit effectuer ces étapes même si le noyau a été compilé grâce à genkernel afin d'être sûr que rien n'a été oublié. Ne comptez pas sur genkernel pour configurer votre noyau en fonction de votre matériel. L'impression est un domaine dans lequel il est très dur d'automatiser la configuration.

Dans les prochains exemples de configuration, le support va être ajouté "dans" le noyau, pas en tant que modules. Il n'est pas nécessaire d'utiliser cette méthode : on peut aisément mettre en place un support modulaire, il faut juste être sûr de charger les modules nécessaires.

Naviguez dans les sections appropriées pour configurer (ou vérifier la configuration) du noyau.

Imprimante connectée localement (LTP)

Le port parallèle est généralement utilisé comme port LTP. Vous devez d'abord activer le support du port parallèle, puis le support du port parallèle "à la manière des PC" (à moins que la machine soit d'architecture SPARC), après cela on peut activer le support du port parallèle pour les imprimantes.

KERNEL Parallel Port Printer Configuration
'"`UNIQ--pre-00000001-QINU`"'
Remarque
Certains utilisateurs pourraient vouloir activer d'autres options dans la section Parallel port support. Utilisez le menu Help> pour plus d'informations.

Et voilà ! Quittez le programme de configuration du noyau et recompilez le noyau.

Nous allons maintenant configurer CUPS.

Imprimante connectée localement (USB)

L'impression par port USB est supportée par CUPS avec l'USB USE flag activé. Le logiciel utilisera alors la bibliothèque libusb pour le support de l'impression par USB.

Le matériel plus ancien pourrait avoir besoin d'un support USB du noyau. Si ce support est compilé en tant que module, il devrait s'appeler usblp :

KERNEL USB Printer support
Symbol: USB_PRINTER [=n]
Type  :tristate
Prompt: USB Printer support
  Location:
    -> Device Drivers
      -> USB support (USB_SUPPORT [=y])
(1)     -> Support for Host-side USB (USB [=y])
  Defined at drivers/usb/class/Kconfig:21
  Depends on: USB_SUPPORT [=y] && USB [=y]

Pourtant, le support d'imprimantes USB du noyau est considéré comme obsolète. Ne l'activez que si il est nécessaire.

Remarque
When using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change the DeviceURI directive in printers.conf and restart the cupsd service:
FILE /etc/cups/printers.confModify DeviceURI
# DeviceURI usb:/dev/usb/lp0  replace this line with
DeviceURI parallel:/dev/usb/lp0

Imprimante fonctionnant à distance (IPP et LPD)

Pour pouvoir se connecter à une imprimante en réseau en utilisant le protocole d'impression internet (Internet Printing Protocol) ou le Line Printer Daemon Protocol, le noyau doit supporter la mise en réseau. Si le noyau supporte déjà cette option, continuez avec CUPS.

Imprimante fonctionnant à distance (CIFS)

Le noyau doit supporter le CIFS :

KERNEL CIFS Printer Configuration
'"`UNIQ--pre-00000008-QINU`"'

Après avoir configuré le CIFS, quittez le programme de configuration et recompilez le noyau. N'oubliez pas de copier le nouveau noyau dans /boot (il faudra peut-être le monter) et de mettre à jour le chargeur d'amorçage avant de redémarrer le système. Vous utiliserez les commandes de la section Configuration de l'imprimante en LTP pour imprimer des fichiers.

Passez à l'étape suivante afin d'installer CUPS.

Options de la variable USE

CUPS dispose de fonctionnalités qui pourraient être intéressantes. Pour activer ou désactiver ces fonctionnalités, utilisez les USE flags qui y sont associés.

USE flags for net-print/cups The Common Unix Printing System

X Add support for X11
acl Add support for Access Control Lists
dbus Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc)
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
kerberos Add kerberos support
openssl Use dev-libs/openssl instead of net-libs/gnutls for TLS support
pam Add support for PAM (Pluggable Authentication Modules) - DANGEROUS to arbitrarily flip
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
ssl Add support for SSL/TLS connections (Secure Socket Layer / Transport Layer Security)
static-libs Build static versions of dynamic libraries as well
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
usb Add USB support to applications that have optional USB support (e.g. cups)
xinetd Add support for the xinetd super-server
zeroconf Support for DNS Service Discovery (DNS-SD)

Pour configurer les USE flags de CUPS sans modifier ceux définis pour les autres logiciels, ajoutez les dans le fichier /etc/portage/package.use.

user $emerge -pv net-print/cups
[ebuild N     ] net-print/cups-1.7.3  USE="X acl dbus pam ssl threads usb -debug -gnutls -java -kerberos -lprng-compat -python (-selinux) -static-libs -systemd -xinetd -zeroconf" ABI_X86="(64) (-32) (-x32)" LINGUAS="ca es fr it ja pt_BR ru" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" 0 kB

Installation

Lorsque la configuration vous satisfait, installez CUPS avec la commande suivante :

root #emerge --ask net-print/cups

Logiciels supplémentaires

Samba

Pour activer le support de SAMBA, il faut installer net-fs/samba avec le support de CUPS. Complétez le fichier /etc/portage/package.use pour activez l'USE flag cups :

FILE /etc/portage/package.useActiver l'USE flag cups pour samba
net-fs/samba cups

Il faut ensuite (ré)installer Samba :

root #emerge --ask --changed-use net-fs/samba

Avahi

CUPS uses Avahi internally when built with the zeroconf USE flag to scan for printers on the local network. To use Avahi hostnames to connect to networked printers, set up .local hostname resolution and restart the CUPS service. CUPS and cups-filters need to be built with the zeroconf USE flag as well. Use the driverless command for listing available printers.

user $driverless list

Configuration

Groupe utilisateur d'impression

Pour pouvoir imprimer, les utilisateurs doivent faire partie du groupe lp :

root #gpasswd -a username lp

Pour pouvoir ajouter des imprimantes et modifier leurs configurations à l'aide de l'interface web de CUPS, l'utilisateur doit être ajouté dans le groupe lpadmin :

root #gpasswd -a username lpadmin

Service

OpenRC

Si l'imprimante est connectée localement et que l'imprimante doit être disponible à chaque démarrage, il faut démarrer le daemon de CUPS lors du démarrage du système. Vérifiez que l'imprimante est connectée et allumée avant de démarrer le daemon.

root #rc-service cupsd start
root #rc-update add cupsd default

systemd

La commande suivante permet de démarrer le daemon de CUPS au démarrage.

root #systemctl start cups.service
root #systemctl enable cups.service

Contrôle par HTTP

Une fois le service démarré, les utilisateurs autorisés peuvent ajouter des imprimantes. L'utilisateur root peut le faire par défaut ainsi que les membres du groupe lpadmin. L'interface de configuration est accessible à l'adresse URL suivante :

http://localhost:631/

Fichiers

Le fichier de configuration par défaut de CUPS se trouvent dans /etc/cups/cupsd.conf. Ils devraient être suffisants pour la plupart des utilisateurs. Certaines personnes pourraient néanmoins avoir besoin de faire des changements dans la configuration de CUPS.

La section suivante couvre des changements qui sont souvent nécessaires :

  • Permettre aux autres systèmes d'utiliser l'imprimante connectée à cette station de travail.
  • Autoriser l'administration de CUPS depuis un autre système.
  • Configurer CUPS pour activer le support du pilote Windows PCL. Cela est conseillé pour les ordinateurs utilisant Windows car il permet d'utiliser une imprimante partagée par SAMBA. En effet, la plupart des pilotes d'imprimantes Windows sont des pilotes PCL.
  • Permettre à ce système d'utiliser une imprimante connectée à un autre système (sans passer par le partage Windows).

Imprimante à accès distant

Pour permettre aux autres systèmes d'utiliser l'imprimante via IPP, il faut l'indiquer dans le fichier /etc/cups/cupsd.conf. Ce changement n'est pas nécessaire si on veut utiliser SAMBA.

Ouvrez le fichier /etc/cups/cupsd.conf dans vôtre éditeur de texte préféré et ajoutez-y la ligne Allow pour le(s) système(s) qui doivent être autorisés à utiliser l'imprimante. Dans l'exemple suivant, l'accès est permis pour l'ordinateur (localhost) et pour les adresses IP qui commencent par 192.168.0.

FILE /etc/cups/cupsd.confPermettre l'accès à distance à l'imprimante
<Location />
  Order allow,deny
  Allow localhost
  Allow from 192.168.0.*
</Location>

Cette ligne permet de diffuser l'information aux clients du réseau : cela permet aux utilisateurs de savoir quand cette imprimante est disponible :

FILE /etc/cups/cupsd.confDiffuser info
BrowseAddress 192.168.0.*:631

Le port d'écoute de CUPS doit aussi être spécifié pour permettre de répondre aux requêtes d'impression envoyées par les autres machines du réseau :

FILE /etc/cups/cupsd.confConfiguration du port
Listen *:631
#Listen localhost:631

The CUPS server reject a hostname or server alias in the HTTP request with "Bad request" message. It works with IP-addresses by default. So if you want to print or browse CUPS interface by using a hostname or domain, add the ServerAlias parameter:

FILE /etc/cups/cupsd.confServer alias configuration
ServerAlias *

Gestion à distance de CUPS

Pour permettre la configuration à distance de CUPS, il faut autoriser d'autres systèmes y accéder. Il faut pour cela éditer le fichier /etc/cups/cupsd.conf et autoriser explicitement l'accès aux autres systèmes. Par exemple, pour autoriser l'accès au un ordinateur ayant pour adresse IP 192.168.0.3 :

FILE /etc/cups/cupsd.confPermettre l'accès à distance
<Location /admin>
(...)
  Encryption Required
  Order allow,deny
  Allow localhost
  Allow 192.168.0.3
</Location>

Il ne faut pas oublier de redémarrer le daemon CUPS après avoir changé la configuration. On peut faire cela en exécutant la commande /etc/init.d/cupsd restart.

Activer le support pour le pilote Windows PCL

Le pilote PCL permet d'envoyer des données à l'état brut au serveur d'impression. Pour activer le support de PCL sur CUPS, il faut éditer le fichier /usr/share/mime/mime.types et décommenter la ligne application/octet-stream si elle n'est pas déjà décommentée. Il faut ensuite faire de même avec le fichier /usr/share/cups/mime/mime.convs.

FILE /usr/share/cups/mime/mime.typesActiver le support pour l'impression de données brutes
application/octet-stream
FILE /usr/share/cups/mime/mime.convs
application/octet-stream     application/vnd.cups-raw    0    -

Il ne faut pas oublier de redémarrer le daemon de CUPS après la modification des fichiers de configurations afin que celle-ci soit prise en compte.

Installer une imprimante distante

Si les imprimantes sont connectées à un serveur utilisant CUPS, le système peut être facilement configuré en modifiant le fichier /etc/cups/client.conf.

En supposant que l'imprimante est connectée à un système appelé printserver.mydomain, il faut modifier le fichier /etc/cups/client.conf pour y inclure la directive ServerName :

FILE /etc/cups/client.conf
# (Remplacez printserver.mydomain avec le nom de votre serveur d'impression)
ServerName printserver.mydomain

Le système distant utilisera de base une imprimante par défaut. Pour changer l'imprimante par défaut, il faut utiliser la commande lpoptions.

Pour lister les imprimantes disponibles :

root #lpstat -a
hpljet5p accepting requests since Jan 01 00:00
hpdjet510 accepting requests since Jan 01 00:00

Pour définir l'imprimante "HP LaserJet 5P" comme imprimante par défaut :

root #lpoptions -d hpljet5p

Configuration d'une imprimante

Introduction

Si l'accés à l'imprimante qui doit être configurée est possible grâce à un autre serveur d'impression (utilisant CUPS), alors les instructions suivantes sont inutiles. Il faut à la place suivre Mise en place d'une imprimante distante.

Détection de l'imprimante

Si une imprimante USB ou par port parallèle était allumée lors du démarrage du système, il devrait être possible d'accéder aux informations fournies par le noyau si ce dernier a détecté l'imprimante. Cette étape permet d'avoir une indication à propos de la détection de l'imprimante, elle n'est pas obligatoire.

user $dmesg | grep -i print
parport0: Printer, Hewlett-Packard HP LaserJet 2100 Series

Pour une imprimante connectée par USB :

user $lsusb
(...)
Bus 001 Device 007: ID 03f0:1004 Hewlett-Packard DeskJet 970c/970cse


The lpinfo command can be used in order to list all connected printers:

root #lpinfo -v
network ipp
network http
network socket
network https
network ipps
network lpd
network lpd://BRW67890ABCDEF/BINARY_P1

Running lpinfo -l -v will give a more verbose output.


Listing available drivers

Pour lister les pilotes disponibles, il faut exécuter la commande suivante :

user $lpinfo -m

La commande lpinfo fournit peu d'informations et peut être difficile à utiliser. En cas de problèmes, utiliser man lpinfo pour plus d'informations.

Installation de l'imprimante

Pour installer l'imprimante sur le système, utilisez un navigateur internet et rendez vous à l'adresse http://localhost:631. L'interface web de CUPS devrait s'afficher pour permettre l'administration des imprimantes.

Remarque
La page pourrait mettre beaucoup de temps à s'afficher la première fois qu'une connexion HTTPS est utilisée pour l'administration de CUPS. Cela est dû à la génération des certificats SSL de CUPS, tache qui peut prendre du temps.

Il faut aller dans la section Administration et entrer le nom de l'utilisateur root ainsi que son mot de passe. Lorsque la page d'administration est affichée, il faut cliquer sur Add Printer. L'écran suivant permet d'ajouter les informations sur l'imprimante :

  • Le "spooler name" (nom du spouler), un nom cours utilisé par le système pour identifier l'imprimante. Ce nom ne devrait pas contenir de caractères spéciaux. Par exemple, une imprimante HP laserJet 5P devrait s'appeler hpljet5p.
  • La "location" (emplacement), l'endroit auquel l'imprimante se situe (par exemple "chambre", ou "dans la salle à manget juste à droite du lave vaisselle", etc.). Cela permet d'administrer plus facilement un grand nombre d'imprimantes.
  • La "description" (description), une description complète de l'imprimante. C'est souvent le nom entier du modèle de l'imprimante (par exemple "HP LaserJet 5P").

L'écran suivant permet de renseigner quelle imprimante doit être utilisée. De nombreuses imprimantes seront listées. Le tableau suivant couvre quelques imprimantes possibles, mais la liste n'est pas exhaustive.

Imprimante Description
AppSocket/HP JetDirect Cette imprimante spéciale permet aux imprimantes partagées par internet d'être accessible grâce à l'interface de communication HP JetDirect. Seules quelques imprimantes supportent cette option.
Internet Printing Protocol (via IPP ou HTTP) Utilisé pour communiquer avec l'imprimante avec le protocole IPP soit directement (IPP) ou via HTTP.
LPD/LPR Host or Printer Sélectionner cette option si l'imprimante est distante et connectée à un serveur LPD/LPR.
Parallel Port #1 Sélectionner cette option lorsque l'imprimante est connectée localement via un port parallèle (LTP). Son nom sera automatiquement attribué à l'imprimante lorsque cette dernière sera détectée.
USB Printer #1 Sélectionner cette option lorsque l'imprimante est connectée localement via un port USB. Le nom de l'imprimante devrait être associé à l'imprimante.

Dans le cas de l'installation d'une imprimante distante, l'URL de l'imprimante sera demandée :

  • Un serveur d'impression LPD requiert une syntaxe du type lpd://hostname/queue.
  • Un serveur d'impression HP JetDirect requiert une syntaxe du type socket://hostname/queue.
  • Un serveur d'impression IPP requiert une syntaxe du type ipp://hostname/printers/printername ou http://hostname:631/printers/printername.

Next, select the printer manufacturer in the adjoining screen along with the model type and number in the subsequent screen. For many printers multiple drivers will be available. Select one now or search on OpenPrinting Printer List for a good driver. Drivers are easily able to be changed later.

Once the driver is selected, CUPS will inform that the printer has been added successfully to the system. Navigate to the printer management page on the administration interface and select Configure Printer to change the printer's settings (resolution, page format, ...).

Testing and reconfiguring the printer

To verify if the printer is working correctly, go to the printer administration page, select the printer and click on Print Test Page.

If the printer does not seem to work correctly, click on Modify Printer to reconfigure the printer. The same screens as during the first installation will appear but the defaults will now be the current configuration.

If the printer does not function, clues may be found by looking at the CUPS error log located at /var/log/cups/error_log. In the next example a permission error is discovered, probably due to a wrong Allow setting in the /etc/cups/cupsd.conf file.

root #tail /var/log/cups/error_log
(...)
E [11/Jun/2005:10:23:28 +0200] [Job 102] Unable to get printer status (client-error-forbidden)!

Installing the best driver

Many printer drivers exist; to find out which one has the best performance the job, visit the OpenPrinting Printer List. Select the brand and type/model of the printer to find out what driver the site recommends. For instance, for the HP LaserJet 5P, the site recommends the ljet4 driver.

Download the PPD file from the site and place it in /usr/share/cups/model then run /etc/init.d/cupsd restart (for OpenRC users) or systemctl restart cupsd.service (for systemd users) as root. This will make the driver available through the CUPS web interface. Now reconfigure the printer as described above.

Enabling job accounting in for Xerox printers

High-end Xerox printers (often a gray, cabinet sized device) use XCPT PDL, and XML based, and poorly documented XPIF ticketing instruction format.

XCPT filter in Cups never made it to a release grade, and the work on it was eventually dropped and all XPIF must be input into a PPD manually. Luckily, it's largely a direct copy of IPP, using XML syntax. After peeking into docs available online, we can craft an arbitrary XPIF command using corresponding IPP attributes.

To configure XPIF solely for ticketing/accounting, drop the following into any PPD:

CODE XPIF code for inserting a user id
*JCLBegin:"<1B>%-12345X@PJL JOB<0A>"

*% Base JCL key code option
*JCLOpenUI JCLPasscode/Key Code: PickOne
*OrderDependency: 10 JCLSetup *JCLPasscode
*JCLPasscode None/No Code: ""
*JCLCloseUI: *JCLPasscode

*% Custom JCL key code option
*CustomJCLPasscode True: "@PJL XCPT <?xml version=<22>1.0<22> encoding=<22>UTF-8<22>?>
  @PJL XCPT <!DOCTYPE xpif SYSTEM <22>xpif-v02074.dtd<22><3E>
  @PJL XCPT <xpif version=<22>1.0<22> cpss-version=<22>2.07<22> xml:lang=<22>en-US<22><3E>
  @PJL XCPT          <job-template-attributes>
  @PJL XCPT <09><09><3C>job-accounting-user-id syntax=<22>name<22> xml:space=<22>preserve<22><3E>\1<3C>/job-accounting-user-id>
  @PJL XCPT          </job-template-attributes>
  @PJL XCPT </xpif>"
*ParamCustomJCLPasscode Code/Key Code: 1 password 0 16

*JCLEnd:"<1B>%-12345X@PJL EOJ<0A><1B>%-12345X<0A>"

It will draw a dropdown box in any printing ui compliant with CUPS PPD extensions to enter the id.

The long term solution would still be for Xerox to fully publish XPIF, and XCPT specifications, to allow for a proper XPIF cups filter to be developed.

Using special printer drivers

Introduction

Some printers require specific drivers or provide additional features that are not enabled through the regular configuration process (described above). This chapter will discuss a selection of printers and how they are made to work with Gentoo Linux.

Gutenprint driver

The Gutenprint drivers are high-quality, open source printer drivers for various Canon, Epson, HP, Lexmark, Sony, Olympus and PCL printers supporting CUPS. They also support ghostscript, The Gimp, and other applications.

Gentoo's Portage tree contains an ebuild for the gutenprint drivers. Run emerge gutenprint to install them. Note the ebuild requests to quite a few USE flags. At minimum cups and ppds must enabled for gutenprint drivers to work properly.

root #emerge --ask net-print/gutenprint

When the emerge process has finished, the gutenprint drivers will be available through the CUPS web interface.

HPLIP driver

See HPLIP Driver.

Lexmark driver

Most Lexmark printers are handled by their "Universal Printer Driver":

root #emerge --ask net-print/lexmark-upd-ppd

Once this is installed, there is a single Lexmark driver available in the CUPS setup wizard that should work with most printers and MFDs.

PNM2PPA driver

PPA is an HP technology that focuses on sending low-level processing to the system instead of the printer which makes the printer cheaper but more resource consuming.

If the OpenPrinting site informs the pnm2ppa driver is the best option, then the net-print/pnm2ppa filter will need to be installed on the system:

root #emerge --ask net-print/pnm2ppa

Once installed, download the PPD file for the printer OpenPrinting and put it in the /usr/share/cups/model folder. Then configure the printer using the steps explained above.

SpliX driver

SpliX is a set of CUPS printer drivers for SPL (Samsung Printer Language) printers. While SpliX drivers are available through OpenPrinting as well, the net-print/splix package allows for quick portage-managed installation of these drivers. To install, run:

root #emerge --ask net-print/splix

and restart cupsd.

Brother printer drivers

See Brother networked printer.

Canon printer drivers

See the specific pages:

Printing to and from Microsoft Windows

Remarque
Read the Samba/CUPS Guide for more detailed information on setting up CUPS with Samba.

Configuring a Windows client for IPP

Microsoft Windows supports IPP. To install a printer on Windows that is attached to a Linux box, fire up the Add Printer wizard and select Network Printer. When asked for the URI, use the http://hostname:631/printers/queue syntax.

Configuring a Windows client for a Samba shared printer

To share the printer on the CIFS network SAMBA must be installed and configured correctly. Doing this is beyond the scope of this article, however a quick configuration of SAMBA for shared printers will be covered.

Open /etc/samba/smb.conf with a favorite text editor and add a [printers] section to it:

CODE [printers] section
[printers]
  comment      = All printers
  path         = /var/spool/samba
  browseable   = no
  guest ok     = no
  writable     = no
  printable    = yes
  public       = yes
  printer name = hpljet5p

Navigate to the top of the smb.conf file until inside the [global] section. Locate the printcap name and printing settings and set each of them to cups (see the example below):

CODE Changing the [global] section of smb.conf
[global]
  (...)
  printcap name = cups
  printing      = cups

Make sure to enable Windows PCL support in CUPS. Then, restart the smb service to have the changes take effect.

Configuring a Linux client for a Windows print server

First make sure the printer is shared on Windows systems and that net-fs/samba has been emerged with the cups USE flag enabled (as instructed above).

To find the desired printer's URI, run the following command, substituting server with the computer that is to probe for samba-shared printers:

user $smbclient -N '\\serveur\'

In the CUPS web interface, configure the printer as previously described. Notice CUPS has added another driver called Windows Printer via SAMBA. Select it and use the smb://username:password@workgroup/server/printername or smb://server/printername syntax for the URI.

Important
Any special characters in the above URI need to be appropriately quoted. For example:

smb://BEN-DESKTOP/HP Color LaserJet CP1510 series PCL6

becomes:

smb://BEN-DESKTOP/HP%20Color%20LaserJet%20CP1510%20series%20PCL6

This result string can be obtained by running the following command:

user $python2 -c 'import urllib; print "smb://" + urllib.quote("BEN-DESKTOP/HP Color LaserJet CP1510 series PCL6")'

Printing-related applications

Introduction

Many tools exist to help configure a printer, use additional printing filters, add features to printing capabilities, etc. This chapter will list a few of them. Be aware the list is not exhaustive and not meant to discuss each tool in great detail.

Gtk-LP - A GTK-powered printer configuration tool

With net-print/gtklp, the installation, modification and configuration of a printer can be performed from a stand-alone GTK application. It uses CUPS and provides all standard CUPS capabilities. It is definitely worth checking out if the CUPS Web interface is disliked or if a stand-alone application for day-to-day printing routines is desired.

Install via:

root #emerge --ask net-print/gtklp

Printer configuration tool for KDE Plasma

KDE Plasma also has a printer config tool called kde-apps/print-manager. It works with CUPS and provides a user-friendly interface to configure printers. Install it as follows:

root #emerge --ask kde-apps/print-manager

Suppression

Options de la variable USE

Packages that are currently installed with the cups USE flag must be modified. Search through /etc/portage/package.use to see if any packages explicitly have the cups flag and remove it.

Next, it may be necessary to remove the cups value from /etc/portage/make.conf's USE variable if it had been previously set.

Unmerge

root #emerge --ask --depclean --verbose net-print/cups

Finally, clean the system of any packages that are no longer needed as a result of CUPS being removed.

root #emerge --ask --depclean

Dépannage

Debugging

See archlinux wiki

Error: Unable to convert file 0 to printable format

While having printing troubles and /var/log/cups/error_log shows this message:

CODE Error log
Unable to convert file 0 to printable format

Re-emerge app-text/ghostscript-gpl with the cups USE flag. You can either add cups to the system USE flags in /etc/portage/make.conf or enable it only for ghostscript-gpl as shown:

root #echo "app-text/ghostscript-gpl cups" >> /etc/portage/package.use

Then run emerge app-text/ghostscript-gpl. When it has finished compiling, be sure to restart cupsd afterward.

Si OpenRC est utilisé :

root #service cupsd restart

Si systemd est utilisé :

root #systemctl restart cups

USB printer is not detected

Assuming that cups is built with the usb USE flag, verify that the printer's character device has the correct permissions. For example:

user $lsusb Bus 002 Device 058: ID 04e8:3297 Samsung Electronics Co., Ltd ML-191x/ML-252x Laser Printer

There should be a character device for this printer at /dev/bus/usb/002/058.

user $ls -l /dev/bus/usb/002/058 crw-rw-r-- 1 root android 189, 185 Apr 16 05:55 /dev/bus/usb/002/058

In this example, /lib64/udev/rules.d/80-android.rules over-zealously modified the permissions. This is bug #644636. Lets try fixing them:

root #chgrp lp /dev/bus/usb/002/058
root #chmod 660 /dev/bus/usb/002/058

Now we should see:

user $ls -l /dev/bus/usb/002/058 crw-rw---- 1 root lp 189, 185 Apr 16 05:55 /dev/bus/usb/002/058

The printer likely is detected now. You should be able to add it, configure it (provided that you have a working driver) and print a test page. This implies a permissions problem. Assuming that your system uses udev/eudev for managing its /dev directory, you can make this change permanent by making a udev file:

FILE /etc/udev/rules.d/99-printer.rulesCustom Udev Rule
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="3297", MODE="0660", GROUP="lp"

Our device is "ID 04e8:3297" according to the earlier lsusb output. We split that into idVendor and idProduct as demonstrated in the example. Now udev should ensure that the correct permissions are set at every boot and at every hotplug.

Voir aussi

Ressources externes


This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Sven Vermeulen (SwifT) ,
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.