我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 (- <none>)
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 <none>
D000400: checking breaker fdisk:amd64 virtbroken <none>
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
软件包的情况下重新启动。
我不知道该怎么办。任何帮助都将不胜感激。
答案1
我正在运行 Debian vanilla,但是同样的症状也发生在我身上,并且我找到了解决办法——我发布了这个答案,希望它能帮助某人从中恢复过来。
在 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 的情况下可以正常运行(一段时间 - 这存在磁盘寿命问题,尤其是对于 SSD),因此我注释掉了所有 fstrim 命令,并dpkg --configure util-linux
成功重新运行。
希望能帮助到你!