智能aptitude解决常规apt安装包时出现的依赖报错问题

智能aptitude解决常规apt安装包时出现的依赖报错问题

  • 1.Linux网络源配置
  • 2.智能aptitude解决依赖问题
  • 3.安装包时常见的依赖报错问题
    • 1.如果遇到“apt安装包报错解决办法:下列软件包有未满足的依赖关系,依赖。。。但是。。。正要被安装”问题
    • 2.下列软件包有未满足的依赖关系:libc6-dev : 破坏: binutils (< 2.26) 但是 2.25-5+deb8u1-linx1 正要被安装 E: 错误,pkgProblemResolver::Resolve 发生故障,这可能是有软件包被要求保持现状的缘故。
    • 3.E: 有未能满足的依赖关系。请尝试不指明软件包的名字来运行“apt-get -f install”(也可以指定一个解决办法)。
    • 4.For more details see logger(1). dpkg: 处理归档 /var/cache/apt/archives/udev_237-3ubuntu10.57_amd64.deb (--unpack)时出错:子进程 新的 pre-installation 脚本 返回错误状态 1 在处理时有错误发生: /var/cache/apt/archives/udev_237-3ubuntu10.57_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

1.Linux网络源配置

1.切换到root用户后,备份配置文件:cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.修改权限:chmod 777 /etc/apt/sources.list
3.修改内容:vi /etc/apt/sources.list
将文件中内容清空,再添加新的软件源地址,常用国内源地址如下:

#阿里源地址
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#华为源地址
deb https://repo.huaweicloud.com/ubuntu/ focal main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-updates main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal universe
deb https://repo.huaweicloud.com/ubuntu/ focal-updates universe
deb https://repo.huaweicloud.com/ubuntu/ focal-backports main restricted universe
deb https://repo.huaweicloud.com/ubuntu/ focal-security main restricted
deb https://repo.huaweicloud.com/ubuntu/ focal-security universe
#中科大源地址
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#清华源地址
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe ultiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe ultiverse

4.更新系统软件源地址:apt-get update

2.智能aptitude解决依赖问题

使用aptitude安装代替apt-get,aptitude 在处理依赖问题上更加智能:apt-get install aptitude

apt-get命令 作用
sudo apt-get update 更新源
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
sudo apt-get install package 安装包
sudo apt-get remove package 删除包
sudo apt-get remove package --purge 删除包,包括配置文件等
apt-cache rdepends package 查看该包被哪些包依赖
apt-cache depends package 了解使用该包依赖那些包
sudo apt-get install package --reinstall 重新安装包
apt-cache search package 搜索软件包
apt-cache show package 获取包的相关信息,如说明、大小、版本等
aptitude命令 作用
sudo aptitude update 更新可用的包列表
sudo aptitude upgrade 升级可用的包
sudo aptitude dist-upgrade 将系统升级到新的发行版
sudo aptitude install pkgname 安装包
sudo aptitude remove pkgname 删除包
sudo aptitude purge pkgname 删除包及其配置文件
sudo aptitude search string 搜索包
sudo aptitude show pkgname 显示包的详细信息
sudo aptitude clean 删除下载的包文件
sudo aptitude autoclean 仅删除过期的包文件

3.安装包时常见的依赖报错问题

1.如果遇到“apt安装包报错解决办法:下列软件包有未满足的依赖关系,依赖。。。但是。。。正要被安装”问题

参考https://blog.csdn.net/qq_19300283/article/details/125252808

2.下列软件包有未满足的依赖关系:libc6-dev : 破坏: binutils (< 2.26) 但是 2.25-5+deb8u1-linx1 正要被安装 E: 错误,pkgProblemResolver::Resolve 发生故障,这可能是有软件包被要求保持现状的缘故。

智能aptitude解决常规apt安装包时出现的依赖报错问题_第1张图片
运行apt install binutils修复

3.E: 有未能满足的依赖关系。请尝试不指明软件包的名字来运行“apt-get -f install”(也可以指定一个解决办法)。

可以运行:apt-get -f install或apt --fix-broken install尝试解决

4.For more details see logger(1). dpkg: 处理归档 /var/cache/apt/archives/udev_237-3ubuntu10.57_amd64.deb (–unpack)时出错:子进程 新的 pre-installation 脚本 返回错误状态 1 在处理时有错误发生: /var/cache/apt/archives/udev_237-3ubuntu10.57_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

智能aptitude解决常规apt安装包时出现的依赖报错问题_第2张图片
可以尝试删除报错的那个文件,然后执行sudo apt-get update更新软件源,再次执行apt-get -f installapt --fix-broken install

你可能感兴趣的:(Linux,linux)