[Issue Fixed]-Ubuntu20.10 执行apt-get update报错:404 Not Found [IP: xxx]

I am using ubuntu 20.10 on my system . I’ve an error for 2 days. I couldnt update-upgrade or sudo apt update or sudo apt-get update or package install on my system I get below errors:

Hit:1 http://packages.microsoft.com/repos/code stable InRelease                                                                   
Hit:2 http://archive.canonical.com/ubuntu focal InRelease                                                                         
Hit:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease                                                              
Hit:4 http://dl.google.com/linux/chrome/deb stable InRelease                                                                      
Ign:5 http://old-releases.ubuntu.com/ubuntu focal InRelease                                                                       
Ign:6 http://old-releases.ubuntu.com/ubuntu focal-updates InRelease                                                               
Hit:7 http://ppa.launchpad.net/kicad/kicad-5.1-releases/ubuntu focal InRelease                                                    
Hit:8 https://deb.opera.com/opera-stable stable InRelease                                                                         
Hit:9 https://packages.microsoft.com/repos/vscode stable InRelease                                                                
Ign:10 http://old-releases.ubuntu.com/ubuntu focal-backports InRelease                                                            
Ign:11 http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu focal InRelease                                           
Ign:12 http://old-releases.ubuntu.com/ubuntu focal-security InRelease                                                      
Err:14 http://old-releases.ubuntu.com/ubuntu focal Release                                                                        
  404  Not Found [IP: 91.189.88.247 80]
Err:15 http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu focal Release                                                    
  404  Not Found [IP: 91.189.95.85 80]
Err:16 http://old-releases.ubuntu.com/ubuntu focal-updates Release                                                           
  404  Not Found [IP: 91.189.88.247 80]
Hit:17 https://linux-clients.seafile.com/seafile-deb/focal stable InRelease                
Err:18 http://old-releases.ubuntu.com/ubuntu focal-backports Release 
  404  Not Found [IP: 91.189.88.247 80]
Err:19 http://old-releases.ubuntu.com/ubuntu focal-security Release  
  404  Not Found [IP: 91.189.88.247 80]
Ign:13 https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded focal InRelease
Err:20 https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded focal Release
  404  Not Found [IP: 91.189.89.222 443]
Reading package lists... Done

原因

每一个Ubuntu发布版本都有它的结束时间,通常,Ubuntu发布版本支持18个月,而LTS (Long Term Support)(长期支持)版本分别支持3年(服务器版)和5年(桌面版)。当一个Ubuntu发布版本到达结束期后,它的库将不再能够访问,并且你也不会得到任何维护更新和安全补丁。

如果你使用的是Ubuntu系统到达结束期了,你使用 apt-get or aptitude 更新库时会得到如上错误提示.

对于那些使用旧版本的Ubuntu的用户,Canonical会维护 old-releases.ubuntu.com ,这是一个过期库的归档。因此,当Canonical支持的Ubuntu过期后,你必须把源切换到 old-releases.ubuntu.com, 或者 进行升级。

解决方式

1, 系统升级

sudo do-release-upgrade

14p-Gen-2:/etc/apt$ sudo do-release-upgrade
正在检查新版 Ubuntu
不再提供您的 Ubuntu 版本的支持。
要获得关于升级的信息,请访问:
http://www.ubuntu.com/releaseendoflife


= Welcome to Ubuntu 22.04 'Jammy Jellyfish' =

The Ubuntu team is proud to announce Ubuntu 22.04 'Jammy Jellyfish'.

To see what's new in this release, visit:
  https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes

Ubuntu is a Linux distribution for your desktop or server, with a fast
and easy install, regular releases, a tight selection of excellent
applications installed by default, and almost any other software you
can imagine available through the network.

We hope you enjoy Ubuntu.

== Feedback and Helping ==

If you would like to help shape Ubuntu, take a look at the list of
ways you can participate at

  http://www.ubuntu.com/community/participate/

Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Ubuntu ever.  If you feel
that you have found a bug please read:

  http://help.ubuntu.com/community/ReportingBugs

Then report bugs using apport in Ubuntu.  For example:

  ubuntu-bug linux

will open a bug report in Launchpad regarding the linux package.

If you have a question, or if you think you may have found a bug but
aren't sure, first try asking on the #ubuntu or #ubuntu-bugs IRC
channels on Libera.Chat, on the Ubuntu Users mailing list, or on the
Ubuntu forums:

  http://help.ubuntu.com/community/InternetRelayChat
  http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
  http://www.ubuntuforums.org/


== More Information ==
........

% [正在连接 archive.ubuntu.com (91.189.91.38)]                                                     0% [已连接到 archive.ubuntu.com (91.189.91.39)]                                                     0% [正在等待报头]                                                                                   获取:1 升级工具签名 [819 B]                                                                                
99% [正在等待报头]                                                                                  获取:2 升级工具 [1,267 kB]                                                                               
100% [执行中]                                                                                       已下载 1,268 kB / 0秒 (0 B/s)                                                                          
使用 'jammy.tar.gz.gpg' 对 'jammy.tar.gz' 进行验证 
正在提取 'jammy.tar.gz'

2, Update Packages Url

cd  /etc/apt

# 备份 文件 sources.list
sudo cp sources.list  sources.list.bak

sudo  rm  -fr  sources.list
sudo vi sources.list

###   add
deb http://old-releases.ubuntu.com/ubuntu/ groovy main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy multiverse universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates multiverse universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy-backports main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy-backports multiverse universe
deb http://old-releases.ubuntu.com/ubuntu/ groovy-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ groovy-security multiverse universe

That’s it. Now you can update your sources again.

sudo apt-get update

<think>好的,用户遇到了运行`docker compose up -d`时出现错误“unknown shorthand flag: 'd' in -d”,需要找出原因并提供解决办法。首先,我应该回忆一下Docker Compose的命令结构。 Docker Compose的`up`命令确实有一个`-d`选项,用于后台运行容器。所以正常情况下这个命令应该是有效的。用户遇到的错误提示说“unknown shorthand flag: 'd'”,这可能意味着用户的Docker Compose版本不支持`-d`作为短选项,或者命令语法有误。 接下来,我应该考虑可能的版本差异。Docker Compose有两个主要版本:v1和v2。v1使用`docker-compose`(带连字符)作为独立的可执行文件,而v2是作为Docker CLI的一个插件,通过`docker compose`(不带连字符)来调用。用户使用的是`docker compose`,所以应该是v2版本,但可能版本较旧或者安装有问题。 另一个可能性是用户错误地输入了命令,比如在`compose`和`up`之间缺少了连字符,但用户给出的命令是正确的。或者用户可能在命令的其他位置误用了`-d`标志,但根据报错信息,问题出在`-d`参数本身。 然后,检查是否`-d`在某个版本的Docker Compose中被弃用或引入。查阅资料确认,`docker-compose up -d`在v1中是有效的,而v2同样支持该参数。因此,用户的问题可能源于版本不兼容或安装问题。 可能的解决方案包括: 1. 检查Docker Compose版本是否正确安装,尤其是v2。 2. 确保使用正确的命令格式,即`docker compose up -d`。 3. 如果用户实际上使用的是v1,应改为`docker-compose up -d`,但需要确认安装情况。 4. 更新Docker和Compose到最新版本,以解决可能的bug。 用户可能混淆了v1和v2的命令格式,或者环境变量配置有误导致调用了错误的版本。还可能用户的环境中有其他工具或别名干扰了命令的执行。需要引导用户检查版本,确认命令的正确性,并建议更新或重新安装Docker Compose。</think>你遇到的 `docker compose up -d` 报错 **"unknown shorthand flag: 'd' in -d"**,通常是因为你的 Docker Compose 版本或命令格式不兼容。以下是可能的原因和解决方法: --- ### 📌 原因分析 1. **命令格式错误**: 你使用的可能是旧版 Docker Compose(如 v1),而 `docker compose`(无连字符)是新版 Docker Compose v2 的命令格式。 - **v1 命令**:`docker-compose up -d`(带连字符 `-`) - **v2 命令**:`docker compose up -d`(无连字符,集成在 Docker CLI 中) 如果错误地混用版本和命令格式,就会触发 `-d` 参数无法识别。 2. **Docker 版本过旧**: 如果你安装的 Docker 版本较旧,可能未集成 Compose v2 插件,导致无法识别新命令格式。 --- ### 🔧 解决方法 #### 方法 1:检查并修正命令格式 - **如果是 Compose v1**(传统独立工具): 使用带连字符的命令: ```bash docker-compose up -d # 注意 "-" 连字符 ``` - **如果是 Compose v2**(集成在 Docker CLI 中): 确保命令无连字符: ```bash docker compose up -d # 无连字符 ``` --version # 检查 v1 版本 docker compose version # 检查 v2 版本 ``` - **如果返回 "command not found"**: - 对于 Compose v1:需单独安装(参考 [官方文档](https://docs.docker.com/compose/install/))。 - 对于 Compose v2:确保 Docker 版本 ≥ 20.10,并通过以下命令启用插件: ```bash docker compose version # 自动触发安装(可能需要 Docker Desktop 或手动配置) ``` --- #### 方法 3:更新 Docker 和 Compose 升级到最新版本以兼容 `-d` 参数: ```bash # 更新 Docker 引擎 sudo apt-get update && sudo apt-get upgrade docker-ce # 启用 Compose v2(如果尚未启用) docker compose version ``` --- #### 方法 4:直接指定服务(可选) 如果问题仍未解决,尝试省略 `-d` 参数前台运行,观察输出: ```bash docker compose up # 不加 -d,查看实时日志 ``` --- ### ✅ 验证是否成功 运行以下命令确认容器在后台运行: ```bash docker compose ps # 查看服务状态 ``` 如果仍有问题,请提供你的 Docker 版本和操作系统环境,以便进一步排查! 🛠️
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值