AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1354491
Accepted
HippoMan
HippoMan
Asked: 2021-07-28 19:19:04 +0800 CST2021-07-28 19:19:04 +0800 CST 2021-07-28 19:19:04 +0800 CST

apt 忘记了超过 1,000 个软件包,我无法重新安装

  • 772

我在跑20.04.2 LTS (Focal Fossa)

aptitude我已经有几天没有跑步了。它总是运行良好,但是当我现在尝试它时,每次运行它时它都会开始给我“e 检查”对话框。当我输入“e”时,它会运行 10-20 分钟,页面顶部会显示以下内容:

open: aaa; closed: bbb; defer: ccc; conflict: ddd

其中 'aaa', 'bbb', 'ccc', 'ddd' 是递增的数值……而 'aaa' 和 'bbb' 快速增加,高达 50,000 以上。

过了一会儿,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的命令然后运行它,我只会得到相同千或-so 为每个命令打包,然后在每次apt install PKG运行后显示相同的“使用 sudo apt autoremove”消息。

不知何故,我的apt缓存似乎已经被冲洗掉了。我不知道是什么原因造成的。

但是,我真的不想花时间去弄清楚为什么会发生这种情况。我只想修复它,以便所有这些软件包再次正确安装并通过apt.

任何人都可以向我指出可以帮助我的文档,或者提出解决方案吗?

非常感谢您提前。

PS:我/etc/apt/sources.list的几个星期没有改变,也没有任何文件在/etc/apt/source.list.d很长一段时间内改变。实际上,/etc/apt自几个月前以来,似乎没有任何变化。

PPS *:这是最后十几行/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 年 7 月 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

可能的解决方案...

如果我执行以下操作怎么办?...

  1. 跑sudo apt-get install -f >apt-installs
  2. 编辑该文件,删除包名称前后的行,并将“sudo apt install”放在每行的开头
  3. 运行“sudo apt autoremove”
  4. 运行“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确实会卸载所有这些包。那是1000多个包,之后我的系统确实会变得无法使用。而且我不清楚运行所有这些sudo apt install ...命令是否会起作用,因为会卸载很多其他软件。

所以,我还是卡住了。:(

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

apt
  • 2 2 个回答
  • 240 Views

2 个回答

  • Voted
  1. Best Answer
    HippoMan
    2021-07-29T11:10:00+08:002021-07-29T11:10:00+08:00

    我想出了如何解决这个问题。我需要删除并重新安装所有这些 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步:

    我创建了一个名为fixit删除然后安装指定包的 shell 函数,并将该函数放在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都可以正常工作了,我的系统仍然可以使用。

    一切都很好,结局很好。

    • 1
  2. N0rbert
    2021-07-28T19:46:09+08:002021-07-28T19:46:09+08:00

    通常这些问题可以通过移除自动移除包来解决

    sudo apt autoremove
    

    然后在交互模式下启动 Aptitude

    sudo aptitude
    

    然后点击F10, Actions → Cancel pending actions,然后g确保一切正常。

    • 0

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve