几天前我运行了apt update,但它从未完成。我ctrl-c杀了它,它说我需要dpkg --configure -a。我这样做了,它试图配置util-linux。然而,它从未结束。昨晚我甚至让它运行了超过12个小时,但它没有结束。它也不提供任何错误输出。它只是挂着。
$ sudo dpkg --configure -a
Setting up util-linux (2.34-0.1ubuntu2.2) ...我试着用详细的调试来运行它,但仍然看不到有用的输出。
$ sudo dpkg --configure -a -D42442
D000040: checking dependencies of util-linux:amd64 (- )
D000400: checking group ...
D000400: checking possibility -> fdisk
D000400: checking non-provided pkg fdisk:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> login
D000400: checking non-provided pkg login:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libaudit1
D000400: checking non-provided pkg libaudit1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libblkid1
D000400: checking non-provided pkg libblkid1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libc6
D000400: checking non-provided pkg libc6:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libcap-ng0
D000400: checking non-provided pkg libcap-ng0:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libmount1
D000400: checking non-provided pkg libmount1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libpam0g
D000400: checking non-provided pkg libpam0g:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libselinux1
D000400: checking non-provided pkg libselinux1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libsmartcols1
D000400: checking non-provided pkg libsmartcols1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libsystemd0
D000400: checking non-provided pkg libsystemd0:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libtinfo6
D000400: checking non-provided pkg libtinfo6:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libudev1
D000400: checking non-provided pkg libudev1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> libuuid1
D000400: checking non-provided pkg libuuid1:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000400: checking group ...
D000400: checking possibility -> zlib1g
D000400: checking non-provided pkg zlib1g:amd64
D000400: is installed, ok and found
D000400: found 3
D000400: found 3 matched 0 possfixbytrig -
D000040: ok 2 msgs >><<
D000040: checking Breaks
D000400: checking breaker login:amd64 virtbroken
D000400: checking breaker fdisk:amd64 virtbroken
Setting up util-linux (2.34-0.1ubuntu2.2) ...
D000002: fork/exec /var/lib/dpkg/info/util-linux.postinst ( configure 2.34-0.1ubuntu2.1 )它只是坐着挂在那里。
在未配置包时,我无法运行任何其他apt命令,而且如果没有正确安装的util-linux包,我不希望重新启动。
我不知道该怎么办。任何帮助都将不胜感激。
发布于 2020-05-23 17:53:34
我在使用Debian香草,但同样的症状也发生在我身上,我找到了一个解决方案--我发布了这个答案,以防有人从这个问题中恢复过来。
在util-linux.postinst上挂起之后,我编辑了前面提到的postinst文件,以添加一堆日志记录:
#!/bin/sh
set -e
LOGFILE=/root/log.file
echo "Environment: " >$LOGFILE
env >>$LOGFILE
echo "update-alternatives" >>$LOGFILE
update-alternatives --install /usr/bin/pager pager /bin/more 50 \
--slave /usr/share/man/man1/pager.1.gz pager.1.gz \
/usr/share/man/man1/more.1.gz
# We stopped shipping the 'pg' utility, so remove it as a pager
# alternative on upgrades from Stretch.
echo "update-alternatives remove pager" >>$LOGFILE
update-alternatives --remove pager /usr/bin/pg
# Automatically added by dh_installinit/13.1
echo "step 3" >>$LOGFILE
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/hwclock.sh" ]; then
update-rc.d hwclock.sh defaults >/dev/null || exit 1
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.1
echo "step 4" >>$LOGFILE
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'fstrim.timer' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'fstrim.timer'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'fstrim.timer' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'fstrim.timer' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.1
echo "step 5" >>$LOGFILE
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
echo "step 5.1" >>$LOGFILE
if [ -d /run/systemd/system ]; then
echo "step 5.2" >>$LOGFILE
systemctl --system daemon-reload >/dev/null || true
echo "step 5.3" >>$LOGFILE
if [ -n "$2" ]; then
echo "step 5.4" >>$LOGFILE
_dh_action=restart
else
echo "step 5.5" >>$LOGFILE
_dh_action=start
fi
echo "step 5.6" >>$LOGFILE
deb-systemd-invoke $_dh_action 'fstrim.timer' >/dev/null || true
echo "step 5.7" >>$LOGFILE
fi
echo "step 5.8" >>$LOGFILE
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.1
echo "step 6" >>$LOGFILE
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'fstrim.service' >/dev/null || true
fi
fi
# End automatically added section
echo "step 7" >>$LOGFILE通过检查/root/log.file中的输出,我发现步骤5.6是阻止程序。手动运行systemctl命令也会导致挂起。一个快速的谷歌建议,如果没有fstrim,系统会运行得很好(在一段时间内--这会导致磁盘寿命问题,特别是对于SSDs),所以我注释掉了所有fstrim命令,并成功地重新运行了dpkg --configure util-linux。
希望能帮上忙!
https://askubuntu.com/questions/1208030
复制相似问题