Posted by: Subhendu Sen
According to my experience, it is not hard to install any kind of hardware on Linux system, provided work with latest kernel version. Yes, if you compile kernel you may not get the vendor’s supports from the same distro of the same Linux flavor. It is not necessary to compile kernel every time rather you may use kind of patch / plug ins for the same purpose. In my practical experience, when I went to install HP LaserJet 1020 printer, the printer was installed with HPLIP properly, printer was also responding but after a while it went pause and due to this problem, print out was not possible there. I opened a terminal box > /usr/bin/enable and printer queue name (with space). Now again it was on the way, but again after a while it went to the same state. After some work around, I found, a Plug ins for HP printers, and after installed the problem has gone.
Sorry Linux Users…. In this part I am going to discuss Printer configuration through Command Line Interface Rather Than GUI
In SuSE Linux at a Glance in View of Rechil Part – 2, I wrote a little about PPD files !
PPD (PostScript Printer Description is the computer language that describes the properties as resolution and options as duplex unit of PostScript printers. During installation a lot of PPD files are preinstalled. In this way, even printers that do not have built-in PostScript support can be used. The best approach is to get a suitable PPD file & store it in the directory /usr/share/cups/model. It may possible to select PPD file during installation. If the model does not show up, click Add Driver > Browse in the printer model dialog & follow the simple steps to add the PPD file to the database. You can see the current settings of a local queue by entering: lpoptions -p queuename -l. Here queuename means, the name of the printer name.
Note: The sequence of options is important here, if you specify -l first, the settings of the default queue are listed.
This command changes the page size of the lp queue to Letter:
lpoptions -p lp -o PageSize=Letter
If root applies the command, this file stores in /etc/cups/lpoptions. There is a way for root to change the defaults in the PPD file of any local queue. Such changes would apply network wide to all users: lpadmin -p queue -o options=name
Note:You can also get information of the commands covered above in a browser using this URL….
& printer save options: /usr/share/doc/packages/cups/sum.html#SAVING_OPTIONS
Understand How CUPS Works….
CUPS can be seen as a replacement for the LPD printing system. It replaces the lpr command with its own and the LPD printer drivers with its own versions. If your CUPS installation came with a Linux distribution, you should still take a look through this section to verify that this has a practical level of security. This section covers how to configure digest authentication, the most useful type of authentication available for the CUPS Web administration interface. Run through the following steps on a new installation:
Scan the cupsd.conf for a section that looks like this:
<Location /admin> AuthType Basic AuthClass System ## This Section Restrict Access to Local Domain Order Deny,Allow Deny From All Allow From 127.0.0.1 </Location>
Change AuthType Basic to AuthType Digest. Basic authentication sets up a Web browser to send Linux users passwords as plain text.
There are four steps to understand the process of printing!
A print job is submitted by a user / by a program
The file destined for the printer is stored in a print queue which creates two files per print job in the directory: /var/spool/cups, one of the file contains the actual data to print and the other one contains information about the print job.
The cupsd printer daemon acts as the print spooler
The conversion of print data is done as:
The data type is determined using the way: /etc/cups/mime.types
/etc/cups/mime.convs helps to convert data into PostScript
After converting, the program called pstops (which is in /usr/lib/cups/filter/pstops) using to count no of pages, which is written to /var/log/cups/page_log
CUPS uses other filtering as pstops is needed. For eg. psselect of pstops makes it possible to limit the printout to a certain selection of pages. Even you may use, ps-n-up option of pstops allows to print several pages on one sheet.
Note: To know more about filtering, see, usr/share/doc/packages/cups/sum.html. CUPS can use printers shared from computers under Windows and network printers using the SMB protocol. You configure a “Windows printer using Samba”. Basically, all you have to tell CUPS is the address of the printer, as in smb://server/printer
If the selected printer is not a PostScript printer CUPS starts the proper filter to convert data into the printer-specific format and for instance it is as in /usr/lib/cups/filter/cupsomatic
CUPS may use another kind of filter / backend depending on connection. They are found in, /usr/lib/cups/backend and you may see them by using the command: ls /usr/lib/cups/backend
When the print job has been transferred to the printer, print spooler deletes the job and starts processing the next steps. When job is deleted, the print data file in /var/spool/cups is removed.
Notes: Actually, the file that has information about the print job is not deleted. The first job is named as c00001. The no is increased for each file by one. Remember, /etc/printcap (which I mentioned earlier) is a link to /etc/cups/printcap and it is generated & updated automatically by cupsd and is relevant for a no of applications such as OpenOffice / MS Office
So, Where is the Log Files…. That Should Help to Track the Error_Log Files!
The log files of CUPS are stores in the directory: /var/log/cups. Actually there are three files named as:
The access_log file: It records all lists each HTTP resource that is accessed by a web browser of CUPS/IPP client
The error_log file: It manages the lists of messages from the scheduler and the indications are, E means, An error occurred; W means, Server was unable to perform an action; I means, Informational messages and D means, Debugging messages.
The page_log file: It lists each page that is sent to a printer.
Tips: For troubleshooting CUPS related problems, set the Log Level to Record Errors in the way as: open /etc/cups/cupsd.conf and set as “LogLevel debug2” (without quotes)
Restrict Access to Printers for Users and Groups… (Command Line – Printer)
If you want, you may restrict access to the printers on a user and groups. By configuring YaST and selecting a queue in the main Printer Configuration dialog and then selecting Edit > Restriction Settings. There are several choices that unfolds in front of you, but you can choose any one!
All Users Can Use This Printer
The Following Users Can Use This Printer (either select Add to insert users or groups to add groups)
The Following Users Cannot Use This Printer (same as the above point)
You can use Command Line to do the same job. For instance, to permit printing for individual users: lpadmin –p printerqueue –u allow:username1, username2
Even for groups: lpadmin –p printerqueue –u allow:@groupname
Here printerqueue means printer name and username means user name like rechil and group name means, any group name that exists.
Once again, to prohibit printing for users or groups: lpadmin –p queue –u deny:rechil,@guests
And to permit printing for all: lpadmin –p printerqueue –u allow:all or not to permit just replace allow with deny:none
To start cups: rccups start / rccups restart
To stop cups: rccups stop
Run the following command to add an admin user to the CUPS digest password file i.e. /etc/cups/passwd.md5
lppasswd -a admin
When prompts, choose a password containing at least six characters and one number, and this is for security purpose.
How to Install a Test Printer in a Test Lab…..
Run this command to add a test printer: lpadmin -p test -v file:/dev/null
Verify that the printer status: lpstat -p (if it shows disabled then pass the following)
Send a job to the printer: echo test | lp -d test
Use the following command to make sure this: lpstat -W completed -l test
Remove the test printer by using this command: lpadmin -x test
Tips: These are all written to the file /etc/cups/printers.conf