我该如何在 Ubuntu 上删除所有可能损坏的软件包或重复的源?

我该如何在 Ubuntu 上删除所有可能损坏的软件包或重复的源?

我想删除所有可能损坏的软件包,因为昨天我尝试下载 VM 和 lutris,但现在无法正常工作。我该如何改进?

我做了这个检查:

sudo apt-get check

和:

W: Target Packages (contrib/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target Packages (contrib/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target Translations (contrib/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target Translations (contrib/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target DEP-11 (contrib/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target DEP-11 (contrib/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target DEP-11-icons-small (contrib/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target DEP-11-icons (contrib/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target DEP-11-icons-hidpi (contrib/dep11/[email protected]) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target CNF (contrib/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2
W: Target CNF (contrib/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:63 and /etc/apt/sources.list.d/virtualbox.list:2

我不知道它们是什么意思。

答案1

使用此脚本:

 #!/bin/bash 
 # Detect os codename 
 codename=$(awk '/UBUNTU_CODENAME=/' /etc/os-release | sed 's/UBUNTU_CODENAME=//' | sed 's/[.]0/./') 
  
 # Replace sources.list   
 text="deb http://archive.ubuntu.com/ubuntu/ $codename main universe restricted multiverse 
 deb-src http://archive.ubuntu.com/ubuntu/ $codename main universe restricted multiverse 
 deb http://security.ubuntu.com/ubuntu $codename-security main universe restricted multiverse 
 deb-src http://security.ubuntu.com/ubuntu $codename-security main universe restricted multiverse 
 deb http://archive.ubuntu.com/ubuntu/ $codename-updates main universe restricted multiverse 
 deb-src http://archive.ubuntu.com/ubuntu/ $codename-updates main universe restricted multiverse" 
  
 sudo echo "$text" | sudo tee /etc/apt/sources.list 
  
 # Start upgrade 
 sudo apt update 
 sudo apt install -f 
 sudo apt upgrade 
 sudo apt dist-upgrade 
 sudo apt autoremove --purge 

相关内容