首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >apt忘记了1000多个软件包,我无法重新安装

apt忘记了1000多个软件包,我无法重新安装
EN

Ask Ubuntu用户
提问于 2021-07-28 03:19:04
回答 1查看 305关注 0票数 3

我在运行20.04.2 LTS (Focal Fossa)

我有几天没有运行aptitude了。它总是工作的很好,但当我现在尝试,它开始给我"e检查“对话框,每次我运行它。当我键入"e“时,它将运行10-20分钟,页面顶部显示如下内容:

代码语言:javascript
复制
open: aaa; closed: bbb; defer: ccc; conflict: ddd

其中'aaa','bbb','ccc','ddd‘正在增加数值.而“aaa”和“bbb”正在迅速增长,高达5万多。

过了一会儿,aptitude就退出了。

此时,如果我运行dpkg --configure -a,它将很快返回到命令提示符,没有错误。但是,当我运行apt-get install -f时,我得到了一个超过1000个包名的列表,后面跟着这个.

代码语言:javascript
复制
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

这些包中的大多数(实际上可能全部)都是我日复一日使用的项目,不应该删除它们。

哦,同样,如果我捕获了在执行apt-get install -f时显示的大量包列表,如果我为每个包名生成了大约1000个apt install PKG命令,然后运行这个命令,我只会得到多个列表,其中每个命令的包都是相同的1000个左右的包,然后在每次运行apt install PKG之后都会发出同样的“使用sudo apt自动删除”消息。

不知怎么的,我的apt缓存似乎被冲洗了。我不知道是什么导致了这一切。

但是,我真的不想花时间去弄清楚为什么会发生这种情况。我只想修复它,这样所有的包都可以通过apt重新正确地安装和管理。

有人能帮我找到能帮我的医生吗?或者建议一个解决方案?

先谢谢你。

<#>PS:我的/etc/apt/sources.list已经几个星期没有改变了,/etc/apt/source.list.d中的任何文件也很长时间没有改变。实际上,自几个月前以来,在/etc/apt下似乎没有任何变化。

PPS*:下面是/var/log/apt/history.log的最后十几行代码.

代码语言:javascript
复制
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左右运行良好,所以无论是什么破坏了我的设置,肯定是在那之后发生的。

Output of sudo aptitude search ?broken

代码语言:javascript
复制
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          

And这里有更多信息:

代码语言:javascript
复制
% 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.

Still更多.

代码语言:javascript
复制
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

Possible解决方案……

如果我做下面的事呢..。

  1. 运行sudo apt-get install -f >apt-installs
  2. 编辑该文件,删除包名前面的行,并在每一行的开头加上"sudo apt install“。
  3. 运行"sudo apt自动删除“
  4. 运行"bash apt安装“来重新安装每个软件包。

以下是第二步之后的“apt安装”文件的样子.

代码语言:javascript
复制
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 ]

你们觉得怎么样?这能解决我的问题吗?

More跟踪.

在对apt进行了更多的研究之后,我现在看到sudo apt autoremove确实会卸载所有这些软件包。那是超过1000个包,我的系统在那之后确实会变得很难用。我不清楚运行所有这些sudo apt install ...命令是否有效,因为这么多的其他软件都会被卸载。

所以我还是被困住了。:(

我不想卸载任何软件。我只想让apt缓存恢复到可用状态,而不更改任何现有的软件安装。

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2021-07-28 19:10:00

我想出了解决这个问题的方法。我需要删除和重新安装所有的1000多个软件包,我这样做了一个接一个。然后我需要重新安装aptitude。为了解决这个问题,我执行了以下步骤.

Step 1:

代码语言:javascript
复制
% sudo apt-get install -f >apt-installs

运行这个之后,apt-installs文件包含了这些数据.

代码语言:javascript
复制
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.

Step 2:

我编辑了这个apt-installs文件以删除前4行和底部2行,并对其进行了重新格式化,以便每行有一个包名。

Step 3:

我将字符串fixit加到每一行的开头。

Step 4:

我创建了一个名为fixit的shell函数,以删除并安装指定的包,并将该函数放在apt-installs文件的顶部。接下来,下面是apt-installs前十几行的样子.

代码语言:javascript
复制
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 ]

Step 5:

我查过这个:

代码语言:javascript
复制
% sudo bash apt-installs

这将删除并重新安装每个包。

这些零碎的“删除/安装”运行在每个包的优点是,只有一个,单个软件包被卸载,然后在任何时候重新安装,而不是吹走1,500多个软件通过一个apt autoremove,从而使我的系统无法运行。

Step 6:

然后我运行了这两个命令。

代码语言:javascript
复制
% sudo apt-get purge aptitude
% sudo apt-get install aptitude

在我这么做之前,aptitude仍然是挂着和崩溃的,即使在所有软件包重新安装之后。这个清除/安装修复了aptitude崩溃。

现在,aptapt-getaptitude再次正常工作,我的系统仍然可用。

结局好,一切都好。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1354491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档