domenica 25 novembre 2012

Bug in Debian stable in the upgrade process, how to solve it.

I'm happy with my debian stable, but still a bug can happen, and the worst bug is that which happens in the upgrade process, so that you are unable to upgrade your system and the bug will remain there forever - say, like a diamond, a bug in stable in the upgrade process is forever..

..unless you have a friend like David Paleino or you found this post.

The problem:

The problem raised at a certain point when, trying to apt-get update && apt-get upgrade, I got:

=====

[CUT]

insserv: Starting smfpd depends on rc.local and therefore on system facility `$all' which can not be true!

[CUT]

=====

and the Network Manager process was killed. Huh?

The solution:

Edit /etc/init.d/smfpd (a golden rule is to make a backup before). Copy and paste this one in place of your old one:

=====

#!/bin/sh

### BEGIN INIT INFO
# Provides:          smfpd
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Xerox Unified Linux Driver LPT Support daemon
# Description:       Enable support for LPT port service
### END INIT INFO

# smfpd is a parallel port handling daemon. It needs root privileges
# to use iopl(2), inb(2) and outb(2) system calls.
#
# smfpd uses inet domain socket, this script should be run
# after network initialization.
#
# This script is a part of Unified Linux Driver package.
# If your MFP device is not connected to LPT port, you can safely
# disable execution of this script - uncomment 'exit 0' at the next line.
# exit 0

SMFPD=/usr/sbin/smfpd
test -x $SMFPD || exit 5

PATH=/usr/sbin:/sbin:/usr/bin:/bin
SMFPD=smfpd

PROCESS_PID=`ps ax | grep "[0-9]:[0-9][0-9] $SMFPD" | awk '{print $1}'`

case "$1" in
check)
if test -z "$PROCESS_PID"; then
echo "Process is not running"
else
echo "Process $SMFPD[$PROCESS_PID] is running"
fi
;;
start)
if test -z "$PROCESS_PID"; then
echo -n "Starting smfpd daemon ... "
$SMFPD
echo "done"
$0 check
else
echo "Process $SMFPD[$PROCESS_PID] is already running"
fi
;;
stop)
if test -n "$PROCESS_PID"; then
echo -n "Stopping smfpd daemon ... "
kill -TERM $PROCESS_PID
echo "done"
else
echo "Process is not running"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {check|start|stop|restart}"
exit 1
;;
esac

exit 0

=====

Actually, the section you need to add is the one starting at ###BEGIN and ending at ###END, in which the dependencies are listed. If you are not sure, just copy and paste everything..
Then, run apt-get -f install.

et voila! Solved. 

The explanation:

The problem raised during the transition from "classic sysvinit" to "sysvinit + insserv". Insserv was missing the information regarding the smfpd dependency, so it assumed to need $all, but other stuff was missing smfpd, hence -> LOOP!