关于Linux服务器端更新命令apt update没有效果问题总结(校园网认证)

项目场景:

在使用Django进行服务器部署的时候,需要使用执行命令 apt update:

  • 具体场景:
    在这里插入图片描述

问题描述

需要使用apt命令进行升级、下载、更新
目的:执行命令 apt install nginx 安装好 Nginx:

  • 输入 apt install nginx
    在这里插入图片描述

  • apt update命令输入后的错误提示

root@xxxxvm:/home/xxxx#  apt update

Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [3,232 B]
Err:1 http://security.ubuntu.com/ubuntu noble-security InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports InRelease
Err:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble InRelease
  Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Net                      work is unreachable) Could not connect to mirrors.tuna.tsinghua.edu.cn:443 (101.6.15.130). - connect (111: Con                      nection refused)
Err:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates InRelease
  Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Net                      work is unreachable)
Err:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports InRelease
  Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Net                      work is unreachable)
Reading package lists... Done
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/noble-security/InRelease  Clearsigned file isn't va                      lid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://security.ubuntu.com/ubuntu noble-security InRelease' is no longer signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

错误解决过程

  1. 刚开始复制最后四行问Kimi和百度,给出的结果是镜像源的问题,然后就一直在阿里云、腾讯、网易云等镜像源折腾,我就使者使用ping www.baidu.com来检查是否能上网,发现一直是下图这样:
    在这里插入图片描述

  2. 折腾完镜像源还是一直报错,偶尔来一行Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [3,232 B],但是实际上没有用

  3. 晚上将所有错误发给Kimi分析,突然感觉有些思路,我一直相信普通的问题肯定有前人踩过坑,所以试着百度这句错误Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?),结果还真是自己的问题,原来是校园网认证的问题

在这里插入图片描述
在这里插入图片描述

  1. 百度Linux 命令行进行校园网认证登录得到如下结果:

个人解决

每个学校的认证url的设计都不一样,要自己找规律。我个人是结合上述 1和2的方法解决的

  1. 首先 wget www.baidu.com查看有关信息:
    在这里插入图片描述
    发现确实如上述前辈们所述,等待着响应,Location:后面就是校园网的认证页面

2.回到Host os上,也就是Windows系统上:进入校园网认证页面,提前使用F12查看相关信息的路由走向
在这里插入图片描述
在这里插入图片描述
复制后粘贴到空白文件:
在这里插入图片描述
结合前辈们的命令:

curl --insecure --data "action=login&ac_id=1&username=xxx&password=xxx&user_ip=xxx&nas_ip=&user_mac=&url=&phone=1" http://10.250.3.66/srun_portal_pc.php

你会发现复制后的代码里也有curl --insecure 两个参数,我就试着:直接将图片中的内容复制到Linux Ubuntu中:
在这里插入图片描述
到这里终于成功了,耗时四个多小时的时间

apt update和apt upgrade

  • apt update
    在这里插入图片描述
  • apt upgrade
    在这里插入图片描述
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

胜天半月子

打不打商的无所谓,能帮到你就好

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值