公司機器有一批是全新安裝的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
之後,可成功安裝。
在網上搜不到解決答案,所以記錄下來,給遇到相同問題的小夥伴一點幫助。