Unable to locate package、404 Not Found [IP: 185.125.190.39 80]的解决办法

文章讲述了用户在使用ubuntu21.04遇到404错误,尝试更换源和执行apt-getupdate失败。解决方案是升级至LTS版本(如20.04),因为非LTS版本不再受官方维护,官方源已停止支持。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

1. 简要

2. 问题背景

3. 问题解析

4. 解决途径

5. 问题总结


1. 简要

        卸载不维护的ubuntu21.04,重装 ubuntu LTS 版本(如20.04.4)即可解决。 网上说的更换源、执行sudo apt-get update都不能解决。

2. 问题背景

       做项目时文档要求ubuntu21.04版本,按照文档要求换了相应的ubuntu版本,换源也按照要求来,但是每次 apt-get update 的时候,还是失败,提示404 Not Found [IP: 185.125.190.39 80]。 

xxx@xxx:~$ sudo bash -c 'echo "deb http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ hirsute main restricted universe multiverse" > /etc/apt/source.list'
xxx@xxx:~$ sudo apt-get update
Ign:1 http://cn.archive.ubuntu.com/ubuntu hirsute InRelease
Ign:2 http://cn.archive.ubuntu.com/ubuntu hirsute-updates InRelease
Ign:3 http://security.ubuntu.com/ubuntu hirsute-security InRelease
Ign:4 http://cn.archive.ubuntu.com/ubuntu hirsute-backports InRelease
Err:5 http://security.ubuntu.com/ubuntu hirsute-security Release
  404  Not Found [IP: 185.125.190.39 80]
Err:6 http://cn.archive.ubuntu.com/ubuntu hirsute Release
  404  Not Found [IP: 91.189.91.38 80]
Err:7 http://cn.archive.ubuntu.com/ubuntu hirsute-updates Release
  404  Not Found [IP: 91.189.91.38 80]
Err:8 http://cn.archive.ubuntu.com/ubuntu hirsute-backports Release
  404  Not Found [IP: 91.189.91.38 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu hirsute-security Release' no longer has a Release file.
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.
E: The repository 'http://cn.archive.ubuntu.com/ubuntu hirsute Release' does not have a Release file.
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.
E: The repository 'http://cn.archive.ubuntu.com/ubuntu hirsute-updates Release' does not have a Release file.
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.
E: The repository 'http://cn.archive.ubuntu.com/ubuntu hirsute-backports Release' does not have a Release file.
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.

3. 问题解析

      ubuntu21.04版本是中间过渡版本,官方已经不维护。

4. 解决途径

1. 原来的ubuntu 21.04、21.10都不行,即只要是奇数版本的都不行,先后找了官网的源,华中科技大学的源和中科大的源,全都失败。 

2.重装20.04 LTS,执行sudo apt-get update,成功。 

5. 问题总结

      关于ubuntu的中间版本,所谓民间的源也只是官方的镜像,官方不维护则这些镜像源也没有用,我就像个冤大头摸索了三个小时。

       LTS是long term support的简称,意思是长期支持,也就是服务支持会不停更新,一般是偶数年发布,也就是18.04(这个也快要不支持了,所以不推荐现在安装这个版本),20.04和最新的22.04这些版本。

本文转自:【ubuntu21.04问题】关于404 Not Found [IP: 185.125.190.39 80]的解决办法 (yii666.com)

<think>我们遇到了两个问题:1.构建RKNN模型时出现ImportError,提示缺少GLIBCXX_3.4.29版本。2.在尝试安装gcc-11和g++-11时,系统提示找不到包。问题分析:第一个问题是因为RKNN所需的库(libcpputils.so)需要GLIBCXX_3.4.29,而当前系统的libstdc++.so.6版本过低。第二个问题可能是由于软件源中没有gcc-11,或者软件源未更新。解决方案:步骤1:尝试更新软件源并安装gcc-11如果之前添加PPA失败,我们可以尝试其他方法。方法A:使用Ubuntu官方源(适用于Ubuntu20.04及以上版本)在Ubuntu20.04(FocalFossa)中,默认的软件源已经包含了gcc-11,但需要更新软件包列表。执行以下命令:sudo aptupdatesudoapt installgcc-11g++-11方法B:如果方法A失败,则添加PPA(适用于Ubuntu18.04及以上版本)sudo add-apt-repositoryppa:ubuntu-toolchain-r/testsudoapt updatesudo aptinstall gcc-11 g++-11方法C:如果PPA添加失败(例如在非Ubuntu系统上),考虑从源码安装或使用其他源。步骤2:安装完成后,更新系统库链接sudo update-alternatives --install /usr/bin/gccgcc/usr/bin/gcc-11100sudoupdate-alternatives--install/usr/bin/g++ g++ /usr/bin/g++-11100步骤3:检查GLIBCXX_3.4.29是否存在strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 |grep GLIBCXX如果输出中包含GLIBCXX_3.4.29,则问题解决。否则,需要手动链接新版本的库。步骤4:如果系统中安装了多个版本的libstdc++,找到gcc-11对应的libstdc++.so.6,并创建软链接。#查找gcc-11的libstdc++.so.6sudofind /-name&#39;libstdc++.so.6&#39;2>/dev/null通常,gcc-11的库路径为:/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so.6然后,将其链接到系统库目录:sudoln -sf /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so.6.0.29 /usr/lib/x86_64-linux-gnu/libstdc++.so.6注意:版本号可能略有不同,请根据实际找到的文件名修改。步骤5:更新库缓存sudoldconfig步骤6:重新运行RKNN构建程序。如果以上步骤无法解决,考虑使用Docker容器(如NVIDIA L4T基础镜像)或升级操作系统。特殊情况:如果用户使用的是较旧版本的Ubuntu(如18.04),默认软件源可能没有gcc-11,那么需要添加PPA。如果添加PPA失败(例如因为网络问题),可以尝试更换镜像源。更换镜像源的方法(以Ubuntu18.04为例):备份原source.list:sudocp /etc/apt/sources.list/etc/apt/sources.list.bak编辑sources.list,将原有源替换为阿里云或清华源,然后更新。例如,替换为阿里云源:debhttp://mirrors.aliyun.com/ubuntu/bionicmain restricteduniverse multiversedebhttp://mirrors.aliyun.com/ubuntu/ bionic-securitymain restricteduniverse multiversedebhttp://mirrors.aliyun.com/ubuntu/ bionic-updates mainrestricted universemultiversedeb http://mirrors.aliyun.com/ubuntu/bionic-proposedmain restricteduniverse multiversedebhttp://mirrors.aliyun.com/ubuntu/ bionic-backports mainrestricted universemultiverse然后执行:sudo aptupdatesudoapt installgcc-11g++-11如果仍然无法安装gcc-11,则考虑升级系统到Ubuntu20.04或更高版本。另外,如果用户使用的是conda环境,可以尝试在conda环境中安装libstdcxx-ng:condainstall -c conda-forge libstdcxx-ng然后设置环境变量:exportLD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH最后,生成相关问题。</think>### RKNN模型构建错误:`GLIBCXX_3.4.29`缺失及GCC安装失败的完整解决方案 #### 问题根本原因 1. **GLIBCXX版本缺失** RKNN依赖的`libcpputils.so`需要`GLIBCXX_3.4.29`(首次出现在GCC 11.1中),但您的系统当前GCC版本过低(通常≤9.3)[^1]。 2. **无法安装gcc-11/g++-11** 主要由于: - 未添加新版GCC的软件源(PPA) - 系统版本过旧(如Ubuntu 18.04默认无gcc-11) - 软件源缓存未更新 --- ### 分步解决方案 #### 步骤1:添加新版GCC源(解决"unable to locate package") ```bash # 添加Toolchain测试源(支持Ubuntu 16.04+) sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y # 更新软件源缓存 sudo apt update -y ``` #### 步骤2:安装GCC-11(强制覆盖依赖问题) ```bash # 安装GCC-11及依赖库 sudo apt install gcc-11 g++-11 -y --allow-downgrades # 验证安装 gcc-11 --version | head -n1 ``` #### 步骤3:链接新版C++库 ```bash # 查找新版库路径 LIB_PATH=$(sudo find / -name &#39;libstdc++.so.6.*&#39; 2>/dev/null | grep gcc-11 | sort | tail -n1) # 创建系统级软链接 sudo ln -sf $LIB_PATH /usr/lib/x86_64-linux-gnu/libstdc++.so.6 # 更新动态链接库缓存 sudo ldconfig ``` #### 步骤4:验证修复 ```bash # 检查GLIBCXX版本 strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.29 # 测试RKNN导入(Python环境) python -c "from rknn.api import RKNN; print(RKNN().version())" ``` --- ### 备选方案(当PPA不可用时) #### 方案A:手动编译安装GCC-11 ```bash # 安装依赖 sudo apt install build-essential zlib1g-dev libmpc-dev -y # 下载源码 wget https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz tar xvf gcc-11.3.0.tar.gz && cd gcc-11.3.0 # 编译安装 ./configure --disable-multilib --enable-languages=c,c++ make -j$(nproc) sudo make install ``` #### 方案B:使用Docker容器(推荐生产环境) ```dockerfile FROM ubuntu:22.04 RUN apt update && apt install -y python3-pip gcc-11 g++-11 RUN pip install rknn-toolkit2 COPY your_model.onnx . ``` 构建命令: ```bash docker build -t rknn_env . docker run -it rknn_env python your_script.py ``` --- ### 关键验证点 1. **GCC版本验证**: ```bash gcc -v | grep "gcc version" # 应显示 ≥11.1 ``` 2. **库路径优先级**: ```bash ldd /usr/local/python3.10/.../libcpputils.so | grep libstdc++ ``` 输出应指向`/usr/lib/x86_64-linux-gnu/`下的新版库 --- ### 预防措施 1. **系统升级**: 建议升级到Ubuntu 20.04+,其默认包含GCC 9.4+并支持直接安装gcc-11 ```bash sudo do-release-upgrade ``` 2. **环境隔离**: 使用Python虚拟环境避免库冲突: ```bash python -m venv rknn_env source rknn_env/bin/activate pip install rknn-toolkit2 ``` > **注意**:若系统为CentOS/RHEL,需使用`yum install devtoolset-11`并激活`scl enable devtoolset-11 bash`[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值