• 容器内需要编辑文件,但无法下载和使用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能够正常使用了。

     

     

  • 相关阅读:
    CentOS安装OpenNebula(二)
    Java基础知识面试高频考点
    (C++17) variant的使用与union对比
    python科研绘图:P-P图与Q-Q图
    Linux虚拟机的克隆
    Springboot+基于微信小程序的商城 毕业设计-附源码191145
    STM32 HAL库串口使用printf
    『MySQL快速上手』-⑥-表的约束
    Turtlebot3-burger入门教程#foxy版#-雷达测试
    Github或Gitlab等申请PR或MR(pull request & merge request)的时候如果不能自动合并代码发生冲突了要怎么办
  • 原文地址:https://blog.csdn.net/Mrs_haze/article/details/137982297