gpt4 book ai didi

ubuntu - 如何修复 apt-get dist-upgrade 上的错误 400

转载 作者:行者123 更新时间:2023-12-04 18:29:47 24 4
gpt4 key购买 nike

我正在本地 VM 上运行大型 ansible 剧本进行测试。我已经使用 vagrant 配置的 VM(使用 https://app.vagrantup.com/geerlingguy/boxes/ubuntu1604 )和使用 Ubuntu Server 16.04 手动创建的 VM 进行了尝试。在这两种情况下,它经常在运行 apt 时失败

  apt:
upgrade: dist
update_cache: yes


  apt:
name: nginx
state: present
update_cache: yes

给出错误 400,例如:
    E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/main/j/jbigkit/libjbig0_2.1-3.1_amd64.deb  400  Bad Request [IP: 91.189.88.161 80]

我已经围绕这个主题进行了很多谷歌搜索,但还没有想出任何东西。

我可以成功ping通IP,但是登录并手动运行 sudo apt-get install nginx也失败了:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libtiff5 libvpx3 libxpm4 nginx-common
nginx-core
Suggested packages:
libgd-tools fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libtiff5 libvpx3 libxpm4 nginx
nginx-common nginx-core
0 to upgrade, 13 to newly install, 0 to remove and 111 not to upgrade.
Need to get 2,858 kB of archives.
After this operation, 9,311 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libjpeg-turbo8 amd64 1.4.2-0ubuntu3.1 [111 kB]
Err:2 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 libjbig0 amd64 2.1-3.1
400 Bad Request [IP: 91.189.88.162 80]
Get:3 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 fonts-dejavu-core all 2.35-1 [1,039 kB]
Ign:4 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main i386 fontconfig-config all 2.11.94-0ubuntu1.1
Get:5 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libfontconfig1 amd64 2.11.94-0ubuntu1.1 [131 kB]
Get:6 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 libjpeg8 amd64 8c-2ubuntu8 [2,194 B]
Get:7 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libtiff5 amd64 4.0.6-1ubuntu0.5 [149 kB]
Get:8 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 libvpx3 amd64 1.5.0-2ubuntu1 [732 kB]
Get:9 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libxpm4 amd64 1:3.5.11-1ubuntu0.16.04.1 [33.8 kB]
Get:10 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgd3 amd64 2.1.1-4ubuntu0.16.04.10 [126 kB]
Get:11 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-common all 1.10.3-0ubuntu0.16.04.3 [26.7 kB]
Get:12 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx-core amd64 1.10.3-0ubuntu0.16.04.3 [429 kB]
Get:13 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 nginx all 1.10.3-0ubuntu0.16.04.3 [3,506 B]
Get:4 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main i386 fontconfig-config all 2.11.94-0ubuntu1.1 [49.9 kB]
Fetched 2,831 kB in 0s (6,789 kB/s)
E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/main/j/jbigkit/libjbig0_2.1-3.1_amd64.deb 400 Bad Request [IP: 91.189.88.162 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

按照要求:
kay@ubuntu:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 172.16.0.11
search company.companyname.com
kay@ubuntu:~$ cat /etc/apt/sources.list
#

# deb cdrom:[Ubuntu-Server 16.04.5 LTS _Xenial Xerus_ - Release amd64 (20180731)]/ xenial main restricted

#deb cdrom:[Ubuntu-Server 16.04.5 LTS _Xenial Xerus_ - Release amd64 (20180731)]/ xenial main restricted

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

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

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://gb.archive.ubuntu.com/ubuntu/ xenial universe
deb http://gb.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://gb.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://gb.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://gb.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://gb.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://gb.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://gb.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-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

最佳答案

任何暂时性错误(我相信你这里有暂时性错误)都可以通过使用 until 来解决。/retry组合:https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#do-until-loops

例子:

- name: Install packages
become: true
apt:
name: [packages]
update_cache: true
cache_valid_time='{{ apt_cache_valid_time|d(3600) }}'
register: apt_result
retries: '{{ apt_retries }}'
delay: 10
until: apt_result|success
tags:
- apt
- install

关于ubuntu - 如何修复 apt-get dist-upgrade 上的错误 400,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54826920/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com