重装gnome-control-center时遇到依赖问题及源配置重复报错
重装gnome-control-center时遇到依赖问题及源配置重复报错
Hey,看起来你在重装GNOME控制中心的时候碰到了两个头疼的问题:依赖包版本冲突和APT源配置重复,下面我给你梳理下解决步骤:
先处理APT源重复的问题
那些W: Target Packages ... configured multiple times警告说明你的/etc/apt/sources.list里有重复的源条目,这会干扰APT的依赖解析,得先搞定这个:
- 打开源配置文件,用nano编辑器就行:
sudo nano /etc/apt/sources.list - 找到提示里的重复行(第15、16、17行),仔细对比这些行的内容,删除完全重复的条目(比如如果15和16行是一模一样的源,删掉其中一行就好);如果是不同版本的源(比如同时加了20.04和22.04的源),那得保留和你系统版本匹配的,把不匹配的注释掉(在行首加
#)。 - 保存修改:按
Ctrl+O,回车确认,再按Ctrl+X退出nano。 - 更新APT缓存:
sudo apt update
接着修复依赖冲突和破损包
源的问题解决后,再来处理gnome-control-center的依赖问题:
- 先尝试自动修复破损的依赖:
sudo apt --fix-broken install - 如果上面的命令没解决问题,那就彻底清除已有的相关包,再重新安装:
# 彻底卸载gnome-control-center和其数据包 sudo apt purge gnome-control-center gnome-control-center-data # 清理无用的依赖包 sudo apt autoremove # 再次更新源缓存 sudo apt update # 重新安装gnome-control-center sudo apt install gnome-control-center - 要是还是遇到版本依赖的问题,大概率是你混合了不同Ubuntu发行版的源(比如你的系统是20.04,但源里加了22.04的仓库),这时候得回到
/etc/apt/sources.list把不匹配的源注释掉,再重复上面的安装步骤。
问题重现的错误输出
你遇到的具体错误信息如下:
Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: gnome-control-center : Depends: libgdk-pixbuf2.0-0 (>= 2.25.2) but it is not going to be installed Depends: gnome-control-center-data (< 1:3.37) but 1:40.0-1ubuntu5 is to be installed Recommends: gnome-online-accounts (>= 3.25.3) but it is not going to be installed Recommends: network-manager-gnome (>= 0.9.8) but it is not going to be installed Recommends: gnome-control-center-faces but it is not going to be installed Recommends: rygel but it is not going to be installed or rygel-tracker but it is not going to be installed W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target DEP-11-icons-hidpi (main/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:16 W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target DEP-11-icons-hidpi (main/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:17 E: Unable to correct problems, you have held broken packages.
备注:内容来源于stack exchange,提问作者Mar Mustafa




