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

     

     

  • 相关阅读:
    【智能优化算法】基于阴阳对优化算法求解单目标优化问题附matlab代码 Yin Yang Pair Optimization
    RK3568-tftp更新设备树和内核&nfs挂载文件系统
    Leetcode 2981
    tiup cluster patch
    soildwork2022怎么样添加螺纹孔?
    十年老Python程序员:给我一个链接,没有我不能爬的视频,只有我顶不住的视频
    MATLAB中d2d函数用法
    关于Git使用:fatal: Could not read from remote repository.的报错问题解决
    C++ 引用
    JSD-2204-Vue-ElementUI-Day06
  • 原文地址:https://blog.csdn.net/Mrs_haze/article/details/137982297