SLED11 SP1: CUPS printer settings after ZMD image installation

Using ZMD10 for creating an image of SLED11 SP1 with CUPS and iPrint
Client I noticed that the printer settings on the freshly installed
machine are off.
More specifically all documents are printed single sided even if duplex
printing is specified. Opening the CUPS configuration at localhost:631
and setting the printer options again fixes the issue, But then I do not
want to log in to every single machine in order to make this adjustment.
Creating an lpoptions file with lpoptions has no effect. So I’m looking
for a solution on how to make this work. Where does CUPS store the
printer configuration other than in the ppd files, lpoptions or
printers.conf? All these files are included in the ZMD image.

Günther

Günther,

It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.

Has your problem been resolved? If not, you might try one of the following options:

  • Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
  • You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)

Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php

If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.

Good luck!

Your Novell Product Support Forums Team
http://forums.novell.com/

I’ve never dealt with ZMD images (I use AutoYaST) and can’t offer you an idea for why your printer settings are wrong other than the obvious one that they’re wrong in the image, which you’ve presumably checked. You say that if you set the options after the imaging is done fixes the issue, can you run some sort of post-installation script after the image is deployed? If so you could use that to set up the printers.

I find myself wondering, what do you do if a printer gets replaced or removed and you need to update the printer configuration on all the machines to reflect that? Or does that never happen?

mikewillis wrote:[color=blue]

I’ve never dealt with ZMD images (I use AutoYaST) and can’t offer you an
idea for why your printer settings are wrong other than the obvious one
that they’re wrong in the image, which you’ve presumably checked.[/color]

Yes, indeed.
[color=blue]

You
say that if you set the options after the imaging is done fixes the
issue, can you run some sort of post-installation script after the image
is deployed? If so you could use that to set up the printers.[/color]

This is actually what I do now. One of the students set up a python
script for me that sets the printer options via the html interface of
CUPS. This way the configuration can be done automatically after the
image installation or in case a printer gets replaced. I still do not
know what the difference is between editing the configuration files in
/etc/cups and setting the options in localhost:631. Puzzling.
[color=blue]

I find myself wondering, what do you do if a printer gets replaced or
removed and you need to update the printer configuration on all the
machines to reflect that? Or does that never happen?[/color]

This is rarely the case. I use cfengine in order to distribute and edit
configuration files on the clients. This works nicely vor most services
and even for things like mandatory settings in gnome. There are a few
exceptions like e.g. LUM which needs entries in eDirectory or
/etc/aliases where a new aliases.db file has to be created after the
modification. And obviously CUPS.

Günther

[QUOTE=Günther Schwarz;3949]
This is actually what I do now. One of the students set up a python script for me that sets the printer options via the html interface of CUPS. [/QUOTE]
That sounds rather overly complicated, but maybe I’m not understanding how it works. (I’m imagining a script which constructs suitable HTTP requests and then submits them to localhost:631)

For what it’s worth, I use a bash script which looks (in part) like this which uses the CUPS command line tools

# make sure cups is running.
service cups start

# occasionaly the rest of the script would try to run before cups accepts
# connections so check connection before continuing

continue="no"
let count=30;

while [ "$continue" = "no" ];do
  lpstat -a &>/dev/null && continue="yes";
   sleep 1
   echo "$(basename $0) is waiting to contact cupsd... $count";
   let count=$count-1;
   if [ $count -eq 0 ];then
      echo -e "\\E[1;31m$(basename $0) is bored now... continuing anyway (something is wrong maybe)\\E[0m";

      break;
   fi
done



grep -v ^# file_that_contains_printer_details | while read line;do
   server=$(echo $line | cut -d , -f 2);
   queue=$(echo $line | cut -d , -f 3);
   protocol=$(echo $line | cut -d , -f 4);
   ppd=$(echo $line | cut -d , -f 5);
   location=$(echo $line | cut -d , -f 6);
   miscopts=$(echo $line | cut -d , -f 7);
   # set up print queue, delete any jobs that might be in it (in case the queue already existed) and ensure it's enabled and accepting jobs
   lpadmin -p ${queue} -v lpd://${server}/${queue} -P ${ppd} -L "${location}" -o PageSize=A4 $miscopts &&  lprm -P ${queue} - && cupsenable ${queue} && /usr/sbin/accept ${queue};
done

# delete queues for printers that no longer exist
for i in $(grep -v ^# $printers_todelete);do
   # send errors to /dev/null as printers probably don't exist, which causes
   # an error
   lpadmin -x $i 2>/dev/null
done

# lots of stuff snipped which works out which queue should be set as the default depending on various things and assigns that queue name to the the variable default 
# set default printer
lpadmin -d $default;

# restart cups for chages to take effect
service cups restart

(I wrote the script yonks ago. Using an array, e.g. IFS=, read -a values << $line would be more efficient than using all those instances of echo I think. )
file_that_contains_printer_details contains lines like this

# printer in workarea foo print_server_seven,queue_foo,lpd,/usr/share/cups/model/manufacturer-PPDs/hplip/hp-laserjet_4300-ps.ppd.gz,Workarea Foo,-o HPOption_Tray3=Tray3_500 -o HPOption_Tray4=Tray4_500

mikewillis wrote:[color=blue]

Günther Schwarz;3949 Wrote:[color=green]

This is actually what I do now. One of the students set up a python
script for me that sets the printer options via the html interface of
CUPS.[/color]
That sounds rather overly complicated, but maybe I’m not understanding
how it works. (I’m imagining a script which constructs suitable HTTP
requests and then submits them to localhost:631)

For what it’s worth, I use a bash script which looks (in part) like
this which uses the CUPS command line tools[/color]

thanks for sharing your code. You use, among other commands, lpadmin.
There is lpoptions also which in principal should do what I want to
accomplish. But is does not work for me. I have to go via the web
administration interface. Python is just one way of doing this, wget
should do the job also. And yes, this is all about submitting http
requests to the CUPS server. It helps to do a browser session first,
recording and then analyzing the traffic.

Günther