当前位置:   article > 正文

E: Unable to locate package gcc

e: unable to locate package gcc

如果出现这种报错语句E: Unable to locate package xxx,我先直接给出解决措施:

更换软件源:

  1. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
  2. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
  3. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
  4. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
  5. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
  6. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
  7. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
  8. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
  9. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
  10. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe

更换软件源之后需输入如下命令:sudo apt-get update,如果报错提示:

  1. Reading package lists... Done
  2. W: GPG error: http://mirrors.aliyun.com/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
  3. E: The repository 'http://mirrors.aliyun.com/ubuntu xenial InRelease' is not signed.
  4. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  5. N: See apt-secure(8) manpage for repository creation and user configuration details.
  6. W: GPG error: http://mirrors.aliyun.com/ubuntu xenial-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
  7. E: The repository 'http://mirrors.aliyun.com/ubuntu xenial-updates InRelease' is not signed.
  8. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  9. N: See apt-secure(8) manpage for repository creation and user configuration details.
  10. W: GPG error: http://mirrors.aliyun.com/ubuntu xenial-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
  11. E: The repository 'http://mirrors.aliyun.com/ubuntu xenial-backports InRelease' is not signed.
  12. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  13. N: See apt-secure(8) manpage for repository creation and user configuration details.
  14. W: GPG error: http://mirrors.aliyun.com/ubuntu xenial-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
  15. E: The repository 'http://mirrors.aliyun.com/ubuntu xenial-security InRelease' is not signed.
  16. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  17. N: See apt-secure(8) manpage for repository creation and user configuration details.
  18. W: GPG error: http://archive.ubuntu.com/ubuntu trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
  19. E: The repository 'http://archive.ubuntu.com/ubuntu trusty Release' is not signed.
  20. N: Updating from such a repository can't be done securely, and is therefore disabled by default.
  21. N: See apt-secure(8) manpage for repository creation and user configuration details.

如提示代表签名错误,如无此报错提示,直接跳过即可,如有此报错输入命令更换签名:

40976EAF437D05B5 与 3B4FE6ACC0B21F32 对应报错信息中的数字  根据实际情况输入

  1. sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
  2. sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32

以上为解决措施

排查过程如下:

使用的是野火的开发板,开发板并不安装完整系统,所以gcc之类的工具需要自己安装

  1. 出现Unable to locate package gcc后我首先更换了软件源  更换为阿里源,更换后sudo apt update时出现:

  1. debian@npi:/etc/apt$ sudo apt-get update
  2. Get:1 http://mirrors.aliyun.com/ubuntu xenial InRelease [247 kB]
  3. Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [99.8 kB]
  4. Get:3 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease [97.4 kB]
  5. Get:4 http://mirrors.aliyun.com/ubuntu xenial-security InRelease [99.8 kB]
  6. Ign:5 http://archive.ubuntu.com/ubuntu trusty InRelease
  7. Get:6 http://archive.ubuntu.com/ubuntu trusty Release [58.5 kB]
  8. Ign:7 http://mirrors.aliyun.com/ubuntu xenial/universe armhf Packages
  9. Ign:8 http://mirrors.aliyun.com/ubuntu xenial/restricted armhf Packages
  10. Ign:9 http://mirrors.aliyun.com/ubuntu xenial/multiverse armhf Packages
  11. Ign:10 http://mirrors.aliyun.com/ubuntu xenial/main armhf Packages
  12. Get:11 http://archive.ubuntu.com/ubuntu trusty Release.gpg [933 B]
  13. Ign:7 http://mirrors.aliyun.com/ubuntu xenial/universe armhf Packages
  14. Ign:8 http://mirrors.aliyun.com/ubuntu xenial/restricted armhf Packages
  15. Ign:9 http://mirrors.aliyun.com/ubuntu xenial/multiverse armhf Packages
  16. Ign:10 http://mirrors.aliyun.com/ubuntu xenial/main armhf Packages
  17. Ign:7 http://mirrors.aliyun.com/ubuntu xenial/universe armhf Packages
  18. Ign:8 http://mirrors.aliyun.com/ubuntu xenial/restricted armhf Packages
  19. Ign:9 http://mirrors.aliyun.com/ubuntu xenial/multiverse armhf Packages
  20. Ign:10 http://mirrors.aliyun.com/ubuntu xenial/main armhf Packages
  21. Ign:7 http://mirrors.aliyun.com/ubuntu xenial/universe armhf Packages
  22. Ign:8 http://mirrors.aliyun.com/ubuntu xenial/restricted armhf Packages
  23. Ign:9 http://mirrors.aliyun.com/ubuntu xenial/multiverse armhf Packages
  24. Ign:10 http://mirrors.aliyun.com/ubuntu xenial/main armhf Packages
  25. Ign:7 http://mirrors.aliyun.com/ubuntu xenial/universe armhf Packages
  26. Ign:8 http://mirrors.aliyun.com/ubuntu xenial/restricted armhf Packages
  27. Ign:9 http://mirrors.aliyun.com/ubuntu xenial/multiverse armhf Packages
  28. Ign:10 http://mirrors.aliyun.com/ubuntu xenial/main armhf Packages
  29. Err:7 http://mirrors.aliyun.com/ubuntu xenial/universe armhf Packages
  30. 404 Not Found [IP: 36.150.79.240 80]
  31. Ign:8 http://mirrors.aliyun.com/ubuntu xenial/restricted armhf Packages
  32. Ign:9 http://mirrors.aliyun.com/ubuntu xenial/multiverse armhf Packages
  33. Ign:10 http://mirrors.aliyun.com/ubuntu xenial/main armhf Packages
  34. Ign:12 http://mirrors.aliyun.com/ubuntu xenial-updates/restricted armhf Packages
  35. Ign:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe armhf Packages
  36. Ign:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main armhf Packages
  37. Ign:15 http://mirrors.aliyun.com/ubuntu xenial-updates/multiverse armhf Packages
  38. Ign:12 http://mirrors.aliyun.com/ubuntu xenial-updates/restricted armhf Packages
  39. Ign:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe armhf Packages
  40. Ign:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main armhf Packages
  41. Ign:15 http://mirrors.aliyun.com/ubuntu xenial-updates/multiverse armhf Packages
  42. Ign:12 http://mirrors.aliyun.com/ubuntu xenial-updates/restricted armhf Packages
  43. Ign:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe armhf Packages
  44. Ign:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main armhf Packages
  45. Ign:15 http://mirrors.aliyun.com/ubuntu xenial-updates/multiverse armhf Packages
  46. Ign:12 http://mirrors.aliyun.com/ubuntu xenial-updates/restricted armhf Packages
  47. Ign:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe armhf Packages
  48. Ign:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main armhf Packages
  49. Ign:15 http://mirrors.aliyun.com/ubuntu xenial-updates/multiverse armhf Packages
  50. Ign:12 http://mirrors.aliyun.com/ubuntu xenial-updates/restricted armhf Packages
  51. Ign:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe armhf Packages
  52. Ign:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main armhf Packages
  53. Ign:15 http://mirrors.aliyun.com/ubuntu xenial-updates/multiverse armhf Packages
  54. Err:12 http://mirrors.aliyun.com/ubuntu xenial-updates/restricted armhf Packages
  55. 404 Not Found [IP: 36.150.79.240 80]
  56. Ign:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe armhf Packages
  57. Ign:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main armhf Packages
  58. Ign:15 http://mirrors.aliyun.com/ubuntu xenial-updates/multiverse armhf Packages
  59. Ign:16 http://mirrors.aliyun.com/ubuntu xenial-backports/main armhf Packages
  60. Ign:17 http://mirrors.aliyun.com/ubuntu xenial-backports/universe armhf Packages
  61. Ign:16 http://mirrors.aliyun.com/ubuntu xenial-backports/main armhf Packages
  62. Ign:17 http://mirrors.aliyun.com/ubuntu xenial-backports/universe armhf Packages
  63. Ign:16 http://mirrors.aliyun.com/ubuntu xenial-backports/main armhf Packages
  64. Ign:17 http://mirrors.aliyun.com/ubuntu xenial-backports/universe armhf Packages
  65. Ign:16 http://mirrors.aliyun.com/ubuntu xenial-backports/main armhf Packages
  66. Ign:17 http://mirrors.aliyun.com/ubuntu xenial-backports/universe armhf Packages
  67. Ign:16 http://mirrors.aliyun.com/ubuntu xenial-backports/main armhf Packages
  68. Ign:17 http://mirrors.aliyun.com/ubuntu xenial-backports/universe armhf Packages
  69. Err:16 http://mirrors.aliyun.com/ubuntu xenial-backports/main armhf Packages
  70. 404 Not Found [IP: 36.150.79.240 80]
  71. Ign:17 http://mirrors.aliyun.com/ubuntu xenial-backports/universe armhf Packages
  72. Ign:18 http://mirrors.aliyun.com/ubuntu xenial-security/restricted armhf Packages
  73. Ign:19 http://mirrors.aliyun.com/ubuntu xenial-security/multiverse armhf Packages
  74. Ign:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe armhf Packages
  75. Ign:21 http://mirrors.aliyun.com/ubuntu xenial-security/main armhf Packages
  76. Ign:18 http://mirrors.aliyun.com/ubuntu xenial-security/restricted armhf Packages
  77. Ign:19 http://mirrors.aliyun.com/ubuntu xenial-security/multiverse armhf Packages
  78. Ign:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe armhf Packages
  79. Ign:21 http://mirrors.aliyun.com/ubuntu xenial-security/main armhf Packages
  80. Ign:18 http://mirrors.aliyun.com/ubuntu xenial-security/restricted armhf Packages
  81. Ign:19 http://mirrors.aliyun.com/ubuntu xenial-security/multiverse armhf Packages
  82. Ign:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe armhf Packages
  83. Ign:21 http://mirrors.aliyun.com/ubuntu xenial-security/main armhf Packages
  84. Ign:18 http://mirrors.aliyun.com/ubuntu xenial-security/restricted armhf Packages
  85. Ign:19 http://mirrors.aliyun.com/ubuntu xenial-security/multiverse armhf Packages
  86. Ign:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe armhf Packages
  87. Ign:21 http://mirrors.aliyun.com/ubuntu xenial-security/main armhf Packages
  88. Ign:18 http://mirrors.aliyun.com/ubuntu xenial-security/restricted armhf Packages
  89. Ign:19 http://mirrors.aliyun.com/ubuntu xenial-security/multiverse armhf Packages
  90. Ign:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe armhf Packages
  91. Ign:21 http://mirrors.aliyun.com/ubuntu xenial-security/main armhf Packages
  92. Err:18 http://mirrors.aliyun.com/ubuntu xenial-security/restricted armhf Packages
  93. 404 Not Found [IP: 36.150.79.240 80]
  94. Ign:19 http://mirrors.aliyun.com/ubuntu xenial-security/multiverse armhf Packages
  95. Ign:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe armhf Packages
  96. Ign:21 http://mirrors.aliyun.com/ubuntu xenial-security/main armhf Packages
  97. Get:22 http://183.207.33.36:9011/archive.ubuntu.com/c3pr90ntc0td/ubuntu trusty/universe Sources [6399 kB]
  98. Ign:23 http://183.207.33.37:9011/archive.ubuntu.com/c3pr90ntc0td/ubuntu trusty/universe armhf Packages
  99. Ign:23 http://183.207.33.37:9011/archive.ubuntu.com/c3pr90ntc0td/ubuntu trusty/universe armhf Packages
  100. Err:23 http://183.207.33.37:9011/archive.ubuntu.com/c3pr90ntc0td/ubuntu trusty/universe armhf Packages
  101. 404 Not Found [IP: 183.207.33.37 9011]
  102. Fetched 6458 kB in 24s (266 kB/s)
  103. Reading package lists... Done
  104. E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial/universe/binary-armhf/Packages 404 Not Found [IP: 36.150.79.240 80]
  105. E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-updates/restricted/binary-armhf/Packages 404 Not Found [IP: 36.150.79.240 80]
  106. E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-backports/main/binary-armhf/Packages 404 Not Found [IP: 36.150.79.240 80]
  107. E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-security/restricted/binary-armhf/Packages 404 Not Found [IP: 36.150.79.240 80]
  108. E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/universe/binary-armhf/Packages 404 Not Found [IP: 183.207.33.37 9011]
  109. E: Some index files failed to download. They have been ignored, or old ones used instead.

并且在出现如上报错的时候试图安装gcc也会出现签名错误

  1. 以上报错信息我才更换另一种软件源:

  1. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
  2. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
  3. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
  4. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
  5. deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
  6. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
  7. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
  8. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
  9. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
  10. deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
  1. 重新更换后再执行sudo apt update就不报错了

内容太长
  1. 随后我就正常安装了gcc

内容太长

以上总结出,安装gcc提示定位不到软件换源即可,同时注意签名信息报错

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/556079
推荐阅读
相关标签
  

闽ICP备14008679号