PCS Logo

Setting up and using a printer in QNX



Introduction

QNX is the operating system of choice for a small number of Physics labs and classes.  Much of the "official" documentation regarding QNX is sparse, thus it is the intention of PCS to document basic configuration and support solutions within the system  as they are discovered.

Creating and using a printer

The steps for creating a printer are as follows:

  1. Edit the /etc/printcap file in any text editor so that it contains the following lines:

    (The printers currently in 3233 are "largefries" and "ignite.")

    largefries|largefries|default line printer:rm=ftp.broida:rp=largefries:
    ignite|ignite|rm=ftp.broida:rp=ignite:

    This assumes that your printers are connected to the ftp.broida server.  If this is not the case, you will have to change the printer/server name appropriately.  Note that one printer must be designated as the "default line printer"  
  2. Create the following printer spool directories:

    mkdir /usr/spool
    mkdir /usr/spool/output
    mkdir /usr/spool/output/lpd

  3. Execute the command "chmod -R 1777 /usr/spool" to give everyone proper permissions on the spool directories
  4. Start the printer daemon by executing the command "lpd -l".  NOTE: You will have to run this command every time you reboot the system!   If lpd will not start up, look in the /usr/spool/output/lpd directory for a lpd.lock file and remove it:

    rm /usr/spool/output/lpd/lpd.lock
  5. Enable the printers: type "lprc enable all" and "lprc start all" at the command-line.
  6. To verify the printer is working, type "lprc status" at the command-line; you should get something like the following back:

        lp:
                 queuing is enabled
                 printing is enabled
                 no entries
  7. Test print by typing "lpr -Pignite <some-file-name>", where <some-file-name> is a text file

Starting lpd at boottime:

  1. vi /etc/rc.d/rc.local and add the following:
  2.             rm -rf /usr/spool/output/lpd/lpd.lock
                 lpd -l
  3. chmod 755 /etc/rc.d/rc.local
  4. Reboot

FAQ

Q) I did all of the above, but nothing came out of the printer.  What's up?
A) You can use lprc to check the status of a print job.  If it returns "sending to ftp.broida", just wait; it's probably on its way.   If instead you see anything that says "disabled", try enabling the printer and queue by typing "lprc enable".  If that doesn't work, call pcs @ x8366

Q) I'd like to try troubleshooting this myself; how can I get more information about what the printer daemon is doing?
A) QNX has basic system logging functionality.  To enable it, execute the commands "touch /var/log/syslog" and "touch /var/log/maillog".  Then, execute the "syslogd" command.  Finally, kill and restart the lpd process.  Now when you print, you can check the /var/log/ files you just touched to get more information on what's happening

Q) I was printing fine until I had to reboot.  Now it won't print.  What's up?
A) You have to restart the lpd process manually each time the system boots.  Run "lpd -l" to do so.

Q) I'm not using largefries; I have my own printer I'd like to setup.  How can I do this?
A) Please consult the documentation online at

        http://www.qnx.com

While it is occasionally sparse it is the only good source of documentation for QNX that we are aware of.  Local printers don't seem to be too much of an issue, but all network printers must be able to handle lpd style printing.  We are not aware of any way for QNX systems to print to JetDirect printers directly, so they and any/all other types besides lpd that you wish to be able to print to over the network must be installed on the ftp.broida server.  Contact pcs@physics.ucsb.edu or call us at x8366 for help doing this.

Q) I followed your instructions for setting up the syslog, and in the logs it says something about file system corruption.  I also get this sometimes when I try to start the lpd process.  What does this mean?
A) It means someone probably powered down the system with the power button instead of shutting it off properly from within QNX.  You can use the chkfsys utility to repair the filesystem.  Please see

     http://www.qnx.com/developer/docs/qnx_4.25_docs/qnx4/utils/c/chkfsys.html

for more information regarding chkfsys, or contact pcs at pcs@physics.ucsb.edu or x8366.



Last Updated:  3/19/2005

Questions regarding this document should be sent to pcs@physics.ucsb.edu

PCS Logo