当我运行时apt-get -f install
,我得到以下异常输出:
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:
cups
E: Sub-process /usr/bin/dpkg returned an error code (1)
我在下面奔跑Ubuntu Oneiric Ocelot,x64。我不知道从哪里开始调试这个。我很感激你们提出的任何建议。
答案1
配置有问题计算机辅助系统(Linux 的网络打印基础设施)。如果 CUPS 不是您要解决的问题,您可以暂时解决该问题,方法是删除 CUPS ( apt-get remove cups
),然后重新尝试apt-get -f install
.
如果您有兴趣诊断 CUPS 问题,您可以尝试一些方法来弄清楚发生了什么。 apt-get
正在有效运行start cups
(较旧的 Ubuntu 和其他发行版将运行/etc/init.d/cups start
或service cups start
)。您可以手动运行它,看看它是否显示任何有用的信息(可能没有)。检查最近更改的日志 ( ls -ltra /var/log
) 并查看其中是否有任何提供提示(通常像 CUPS 这样的守护程序会将任何错误或警告写入日志文件)。
另外,请检查杯子配置文件 /etc/cups/cupsd.conf
看看是否有什么地方看起来不正确。
不过,想必这并不是突然发生的。到底是什么问题促使你apt-get -f install
开始跑步的?
答案2
问题是,upstart 无法启动cups 守护进程。我从九月份就发现了这个问题。我希望稳定版本能够解决这个错误。
我很懒,没有解决这个问题,但我做了一些小解决方法(仅适用于台式机使用本地打印机):
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
我使用初始化脚本(/etc/init.d/cups),如下所示:
#!/bin/bash
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Common Unix Printing Daemon"
NAME=cupsd
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/cups/$NAME.pid
#SCRIPTNAME=/etc/init.d/$NAME
SCRIPTNAME=./$NAME
# 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
do_start()
{
# 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.
#$DAEMON $DAEMON_ARGS &
#echo `pidof cupsd`>$PIDFILE
}
do_stop()
{
# 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="$?"
[ "$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
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# 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"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
接下来你可以写(作为root):
# apt-get install -f
而且你必须有bash。