我正在尝试使用 Ansible 在 vagrant 上测试 PHP 7.0 安装并收到此错误:
TASK [php-cli : Install php7.0-cli package] *****************************************************************************
Thursday 21 November 2019 20:08:15 +0000 (0:00:00.034) 0:00:02.156 *****
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: W:Failed to fetch http://ppa.launchpad.net/ansible/ansible/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found [IP: 127.0.0.1]\n, E:Some index files failed to download. They have been ignored, or old ones used instead."}
尝试手动更新,再次没有成功:
vagrant@jessie:~/ansible/infra/deployment$ sudo apt update
Ign http://ppa.launchpad.net jessie InRelease
Ign http://ppa.launchpad.net jessie Release.gpg
Ign http://ppa.launchpad.net jessie Release
Err http://ppa.launchpad.net jessie/main amd64 Packages
Err http://ppa.launchpad.net jessie/main amd64 Packages
Ign http://httpredir.debian.org jessie InRelease
Err http://ppa.launchpad.net jessie/main amd64 Packages
Get:1 http://httpredir.debian.org jessie-updates InRelease [16.3 kB]
Hit http://security.debian.org jessie/updates InRelease
Err http://ppa.launchpad.net jessie/main amd64 Packages
Hit http://httpredir.debian.org jessie Release.gpg
Err http://ppa.launchpad.net jessie/main amd64 Packages
404 Not Found [IP: 127.0.0.1]
Hit http://httpredir.debian.org jessie Release
Hit http://security.debian.org jessie/updates/main Sources
Get:2 http://httpredir.debian.org jessie-updates/main Sources [20 B]
Hit http://security.debian.org jessie/updates/main amd64 Packages
Get:3 http://httpredir.debian.org jessie-updates/main amd64 Packages [20 B]
Hit http://httpredir.debian.org jessie/main Sources
Hit http://httpredir.debian.org jessie/main amd64 Packages
Fetched 16.3 kB in 2s (5,943 B/s)
W: Failed to fetch http://ppa.launchpad.net/ansible/ansible/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found [IP: 127.0.0.1]
E: Some index files failed to download. They have been ignored, or old ones used instead.
尝试删除 ppa:
vagrant@jessie:~/ansible/infra/deployment$ sudo add-apt-repository --remove ppa:whatever/ppa
Cannot access PPA (https://launchpad.net/api/1.0/~whatever/+archive/ppa) to get PPA information, please check your internet connection.
vagrant@jessie:~/ansible/infra/deployment$ ping -c3 www.google.com
PING www.google.com 56(84) bytes of data.
64 bytes from waw02s08-in-f196.1e100.net (): icmp_seq=1 ttl=63 time=48.7 ms
64 bytes from waw02s08-in-f196.1e100.net : icmp_seq=2 ttl=63 time=26.8 ms
64 bytes from waw02s08-in-f196.1e100.net : icmp_seq=3 ttl=63 time=48.1 ms
--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 26.818 ms
我的/etc/apt/sources.list
:
deb http://httpredir.debian.org/debian jessie main
deb-src http://httpredir.debian.org/debian jessie main
deb http://httpredir.debian.org/debian jessie-updates main
deb-src http://httpredir.debian.org/debian jessie-updates main
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
/etc/apt/sources.list.d/
输出:
vagrant@jessie:/etc/apt$ ls
apt.conf.d preferences.d sources.list~ sources.list.save trusted.gpg~
listchanges.conf sources.list sources.list.d trusted.gpg trusted.gpg.d
vagrant@jessie:/etc/apt$ cd sources.list.d/
vagrant@jessie:/etc/apt/sources.list.d$ ls
ansible-ansible-jessie.list
我该如何处理这个错误?
答案1
您可以手动删除此 ppa:
sudo rm /etc/apt/sources.list.d/ansible-ansible-jessie.list
然后:
sudo apt-get update
如果您想使用此 ppa,请添加trusty
代号而不是jessie
:
sudo nano /etc/apt/sources.list.d/ansible-ansible-jessie.list
然后添加以下行:
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
然后运行sudo apt-get update
,查看接受的代码名安西布尔 PPA,如您所见,jessie 目录未列出。