公司机器有一批是全新安装的ubuntu18 server版本,有一部分是从原来的ubuntu16.04升级过来的,在使用apt安装程序的时候不相同,升级的那批有时候apt update 失败或者apt install时 失败。这个时候需要替换源,源包括 /etc/apt/sources.list 里的配置和/etc/apt/sources.list.d/下面的文件里的配置。 问题1: 在apt install salt-minion时,报i386不支持 解决方法是,在源文件里加入 [arch=amd64],加完后,如下配置:
root@sz-dev-vm-ubuntu69-64:/opt# cat /etc/apt/sources.list.d/saltstack.list
deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main
问题2:报:
The following packages have unmet dependencies:
salt-minion : Depends: python-zmq (>= 14.4.0) but it is not installable
Depends: salt-common (= 2018.3.3+ds-2) but it is not going to be installed
Recommends: debconf-utils but it is not installable
E: Unable to correct problems, you have held broken packages.
当前配置是:
oot@ubuntu18-ip54:~# cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu bionic-security main
deb http://archive.ubuntu.com/ubuntu bionic-updates main
root@ubuntu18-ip54:~# cat /etc/apt/sources.list.d/saltstack.list
deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main
解决方法:修改 /etc/apt/sources.list,为:
root@ubuntu18:/etc/apt# cat sources.list
#deb http://archive.ubuntu.com/ubuntu bionic main
#deb http://archive.ubuntu.com/ubuntu bionic-security main
#deb http://archive.ubuntu.com/ubuntu bionic-updates main
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security universe
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse
root@ubuntu18:/etc/apt# cat sources.list.d/saltstack.list
root@ubuntu18-ip54:~# cat /etc/apt/sources.list.d/saltstack.list
deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main
之后,可成功安装。
在网上搜不到解决答案,所以记录下来,给遇到相同问题的小伙伴一点帮助。