因此在安装 Prey 防盗软件时会出现此错误:
Installing init scripts.
dpkg: error processing package prey (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
prey
您可以使用此链接了解错误信息。
所以这个错误消息告诉我们安装后脚本有错误......这对我们没有太大的帮助。
有人遇到过这样的问题并知道如何解决吗?(类似的问题已发布在论坛上https://help.preyproject.com/topics但没有任何有用的答案)
- 编辑 -
这是prey.postinst
脚本:
#!/bin/bash -x
####################################################################
# Prey Debian Postinst Script
# Written by Tomás Pollak <[email protected]> - (c) 2011 Fork Ltd.
# License: GPLv3
####################################################################
set -e
VERSION='1.3.8'
BASE_PATH="/usr/lib/prey"
INSTALL_PATH="${BASE_PATH}/versions/${VERSION}"
PREY_BIN="bin/prey"
PREY_USER="prey"
TEMP_OLD_CONFIG="/tmp/prey-config.old"
get_current_user() {
export PS_FORMAT=user:16,command
ps ax | grep ssh-agent | grep -v grep | cut -d' ' -f1 | head -1
}
case "$1" in
configure)
if [ -d /usr/share/prey ]; then
echo "Previous installation found. Removing..."
if [ -f /usr/share/prey/config.backup ]; then
cp /usr/share/prey/config.backup "$TEMP_OLD_CONFIG"
else
cp /usr/share/prey/config "$TEMP_OLD_CONFIG" || true
fi
if [ -f "$TEMP_OLD_CONFIG" ]; then
chmod 666 "$TEMP_OLD_CONFIG"
fi
# remove from root crontab
(crontab -l 2> /dev/null | grep -v prey || true) | crontab -
# remove from prey crontab, if present
if test "$(id ${PREY_USER} 2> /dev/null)"; then
(crontab -u $PREY_USER -l 2> /dev/null | grep -v prey || true) | crontab -u $PREY_USER -
fi
# wipe out old folder
rm -Rf /usr/share/prey
fi
cd "$INSTALL_PATH"
# as root, set up init script and activate current installation
"$PREY_BIN" config hooks post_install
# check if API_KEY env var was passed
if [ -n "$API_KEY" ]; then
echo "API Key detected! Verifying..."
"$PREY_BIN" config account authorize -a "$API_KEY"
else # no API key, so let's show up the GUI
# before firing gui, allow prey user to access current X screen
if [ -n "$(which xhost)" ]; then
CURRENT_USER=$(get_current_user)
if [ -n "$CURRENT_USER" ]; then
su $CURRENT_USER -c "DISPLAY=:0.0 xhost +si:localuser:${PREY_USER}" || true
fi
fi
# run config gui as prey user, previously checking for old config keys
DISPLAY=:0.0 su $PREY_USER -c "$PREY_BIN config gui --check-file $TEMP_OLD_CONFIG"
fi
rm -f "$TEMP_OLD_CONFIG"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
答案1
我查看了prey.postinst
脚本,在 /var/lib/dpkg/info 中找到,并用来set -x
定位错误。第 72 行似乎出了问题:
DISPLAY=:0.0 su $PREY_USER -c "$PREY_BIN config gui --check-file $TEMP_OLD_CONFIG"
注释掉这一行之后我就能完成安装(sudo apt-get install -f)。
我还删除了prey-config-XXXXXXXXXXXXXXX.log
位于 /temp/ 文件夹中的文件(如果有)
- 编辑 -
因此在 the_Seppi 的帮助下我将该行修改如下:
env DISPLAY=:0.0 gksu $PREY_USER "$PREY_BIN config gui --check-file $TEMP_OLD_CONFIG"
然后可以使用sudo dpkg --configure -a