无人值守的 Nginx 安装失败,出现 400 Bad Request 错误,但命令行安装正常。20.04

无人值守的 Nginx 安装失败,出现 400 Bad Request 错误,但命令行安装正常。20.04

我正在尝试组装一个 Vagrant 和 VirtualBox VM,使用配置脚本在初始安装后执行所有所需软件的无人值守安装vagrant up。这是我以前做过的事情,没有问题,但在这个版本中,我遇到了400 Bad Request [IP: 91.189.88.152 80]前所未有的频率。

错误在apt-get upgrade作为第一个配置步骤之一运行的第一个步骤中开始。

我在初始启动时运行了这个:

sudo apt-get update 
sudo apt-get -y upgrade

现在变成了这样:

sudo apt-get update --fix-missing
sudo apt-get -y upgrade --with-new-pkgs --fix-missing

两个版本400 Bad Request的输出中都包含错误。

对于 Nginx 安装本身,我从以下内容开始:

sudo apt-get -y install nginx

这已成为

sudo apt-get -y install nginx --with-new-pkgs --fix-missing

无论使用哪个版本,结果都是一样的——输出中间出现四个 400 错误,如下所示:

    default: Err:6 http://archive.ubuntu.com/ubuntu focal/main amd64 libfontconfig1 amd64 2.13.1-2ubuntu3
    default:   400  Bad Request [IP: 91.189.88.142 80]

随后出现“无法纠正丢失的软件包”消息,其中列出了相同的软件包及其
非常好且可访问的 URL

... 
    default: Fetched 2,827 kB in 9s (300 kB/s)
    default: Unable to correct missing packages.
    default: E
    default: :
    default: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/f/fontconfig/libfontconfig1_2.13.1-2ubuntu3_amd64.deb  400  Bad Request [IP: 91.189.88.142 80]
    default: E
    default: :
    default: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg8-empty/libjpeg8_8c-2ubuntu8_amd64.deb  400  Bad Request [IP: 91.189.88.142 80]
    default: E
    default: :
    default: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libw/libwebp/libwebp6_0.6.1-2_amd64.deb  400  Bad Request [IP: 91.189.88.142 80]
    default: E
    default: :
    default: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libx/libxpm/libxpm4_3.5.12-1_amd64.deb  400  Bad Request [IP: 91.189.88.142 80]
    default: E
    default: :
    default: Aborting install.

我已经向供应商添加了执行的步骤apt-get clean,删除/var/lib/apt/lists目录中的所有文件,删除/etc/apt/sources.list,提供了替代方案/etc/apt/sources.list- 这些步骤都无法解决单个 400 错误。

但是,如果我让它vagrant up运行直到“中止安装”失败,然后vagrant ssh进入虚拟机,当我运行sudo apt-get -y install nginx或安装时sudo apt-get -y install nginx --with-new-pkgs --fix-missing,安装都会成功进行,而不会出现任何 400 错误。

我该怎么做才能使用无人值守配置程序完成此安装?

编辑:这是安装程序开始时的输出。我怀疑这35 not upgraded可能是问题的一部分:

    default: Starting NGINX install.
    default: Reading package lists...
    default: Building dependency tree...
    default: Reading state information...
    default: The following additional packages will be installed:
    default:   fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
    default:   libjpeg-turbo8 libjpeg8 libnginx-mod-http-image-filter
    default:   libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5
    default:   libwebp6 libx11-6 libx11-data libxcb1 libxpm4 nginx-common nginx-core
    default: Suggested packages:
    default:   libgd-tools fcgiwrap nginx-doc ssl-cert
    default: The following NEW packages will be installed:
    default:   fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
    default:   libjpeg-turbo8 libjpeg8 libnginx-mod-http-image-filter
    default:   libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5
    default:   libwebp6 libx11-6 libx11-data libxcb1 libxpm4 nginx nginx-common nginx-core
    default: 0 upgraded, 20 newly installed, 0 to remove and 35 not upgraded.
    default: Need to get 3,163 kB of archives.
    default: After this operation, 11.1 MB of additional disk space will be used.

相关内容