CUPS, avahi-daemon, ubuntu Lucid, hp Laserjet 2550 and IOS6 devices…

Okay, well, this was a PITA. But, it’s working now.  

First off, references that were usefull:

apt-get and install the following:

  • cups
  • cups-pdf
  • python-cups
  • avahi-daemon
  • avahi-utils
  • poppler-utils

First step: CUPS has a webserver that allows you to configure printers using the browser, much easier than editing the .conf files directly.  It is designed to be accessed via http://localhost:631/admin.  And locked down thusly.  First, edit /etc/cups/cupsd.conf, and perform the following edits:

  1. After ‘SystemGroup lpadmin’, add ‘ServerAlias *’ – this allows requests that are forwarded by avahi-daemon to come from ‘hostname.local’ without error.  Otherwise you will get in your cups error log: “E [21/Dec/2012:13:05:37 -0500] Request from “” using invalid Host: field “ops1-00.local””
  2. Find the ‘Port locahost:631’ line, and change it to just ‘Port 631’, this will allow connections from other machines on your network.
  3. For each stanza ‘<Location xxxxx>’, just after ‘Order xxx’ line, add ‘Allow all’. Specifically for locations ‘/’,’/admin’,’/admin/conf’.  This will allow connections from other machines.  But beware, this will open things up a bit on your local network.
  4. Add your local user account to the lpadmin group ‘usermod -aG lpadmin username’. You’ll need this to auth to cupsadmin later.
  5. Create a new file ‘/usr/share/cups/mime/apple.types’ with only one line ‘image/urf urf (0,UNIRAST)’, without the quotes.
  6. Create a new file ‘/usr/share/cups/mime/local.convs’ ‘image/urf application/vnd.cups-postscript 66 pdftops’ without the quotes
  7. restart cups ‘service cups restart’.
  8. Logon and configure your printer in a web-browser.  Enable sharing of the new printer.
  9. On the Administrative tab, check ‘Share printers connected to this system’.
  10. Test your printer.

Now the avahi part:

  1. mkdir -pv /opt/airprint; cd /opt/airprint
  2. wget -O –no-check-certificate
  3. chmod 755 ./
  4. Edit, in the section setting ‘DOCUMENT_TYPES’, add a new line just under “‘application/postscript’: True,” that says “‘application/vnd.cups-postscript’: True”.
  5. ./
  6. The above will generate a file in your local directory for the printers that you have setup in CUPS. The other steps below are from the webpage of the person, but not sure why they are needed.
  7. cp ./*.service /etc/avahi/services
  8. ./ -d /etc/avahi/services
  9. service avahi-daemon restart

That’s about it.  Troubleshooting:

  1. Verify that it’s listening on it’s multicast port: ‘netstat -ng’, you should see′ in there when avahi-daemon is running.
  2. Verify that CUPS is listening on 631: ‘netstat -anop | grep LISTEN’ (needs root).
  3. Check CUPS logs in /var/log/cups/* ‘tail -f /var/log/cups/*’
  4. Check avahi-daemon messages in /var/log/syslog ‘tail -500 /var/log/syslog | grep avahi-daemon | less’
  5. Install tcpdump, and check multicast traffic ‘tcpdump ether multicast’, or check ‘tcpdump port 631’ traffic for cups.
  6. Many changes require restarts to both daemons, so ‘service cups restart; service avahi-daemon restart’

NOTE: this works well on my hp laserjet 2550 networked printer using postscript.  Others may have different experiences.

Good luck!!!


About mglaske

Systems Engineer for Limelight Networks
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s