• 容器内需要编辑文件,但无法下载和使用ed 、vi、vim、nano编辑器


    报错信息:由于使用的Debian Jessie 已经到达了维护结束的状态,其软件包仓库可能已被归档或移除。并且无法通过apt-get update来更新,或者apt-get install vim下载。

    1. root@1d6f4966854a:/usr/src/app# apt-get update
    2. Ign http://security.debian.org jessie/updates InRelease
    3. Ign http://security.debian.org jessie/updates Release.gpg
    4. Ign http://security.debian.org jessie/updates Release
    5. Ign http://deb.debian.org jessie InRelease
    6. Err http://security.debian.org jessie/updates/main amd64 Packages
    7. Err http://security.debian.org jessie/updates/main amd64 Packages
    8. Ign http://deb.debian.org jessie-updates InRelease
    9. Err http://security.debian.org jessie/updates/main amd64 Packages
    10. Err http://security.debian.org jessie/updates/main amd64 Packages
    11. Err http://security.debian.org jessie/updates/main amd64 Packages
    12. 404 Not Found [IP: 151.101.130.132 80]
    13. Ign http://deb.debian.org jessie Release.gpg
    14. Ign http://deb.debian.org jessie-updates Release.gpg
    15. Ign http://deb.debian.org jessie Release
    16. Ign http://deb.debian.org jessie-updates Release
    17. Err http://deb.debian.org jessie/main amd64 Packages
    18. 404 Not Found
    19. Err http://deb.debian.org jessie-updates/main amd64 Packages
    20. 404 Not Found
    21. W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80]
    22. W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found
    23. W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found
    24. E: Some index files failed to download. They have been ignored, or old ones used instead.
    25. root@1d6f4966854a:/usr/src/app# apt-get install vim
    26. Reading package lists... Done
    27. Building dependency tree
    28. Reading state information... Done
    29. Package vim is not available, but is referred to by another package.
    30. This may mean that the package is missing, has been obsoleted, or
    31. is only available from another source
    32. E: Package 'vim' has no installation candidate
    33. root@1d6f4966854a:/usr/src/app#

    解决办法:

    排查之后只有echo才能编辑文本,尝试更新 /etc/apt/sources.list 文件,使用 archive 中的源,而不是原来的旧版本源。这将逐行向 /etc/apt/sources.list 文件添加下面四行内容。

    1. echo "deb http://archive.debian.org/debian/ jessie main" >> /etc/apt/sources.list
    2. echo "deb-src http://archive.debian.org/debian/ jessie main" >> /etc/apt/sources.list
    3. echo "deb http://archive.debian.org/debian-security/ jessie/updates main" >> /etc/apt/sources.list
    4. echo "deb-src http://archive.debian.org/debian-security/ jessie/updates main" >> /etc/apt/sources.list

    完成后可以运行 apt-get update 命令以更新软件包列表,并尝试安装 Vim:

    1. apt-get update
    2. apt-get install vim

    运行过程中一些软件包已经没办法找到了,但是其他的代码都顺利执行并且结束了运行,即vim能够正常使用了。

     

     

  • 相关阅读:
    【机器学习】支持向量回归
    .net8 Syncfusion生成pdf/doc/xls/ppt最新版本
    【深度学习】卷积层填充和步幅以及其大小关系
    【数字IC验证快速入门】11、Verilog TestBench(VTB)入门
    漏洞预警|CVE-2023-38545 Curl 和 libcurl 堆缓冲区溢出漏洞
    封装自己的本地缓存类(单例模式、适配器模式应用)
    NeuSpeech神经解码语言日报
    Selenium基础 — POM设计模式(一)
    matlab实现MCMC的马尔可夫转换MS- ARMA - GARCH模型估计
    华为云Centos7搭建hadoop集群一:云服务器准备
  • 原文地址:https://blog.csdn.net/Mrs_haze/article/details/137982297