cupsd on the phone is unable to run sub processes, they all cause "Command not found"

Bug #1509423 reported by Till Kamppeter
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Invalid
Undecided
Sebastien Bacher
cups (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I have started to test the printing stack of Ubuntu on the phone.

I have a Nexus 4 now to test the printing stack on the phone.

First I have updated the USB-connected phone to the development branch of the OS via

ubuntu-device-flash touch --channel=devel

with the phone booted into Ubuntu and the screen unlocked.

After the reboot of the phone I have run

phablet-config writable-image

to be able to install packages with apt-get and entered a shell on the phone via

phablet-shell

In the shell I first installed a level-1 printing stack (See https://blueprints.launchpad.net/ubuntu/+spec/client-1305-printing-stack-with-mobile-in-mind for the levels):

sudo apt-get install cups-daemon cups-browsed avahi-daemon

This makes the following new packages getting installed:

The following NEW packages will be installed:
  avahi-daemon bc bind9-host cups-browsed cups-daemon libavahi-core7
  libavahi-glib1 libbind9-90 libcupsmime1 libdaemon0 libdns100 libgeoip1
  libisc95 libisccc90 libisccfg90 liblwres90 libpaper1 ssl-cert
0 upgraded, 18 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,502 kB of archives.
After this operation, 4,698 kB of additional disk space will be used.

The installation was hanging on the postinst of CUPS, so I had to open a new shell in another terminal and kill the postinst for the installation process to finish.

sudo apt-get install -f

has re-run the CUPS postinst and this time it finished.

As the phone apps do not yet have a print dialog I needed a print client on the phone, and also some tools for developing and debugging. So I have installed cups-client, giving me command line printing and print admin commands, as lp, lpstat, lpinfo, lpadmin, ...:

sudo apt-get install cups-client
[...]
The following NEW packages will be installed:
  cups-client cups-common libcupsfilters1 libcupsimage2
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 368 kB of archives.
After this operation, 2,810 kB of additional disk space will be used.

PID 1 on the phone is still Upstart, Upstart is configured to start CUPS on-demand, via

/etc/init/cups.override

cups.override needs to be corrected, as cupsd does not support the "-x" option any more, so I have removed the "-x 30" from the cupsd command line. Now cupsd starts when running commands like

lpstat -r
lpstat -v
...

After that I did

sudo start cups-browsed

to start cups-browsed to get the queues from remote CUPS servers locally available (level 1 printing stack).

lpstat -v

shows my printers shared on remote CUPS servers now.

Note that CUPS admin tasks need "sudo" as the "phablet" user is not in the "lpadmin" group.

For the printing tests I do the CUPS logging (in /var/log/cups/error_log) in debug mode, running

sudo cupsctl --debug-logging

sudo cupsctl

shows my settings.

Now I print via

lp -d printer ~/.bashrc

CUPS is now supposed to send the job via IPP (Internet Printing Protocol) to the remote CUPS server where the printer is actually connected to. This it does using a backend, a small helper program, in our case /usr/lib/cups/backend/ipps.

Printing does not work yet:

1. CUPS reports exit status 127 on the ipps backend call ("command not found", the fact that in error_log you see "file too large" is a CUPS bug, exit status 127 is "command not found"), but the backend is called with its full path, the backend is actually present and executable, no libs missing (checked with "ldd"), the backend works directly called from the command line.

2. No name resolution in the local network (avahi problem? avahi-daemon is running). Manual call of the backend only works if the host name in the device URI is replaced by the corresponding IP address.

So following command prints:

DEVICE_URI=ipps://192.168.0.11:631/printers/printer CONTENT_TYPE=text/plain /usr/lib/cups/backend/ipps 1 1 1 1 "" ~/.bashrc

Also

sudo DEVICE_URI=ipps://192.168.0.11:631/printers/printer CONTENT_TYPE=text/plain /usr/lib/cups/backend/ipps 1 1 1 1 "" ~/.bashrc

prints.

To overcome the host name resolution problem I have modified cups-browsed to create the local queues with IP addresses instead of host names in the device URIs. So the remeining problem is (1), for which I have opened this bug report.

The problem is most probably no caused by AppArmor, as I do not see appropriate "audit" messages in /var/log/syslog and I have done

aa-complain cupsd

to have cupsd in complain mode and not in enforce mode.

As both the ipp/ipps backend and another backend which is a shell script do not start and give exit status 127, it seems for me that make cupsd running a command line "strace ipp ..." will also end up in nothing being executed.

So I tried

strace cupsd -f > log 2>&1 &

and afterwards ran a job

lp -d canon-colour .bashrc

After some time I canceled the job (as it did not get executed due to the known problem) and stopped CUPS.

The resulting file "log" is attached. The problem happened on 14/Oct/2015:14:55:31, you can search for "14/Oct/2015:14:55:31" in the log, then for "backend/ipp".

Tags: cups printing
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
  • log.gz Edit (283.7 KiB, application/octet-stream)
summary: - cupsd is unable to run sub processes, they all cause "Command not found"
+ cupsd on the phone is unable to run sub processes, they all cause
+ "Command not found"
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

@seb are you helping on this?

Changed in canonical-devices-system-image:
assignee: nobody → Sebastien Bacher (seb128)
status: New → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Till, did you try the debug hints I recommanded (trying to edit the code that call the commands that returns error 127 and add some debug code, trying to call the same command with system() maybe and redirecting output to a file for seeing if there are more details)?

Changed in canonical-devices-system-image:
status: Confirmed → Invalid
Changed in cups (Ubuntu):
status: New → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have looked into the source code of CUPS to look for how the sub-process spawning of CUPS actually works and it is more complex than I thought. To allow more sophisticated security profiles, recently a new wrapper, /usr/lib/cups/daemon/cups-exec, was introduced and instead of calling filters, backends, and other executables directly, CUPS calls cups-exec and cups-exec calls the desired executable. On the splitting of the binary packages of CUPS the whole /usr/lib/cups/daemon directory was assigned to the "cups" binary package which is onlky used in a level-3 printing stack and my tests are done with a level-1 printing stack.

As cups-exec is already needed for basic job execution, it needs to be moved to level 1, or to the cups-daemon package. I will do this in the next CUPS package upload for Xenial.

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

Commited fix on CUPS package to Debian's GIT respositorywith the next upload to Debian the fix will get synced to Ubuntu.

Changed in cups (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 2.1.0-6

---------------
cups (2.1.0-6) unstable; urgency=medium

  [ Till Kamppeter ]
  * Move /usr/lib/cups/daemom/cups-exec from the "cups" binary package to the
    "cups-daemon" binary package as it is already needed for basic job
    execution and therefore already in the level-1 (minimum) printing stack
    (LP: #1509423)

 -- Didier Raboud <email address hidden> Fri, 06 Nov 2015 17:09:44 +0100

Changed in cups (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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