beh backend broken: writes temporary files into /

Bug #268284 reported by Christian Hudon
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cups (Ubuntu)
Invalid
Medium
Unassigned
foomatic-filters (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

There seems to be a weird interaction between apparmor, the 'beh' cups backend, and cupsd. My printer is configured in cups to print to beh:/1/0/120/socket:myprinter:9100, so that cups retries printing when the printer is off, etc. until it is turned back on. With the upgrade to hardy, the printer stopped working. When I try to print something to that printer, nothing comes out and I see the following status for the printer in the cups printer administration web page:

"Cannot write /6459-chrish-cupsjob13374: Permission denied"

If I switch the printer to use the socket backend directory, or if I stop apparmor, the problem does not occur.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

pitti, can you adjust the AppArmor configuration so that the beh wrapper backend works? The beh backend is for fine adjustment of the handling of errors of CUPS backends. See http://www.openprinting.org/beh.html. beh is part of the foomatic-filters package.

Changed in cupsys:
assignee: nobody → pitti
importance: Undecided → Low
Revision history for this message
Martin Pitt (pitti) wrote :

After that happens, can you please open a Terminal, do

  dmesg > /tmp/dmesg.txt

and attach /tmp/dmesg.txt here? Thanks!

Changed in cupsys:
status: New → Incomplete
Revision history for this message
Martin Pitt (pitti) wrote :

I reproduced the situation, and get the same error with beh:/1/0/120/socket:myprinter:9100. However, it does not cause an AppArmor error message in dmesg, and rightfully disabling apparmor does not fix the situation either.

The file path looks fishy, why does it try to put the temporary file into / ?

Revision history for this message
Martin Pitt (pitti) wrote :

I also tried to fix the printer location to match the documentation: beh:/1/0/120/socket://myprinter:9100, however, that did not work either.

Presumably beh writes its temporary file into an invalid location (/ instead or /var/spool/cups/...). Till, how can I find out with which parameters it calls the beh backend? Can I put an strace in between to see which files it creates?

Till, maybe the problem is also that beh is run as user 'lp', not user 'root'? If it does need root, beh needs to be installed 744, not 755. It might be that this was the case previously, and thus the wrong temporary file path was just hidden.

Revision history for this message
Martin Pitt (pitti) wrote :

Needs input from Till, reassigning.

Changed in cupsys:
assignee: pitti → till-kamppeter
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

It is a problem of CUPS. CUPS tells nicely in the error_log which environment variables it defines for the job, a total of 25, including TMPDIR.

If you add the following lines to /usr/lib/cups/filter/beh, near the beginning

use Data::Dumper;
print STDERR Dumper(%ENV);

You get listed all environment variables which beh can find, a total of 24, not including TMPDIR.

Changed in foomatic-filters:
assignee: till-kamppeter → nobody
importance: Low → Medium
status: Incomplete → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Ah, thanks TIll. Opening a task for foomatic-filters, because it really should have a sensible fallback if TMPDIR is not set (/tmp).

I'll examine the situation in cups.

Changed in foomatic-filters:
status: New → Triaged
Changed in cups:
assignee: nobody → pitti
status: Triaged → In Progress
Changed in foomatic-filters:
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package foomatic-filters - 4.0.0~bzr171-0ubuntu1

---------------
foomatic-filters (4.0.0~bzr171-0ubuntu1) intrepid; urgency=low

  * New upstream release
     - Let the beh CUPS backend use /tmp as temporary directory when CUPS
       does not supply the $TMPDIR environment variable (LP: #268284).

 -- Till Kamppeter <email address hidden> Thu, 25 Sep 2008 09:28:44 +0200

Changed in foomatic-filters:
status: In Progress → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

For the CUPS task see also the upstream bug report

http://www.cups.org/str.php?L2962

Revision history for this message
Martin Pitt (pitti) wrote :

(which was -- again -- prematurely closed as "apparmor problem", which is clearly wrong. AppArmor rightfully prevents cups from writing into /, but doesn't change anything in the environment.

Martin Pitt (pitti)
Changed in cups:
status: In Progress → Triaged
Martin Pitt (pitti)
Changed in cups (Ubuntu):
assignee: pitti → nobody
Revision history for this message
era (era) wrote :

The foomatic-filters fix presumably corrected this problem; closing the cups task as invalid. If this is incorrect, obviously, feel free to reopen. Thanks.

Changed in cups (Ubuntu):
status: Triaged → Incomplete
Changed in cups (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
era (era) wrote :

Sorry, clicked the wrong status (-: Thanks for fixing.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.