Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run apt-get -f install, I get the following abnormal output:

Setting up cups (1.5.0-8) ...
start: Job failed to start
invoke-rc.d: initscript cups, action "start" failed.
dpkg: error processing cups (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I'm running under Ubuntu Oneiric Ocelot, x64. I'm not sure where to start to debug this. I appreciate any suggestions any of you may have.

share|improve this question
Sounds like cups failed to start for some reason. When you try to start it manually, what happens? – Faheem Mitha Oct 10 '11 at 0:58
up vote 3 down vote accepted

Something is wrong with the configuration of CUPS (network printing infrastructure for Linux). If CUPS is not the problem you're trying to fix, you can work around it for now by removing CUPS (apt-get remove cups), and then re-trying the apt-get -f install.

If you're interested in diagnosing the CUPS problem, you can try a couple things to figure out what's going on. apt-get is effectively running start cups (older Ubuntu and other distros would be running /etc/init.d/cups start or service cups start). You can run that manually to see if it says anything useful (probably not). Check for recently changed logs (ls -ltra /var/log) and see if any of them provide hints (often daemon programs like CUPS will write any error or warnings to a log file).

Also, check the cups configuration file /etc/cups/cupsd.conf and see if anything looks incorrect.

Presumably this didn't happen out of the blue, though. What was going wrong that inspired you to run apt-get -f install in the first place?

share|improve this answer
Ubuntu is now using upstart instead of SysV-like init scripts, so the command to run is start cups and the config file to look for problems is /etc/init/cups. – Riccardo Murri Oct 10 '11 at 9:50
Thanks for pointing that out. I've updated the answer to include these details. – P.T. Oct 10 '11 at 17:40
Sorry I wasn't clear: /etc/init/cups is the upstart configuration file that controls cups startup; the configuration file for CUPS itself is still /etc/cups/cupsd.conf. – Riccardo Murri Oct 10 '11 at 18:59
Hm. I removed cups and then re-ran apt-get -f install, and it didn't even try to install cups over again. I would be lying if I said that I understood why I uninstalled a broken dependency and now it is no longer a dependency. – Zéychin Oct 10 '11 at 19:07
To answer your question (from your answer): I needed to install a package which uses cups. It, assumedly, failed on the same script, but I never saw this output because the terminal was closed by someone else when I was away from the computer. I was getting some very broken behavior and hoped that resolving dependencies and then reinstalling the mentioned package may fix this. – Zéychin Oct 10 '11 at 19:10

The problem is, upstart can't start cups daemon. I have seen this problem since Sept. I hoped the stable release solve this bug.

I'm lazy and I didn't solve it, but I did small workaround (only for desktops with local printers):

mv /etc/apparmor.d/usr.sbin.cupsd /etc/apparmor.d/bad_profiles/
# apparmor complains about cups profile

rm -f /etc/init.d/cups
# this is link to upstart-job

and I use init script (/etc/init.d/cups) like this:

# PATH should only include /usr/* if it runs after the mountnfs.sh script
DESC="Common Unix Printing Daemon"

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon --start --verbose --user lp --group lpadmin --pid $PIDFILE \
                --exec $DAEMON --test || return 1
        start-stop-daemon --start --verbose --user lp --group lpadmin --pidfile $PIDFILE \
                --exec $DAEMON -- $DAEMON_ARGS || return 2
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.
        #echo `pidof cupsd`>$PIDFILE

        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"

do_reload() {
        # If the daemon can reload its configuration without
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        start-stop-daemon --stop --signal 1 --verbose --pidfile $PIDFILE --name $NAME
        return 0

case "$1" in
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
      [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
        # If do_reload() is not implemented then leave this commented out
        # and leave 'force-reload' as an alias for 'restart'.
        #log_daemon_msg "Reloading $DESC" "$NAME"
        #log_end_msg $?
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        log_daemon_msg "Restarting $DESC" "$NAME"
        case "$?" in
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                # Failed to stop
                log_end_msg 1
       echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
        exit 3

exit 0

Next you can write (as root):

# apt-get install -f

And you have to have bash.

share|improve this answer
Please, do some research on how to properly format your answers. – forcefsck Oct 16 '11 at 14:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.