我在跑20.04.2 LTS (Focal Fossa)
我已经好几天没运行了aptitude
。它一直运行良好,但现在我尝试运行它时,每次运行时它都会给我“e Examine”对话框。当我输入“e”时,它会运行 10-20 分钟,页面顶部会显示以下内容:
open: aaa; closed: bbb; defer: ccc; conflict: ddd
其中‘aaa’、‘bbb’、‘ccc’、‘ddd’均为不断增加的数值……且‘aaa’和‘bbb’增长迅速,最高可达50000以上。
过了一会儿,aptitude
就退出了。
此时,如果我运行dpkg --configure -a
,它会迅速返回到命令提示符,没有任何错误。但是,当我运行 时apt-get install -f
,我得到了一个包含 1,000 多个软件包名称的列表,后面跟着这个...
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
这些包裹中的大部分(实际上可能是全部)都是我日常使用的物品,因此不应将其移除。
哦,另外,如果我捕获执行时显示的大量软件包列表apt-get install -f
,并且如果我apt install PKG
为每个软件包名称生成一千个左右的命令,然后运行这个命令,我只会为这些命令中的每一个获得相同的一千个左右的软件包的多个列表,然后在每次apt install PKG
运行后出现相同的“使用 sudo apt autoremove”消息。
不知何故,我的apt
缓存似乎被破坏了。我不知道是什么原因造成的。
然而,我真的不想花时间去弄清楚为什么发生了这种情况。我只想修复它,以便所有这些包再次正确安装并可通过 进行管理apt
。
有人能指出可以帮助我的文档,或者可以提出解决方案吗?
提前非常感谢您。
附言:我的/etc/apt/sources.list
已经好几个星期没有变化了,里面的文件也/etc/apt/source.list.d
很长时间没有变化了。实际上,/etc/apt
自几个月前以来,下面的内容似乎都没有变化。
聚苯硫醚*:以下是最后十几行/var/log/apt/history.log
……
Start-Date: 2021-07-24 20:01:24
Requested-By: ljz (1000)
Install: linux-headers-5.4.0-80-generic:amd64 (5.4.0-80.90, automatic), linux-modules-5.4.0-80-generic:amd64 (5.4.0-80.90, automatic), linux-headers-5.4.0-80:amd64 (5.4.0-80.90, automatic), linux-image-5.4.0-80-generic:amd64 (5.4.0-80.90, automatic), linux-modules-extra-5.4.0-80-generic:amd64 (5.4.0-80.90, automatic)
Upgrade: networkd-dispatcher:amd64 (2.0.1-1, 2.1-2~ubuntu20.04.1), linux-headers-generic:amd64 (5.4.0.77.80, 5.4.0.80.84), linux-libc-dev:amd64 (5.4.0-77.86, 5.4.0-80.90), libcurl4:amd64 (7.68.0-1ubuntu2.5, 7.68.0-1ubuntu2.6), ruby2.7:amd64 (2.7.0-5ubuntu1.4, 2.7.0-5ubuntu1.5), libsystemd0:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), linux-image-generic:amd64 (5.4.0.77.80, 5.4.0.80.84), libsystemd-dev:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), python3-pip:amd64 (20.0.2-5ubuntu1.5, 20.0.2-5ubuntu1.6), udev:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), ruby2.7-dev:amd64 (2.7.0-5ubuntu1.4, 2.7.0-5ubuntu1.5), ruby2.7-doc:amd64 (2.7.0-5ubuntu1.4, 2.7.0-5ubuntu1.5), libudev1:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), systemd-timesyncd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), libxnvctrl0:amd64 (460.73.01-0ubuntu0.20.04.1, 470.57.01-0ubuntu0.20.04.1), libglib2.0-dev-bin:amd64 (2.64.6-1~ubuntu20.04.3, 2.64.6-1~ubuntu20.04.4), libruby2.7:amd64 (2.7.0-5ubuntu1.4, 2.7.0-5ubuntu1.5), systemd-sysv:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), libglib2.0-bin:amd64 (2.64.6-1~ubuntu20.04.3, 2.64.6-1~ubuntu20.04.4), libpam-systemd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), libglib2.0-dev:amd64 (2.64.6-1~ubuntu20.04.3, 2.64.6-1~ubuntu20.04.4), libglib2.0-doc:amd64 (2.64.6-1~ubuntu20.04.3, 2.64.6-1~ubuntu20.04.4), systemd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), libnss-systemd:amd64 (245.4-4ubuntu3.7, 245.4-4ubuntu3.11), libglib2.0-data:amd64 (2.64.6-1~ubuntu20.04.3, 2.64.6-1~ubuntu20.04.4), curl:amd64 (7.68.0-1ubuntu2.5, 7.68.0-1ubuntu2.6), linux-generic:amd64 (5.4.0.77.80, 5.4.0.80.84), python-pip-whl:amd64 (20.0.2-5ubuntu1.5, 20.0.2-5ubuntu1.6), libglib2.0-0:amd64 (2.64.6-1~ubuntu20.04.3, 2.64.6-1~ubuntu20.04.4), libcurl3-gnutls:amd64 (7.68.0-1ubuntu2.5, 7.68.0-1ubuntu2.6)
End-Date: 2021-07-24 20:02:46
Start-Date: 2021-07-25 19:31:25
Requested-By: ljz (1000)
Remove: linux-modules-extra-5.4.0-74-generic:amd64 (5.4.0-74.83), linux-modules-extra-5.4.0-73-generic:amd64 (5.4.0-73.82)
End-Date: 2021-07-25 19:31:28
Start-Date: 2021-07-27 18:56:53
Requested-By: ljz (1000)
Upgrade: libaspell15:amd64 (0.60.8-1build1, 0.60.8-1ubuntu0.1), aspell:amd64 (0.60.8-1build1, 0.60.8-1ubuntu0.1), libmysqlclient21:amd64 (8.0.25-0ubuntu0.20.04.1, 8.0.26-0ubuntu0.20.04.2), teamviewer:amd64 (15.19.3, 15.20.3)
End-Date: 2021-07-27 18:57:05
aptitude
2021-07-24 左右运行良好,所以任何破坏我的设置的事情一定发生在那之后。
输出sudo aptitude search ?broken
iB anydesk - The fastest remote desktop software on the market.
iBA apt - commandline package manager
iBA aptitude - terminal-based package manager
iBA base-files - Debian base system miscellaneous files
iBA base-passwd - Debian base system master password and group files
iBA bash - GNU Bourne Again SHell
iBA bsdutils - basic utilities from 4.4BSD-Lite
iB chromium-common - web browser - common resources used by the chromium packages
iB chromium-sandbox - web browser - setuid security sandbox for chromium
iB containerd.io - An open and reliable container runtime
iBA coreutils - GNU core utilities
iBA dash - POSIX-compliant shell
iBA debianutils - Miscellaneous utilities specific to Debian
iBA diffutils - File comparison utilities
iBA dpkg - Debian package management system
iBA e2fsprogs - ext2/ext3/ext4 file system utilities
iBA fdisk - collection of partitioning utilities
iBA findutils - utilities for finding files--find, xargs
iB google-chrome-stable - The web browser from Google
iBA grep - GNU grep, egrep and fgrep
iBA gzip - GNU compression utilities
iBA hostname - utility to set/show the host name or domain name
iBA libc-bin - GNU C Library: Binaries
iBA libcurl3-gnutls - easy-to-use client-side URL transfer library (GnuTLS flavour)
iBA libglib2.0-0 - GLib library of C routines
iBA libnss-systemd - nss module providing dynamic user and group name resolution
iBA libpam-systemd - system and service manager - PAM module
iBA libsystemd0 - systemd utility library
iBA libudev1 - libudev shared library
iBA linux-base - Linux image base package
iBA linux-headers-5.4.0-80-generic - Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
iBA linux-image-5.4.0-80-generic - Signed kernel image generic
iBA linux-image-generic - Generic Linux kernel image
iBA linux-modules-extra-5.4.0-80-generic - Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
iBA login - system login tools
iBA mount - tools for mounting and manipulating filesystems
iBA ncurses-bin - terminal-related programs and man pages
iB net.downloadhelper.coapp - Video DownloadHelper companion app
iBA networkd-dispatcher - Dispatcher service for systemd-networkd connection status changes
iB ocenaudio - Ocenaudio is a fast, cross-platform audio editor.
iB palemoon - Firefox-based, efficient and easy to use web browser
iBA perl-base - minimal Perl system
iB rpi-imager - Raspberry Pi imaging utility
iBA sed - GNU stream editor for filtering/transforming text
iB signal-desktop - Private messaging from your desktop
iB signal-desktop-beta - Private messaging from your desktop
iBA systemd - system and service manager
iBA systemd-timesyncd - minimalistic service to synchronize local time with NTP servers
iBA sysvinit-utils - System-V-like utilities
iBA tar - GNU version of the tar archiving utility
iBA util-linux - miscellaneous system utilities
iB vdpau-va-driver - VDPAU-based backend for VA API
iB zoom - Zoom, #1 Video Conferencing and Web Conferencing Service
更多内容如下:
% sudo apt update
Hit:1 https://linux.teamviewer.com/deb stable InRelease
Hit:2 https://updates.signal.org/desktop/apt xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Hit:7 http://archive.canonical.com/ubuntu focal InRelease
Fetched 214 kB in 1s (178 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
% sudo apt list --upgradeable
Listing... Done
signal-desktop-beta/xenial 5.11.0-beta.3 amd64 [upgradable from: 5.8.0-beta.1]
signal-desktop/xenial 5.10.0 amd64 [upgradable from: 5.9.0]
ubuntu-advantage-tools/focal-updates 27.2.2~20.04.1 amd64 [upgradable from: 27.1~20.0
% sudo apt-get install -f
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
fonts-ubuntu fonts-uralic fotoxx fotoxx-common friendly-recovery ftp gdal-data gegl genisoimage geoclue-2.0 geoip-database
[ ... more than 100 lines containing more package names ... ]
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
还有更多...
grep -r "^deb" /etc/apt/ --include=*.list
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ focal restricted main universe multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates restricted main universe multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-updates universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
/etc/apt/sources.list:deb http://archive.canonical.com/ubuntu focal partner
/etc/apt/sources.list:deb-src http://archive.canonical.com/ubuntu focal partner
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu focal-security main restricted
/etc/apt/sources.list:deb-src http://security.ubuntu.com/ubuntu focal-security restricted main universe multiverse
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu focal-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu focal-security multiverse
/etc/apt/sources.list.d/teamviewer.list:deb https://linux.teamviewer.com/deb stable main
/etc/apt/sources.list.d/signal-xenial.list:deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main
可能的解决方案...
如果我执行以下操作会怎样?...
- 跑步
sudo apt-get install -f >apt-installs
- 编辑该文件,删除软件包名称前后的行,并在每行开头添加“sudo apt install”
- 运行“sudo apt autoremove”
- 运行“bash apt-installs”来重新安装每个包。
以下是第 2 步之后“apt-installs”文件的样子……
sudo apt install accountsservice acpi-support acpid adb alsa-base android-libadb android-libbase android-libboringssl android-libcrypto-utils
sudo apt install android-libcutils android-liblog android-sdk-platform-tools-common apt-rdepends aptdaemon aptdaemon-data apturl apturl-common
sudo apt install aria2 audacious audacious-plugins audacious-plugins-data bind9-dnsutils blueman bluez bluez-cups brltty brltty-x11 brotli
sudo apt install busybox-static byobu catdoc catfish cheese-common cinnamon-desktop-data cinnamon-l10n clang-format-11 clang-tidy-11
sudo apt install clang-tools-11 command-not-found cppcheck cvs dc dctrl-tools debhelper debtree devilspie devilspie2 dh-autoreconf
sudo apt install dh-elpa-helper dh-strip-nondeterminism diffstat distro-info dmz-cursor-theme doc-base docbook-xml dwz efibootmgr elfutils
[ ... etc. ... for more than 100 lines ]
大家觉得怎么样?这能解决我的问题吗?
更多后续...
在对 进行更多调查后apt
,我现在发现sudo apt autoremove
确实会卸载所有这些软件包。超过 1,000 个软件包,此后我的系统确实将变得无法使用。而且我不清楚运行所有这些sudo apt install ...
命令是否有效,因为许多其他软件将被卸载。
所以,我仍然陷入困境。:(
我不想卸载任何软件。我只想让缓存apt
恢复到可用状态,而不更改任何现有的软件安装。
答案1
我找到了解决这个问题的方法。我需要删除并重新安装所有这 1,000 多个软件包,我一个接一个地这样做。然后我需要重新安装aptitude
。为了完成此修复,我执行了以下步骤...
步骤1:
% sudo apt-get install -f >apt-installs
运行此程序后,apt-installs
文件包含此数据...
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
activity-log-manager apg audacious audacious-plugins cppcheck cracklib-runtime dh-strip-nondeterminism docbook-xml
[ ... more than 180 lines containing lists of package names ... ]
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
第2步:
我编辑了此apt-installs
文件以删除顶部 4 行和底部 2 行,然后重新格式化它,以便每行有一个包名称。
步骤3:
我将字符串添加fixit
到每行的开头。
步骤4:
我创建了一个名为的 shell 函数,fixit
用于删除然后安装指定的包,并将该函数放在文件顶部apt-installs
。然后,下面是前十几行代码的样子apt-installs
……
fixit() {
[[ $# -lt 1 ]] && return 0
package="${1}"
shift
echo "### fixing ${package}"
apt-get -y remove "${package}"
apt-get -y install "${package}"
echo ''
}
fixit activity-log-manager
fixit apg
fixit audacious
fixit audacious-plugins
fixit cppcheck
fixit cracklib-runtime
fixit dh-strip-nondeterminism
fixit docbook-xml
fixit gkbd-capplet
fixit gnome-bluetooth
fixit gnome-control-center-data
[ ... etc. ... more than 1,500 lines ]
步骤5:
我运行了这个:
% sudo bash apt-installs
这将删除并重新安装每个包。
对每个包进行这种逐个“删除/安装”操作的优点是,在任意时刻都只卸载一个包然后重新安装,而不是通过某个方式删除超过 1,500 个软件,apt autoremove
从而导致我的系统无法运行。
第 6 步:
然后我运行了这两个命令......
% sudo apt-get purge aptitude
% sudo apt-get install aptitude
在我执行此操作之前,aptitude
即使重新安装了所有软件包,系统仍然会挂起并崩溃。此清除/安装修复了aptitude
崩溃问题。
现在,、、apt
和apt-get
都已aptitude
恢复正常运行,我的系统仍然可以使用。
结局好一切都好。
答案2
通常,可以通过删除自动卸载的软件包来解决此类问题
sudo apt autoremove
然后通过以下方式以交互模式启动 Aptitude:
sudo aptitude
然后击中F10,操作→取消待处理的操作,然后g确保一切正常。