APT升级出现一下错误,请教怎么解决?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
pengcs
帖子: 7
注册时间: 2008-11-30 15:38

APT升级出现一下错误,请教怎么解决?

#1

帖子 pengcs » 2017-02-13 12:40

sudo apt upgrade

正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
您也许需要运行“apt-get -f install”来修正上面的错误。
下列软件包有未满足的依赖关系:
snapd : 依赖: snap-confine (= 2.21~14.04.2) 但是 2.22.2~14.04 已经安装
依赖: ubuntu-core-launcher (= 2.21~14.04.2) 但是 2.22.2~14.04 已经安装
E: 不能满足依赖关系。不妨试一下 -f 选项。


执行:sudo apt -f install

正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
正在修复依赖关系... 完成
下列软件包是自动安装的并且现在不需要了:
linux-headers-4.4.0-38 linux-headers-4.4.0-38-generic linux-headers-4.4.0-45
linux-headers-4.4.0-45-generic linux-headers-4.4.0-47
linux-headers-4.4.0-47-generic linux-headers-4.4.0-51
linux-headers-4.4.0-51-generic linux-headers-4.4.0-53
linux-headers-4.4.0-53-generic linux-headers-4.4.0-57
linux-headers-4.4.0-57-generic linux-image-4.4.0-38-generic
linux-image-4.4.0-45-generic linux-image-4.4.0-47-generic
linux-image-4.4.0-51-generic linux-image-4.4.0-53-generic
linux-image-4.4.0-57-generic linux-image-extra-4.4.0-38-generic
linux-image-extra-4.4.0-45-generic linux-image-extra-4.4.0-47-generic
linux-image-extra-4.4.0-51-generic linux-image-extra-4.4.0-53-generic
linux-image-extra-4.4.0-57-generic ubuntu-core-launcher
使用'sudo apt autoremove'来卸载它(它们)。
将会同时安装下列软件:
snapd
下列软件包将被升级:
snapd
升级了 1 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 97 个软件包未被升级。
有 10 个软件包没有被完全安装或卸载。
需要下载 0 B/8,568 kB 的归档。
解压缩后会消耗 1,283 kB 的额外空间。
您希望继续执行吗? [Y/n] y
(正在读取数据库 ... 系统当前共安装有 437429 个文件和目录。)
正准备解包 .../snapd_2.22.2~14.04_amd64.deb ...
Failed to stop snapd.refresh.timer: Unit snapd.refresh.timer not loaded.
Failed to stop snapd.refresh.service: Unit snapd.refresh.service not loaded.
Failed to stop snapd.autoimport.service: Unit snapd.autoimport.service not loaded.
Failed to stop snapd.socket: Unit snapd.socket not loaded.
dpkg:警告:子进程 旧的 pre-removal 脚本 返回错误状态 5
dpkg: 现在尝试使用新软件包所带的脚本...
Failed to stop snapd.refresh.timer: Unit snapd.refresh.timer not loaded.
Failed to stop snapd.refresh.service: Unit snapd.refresh.service not loaded.
Failed to stop snapd.autoimport.service: Unit snapd.autoimport.service not loaded.
Failed to stop snapd.socket: Unit snapd.socket not loaded.
dpkg: 处理归档 /var/cache/apt/archives/snapd_2.22.2~14.04_amd64.deb (--unpack)时出错:
子进程 新的 pre-removal 脚本 返回错误状态 5
在处理时有错误发生:
/var/cache/apt/archives/snapd_2.22.2~14.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我把目录: /var/cache/apt/archives/ 下的DEB文件清空了
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: APT升级出现一下错误,请教怎么解决?

#2

帖子 poloshiao » 2017-02-13 15:42

sudo apt upgrade
有沒有先
sudo apt update

sudo apt upgrade
?
pengcs
帖子: 7
注册时间: 2008-11-30 15:38

Re: APT升级出现一下错误,请教怎么解决?

#3

帖子 pengcs » 2017-02-28 16:06

poloshiao 写了:
sudo apt upgrade
有沒有先
sudo apt update

sudo apt upgrade
?

有的

原因可能是我删除了目录里面的内容

/var/cache/apt/archives$ sudo apt clean

update是正常的
upgrade时候出现:

:~$ sudo apt upgrade
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
您也许需要运行“apt-get -f install”来修正上面的错误。
下列软件包有未满足的依赖关系:
snapd : 依赖: snap-confine (= 2.21~14.04.2) 但是 2.22.2~14.04 已经安装
依赖: ubuntu-core-launcher (= 2.21~14.04.2) 但是 2.22.2~14.04 已经安装
E: 不能满足依赖关系。不妨试一下 -f 选项。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: APT升级出现一下错误,请教怎么解决?

#4

帖子 poloshiao » 2017-02-28 17:31

原因可能是我删除了目录里面的内容
/var/cache/apt/archives$ sudo apt clean
1. 如果你的作業系統 是 Ubuntu 14.04
儘量使用 apt-get 避免使用 apt (早期版本的 apt 可能還不穩定)
1-1. clean 指令通常可以安心使用 不會造成問題
下列软件包有未满足的依赖关系:
snapd : 依赖: snap-confine (= 2.21~14.04.2) 但是 2.22.2~14.04 已经安装
依赖: ubuntu-core-launcher (= 2.21~14.04.2) 但是 2.22.2~14.04 已经安装
2. 問題
2-1. 你有將 trusty-updates 套件庫 加入 /etc/apt/sources.list ?
2-2. 你有先執行 sudo apt-get update ?
2-3. 你還有從 /etc/apt/sources.list 以外的 軟體來源 安裝 snapd ?

3. 顯然 你目前的 snapd 跟 snap-confine 都不是最新版本
如果你安裝前 先執行
sudo apt-get update
應該會是最新版本

4. 參見
在我的電腦 執行 模擬安裝 snpad (加 -s)
sudo apt-get -s install snapd
...
将会安装下列额外的软件包:
apparmor cgroup-lite init-system-helpers libcryptsetup4 libpam-systemd
libseccomp2 libsystemd-daemon0 libsystemd-journal0 libsystemd-login0
linux-generic-lts-xenial linux-headers-4.4.0-64
linux-headers-4.4.0-64-generic linux-headers-generic-lts-xenial
linux-image-4.4.0-64-generic linux-image-extra-4.4.0-64-generic
linux-image-generic-lts-xenial snap-confine squashfs-tools sudo systemd
systemd-services thermald util-linux
建议安装的软件包:
apparmor-profiles apparmor-profiles-extra apparmor-docs apparmor-utils
fdutils linux-lts-xenial-tools systemd-ui cgmanager util-linux-locales
下列【新】软件包将被安装:
cgroup-lite libcryptsetup4 libseccomp2 linux-generic-lts-xenial
linux-headers-4.4.0-64 linux-headers-4.4.0-64-generic
linux-headers-generic-lts-xenial linux-image-4.4.0-64-generic
linux-image-extra-4.4.0-64-generic linux-image-generic-lts-xenial
snap-confine snapd squashfs-tools systemd thermald
下列软件包将被升级:
apparmor init-system-helpers libpam-systemd libsystemd-daemon0
libsystemd-journal0 libsystemd-login0 sudo systemd-services util-linux
升级了 9 个软件包,新安装了 15 个软件包,要卸载 0 个软件包,有 278 个软件包未被升级。
4-1. 有 snap-confine 並沒有 ubuntu-core-launcher
4-1-1. http://packages.ubuntu.com/trusty-updat ... e-launcher
Package: ubuntu-core-launcher (2.22.3~14.04) [universe]
Transitional package for snap-confine
過渡性套件 實際上安裝 snap-confine
意思是 ubuntu-core-launcher 可以不安裝

5. http://packages.ubuntu.com/trusty-updates/snapd
Package: snapd (2.22.3~14.04) [universe]
snap-confine (= 2.22.3~14.04)
Support executable to apply confinement for snappy apps
5-1. 目前安裝 snapd 及 snap-confine 版本應該是 2.22.3~14.04
pengcs
帖子: 7
注册时间: 2008-11-30 15:38

Re: APT升级出现一下错误,请教怎么解决?

#5

帖子 pengcs » 2017-02-28 17:40

万分感谢,我试试
pengcs
帖子: 7
注册时间: 2008-11-30 15:38

Re: APT升级出现一下错误,请教怎么解决?

#6

帖子 pengcs » 2017-02-28 17:50

1、我使用的是:Ubuntu 16.04
2、~$ vim /etc/apt/sources.list

#deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse


deb http://ubuntu.srt.cn/ubuntu/ trusty main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/ trusty-security main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/ trusty-updates main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/ trusty main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
pengcs
帖子: 7
注册时间: 2008-11-30 15:38

Re: APT升级出现一下错误,请教怎么解决?

#7

帖子 pengcs » 2017-02-28 17:52

~$ sudo apt-get -s install snapd
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
您可能需要运行“apt-get -f install”来纠正下列错误:
下列软件包有未满足的依赖关系:
snapd : 依赖: snap-confine (= 2.22.6~14.04) 但是 2.22.2~14.04 正要被安装
E: 有未能满足的依赖关系。请尝试不指明软件包的名字来运行“apt-get -f install”(也可以指定一个解决办法)。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: APT升级出现一下错误,请教怎么解决?

#8

帖子 poloshiao » 2017-02-28 18:01

我使用的是:Ubuntu 16.04
vim /etc/apt/sources.list
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
... 以下省略
deb http://ubuntu.srt.cn/ubuntu/ trusty main restricted universe multiverse
... 以下省略
1. 在 Ubuntu 16.04 的 /etc/apt/sources.list 不應該含有 xenial 以外的 套件庫 (例如 trusty)將會影響 套件之間的依賴關係 進而使得系統不穩定
1-1. 對策
把 xenial 以外的 套件庫 全部移除

sudo apt update
sudo apt upgrade
(apt 指令 可以在 16.04 使用 但還不支援所有的指令 詳細查看 man apt)
1-2. xenial 的套件庫 也必須唯一 不可以重複
回复