您的位置:首页 > 运维架构 > Shell

bash: vi: command not found

2020-07-19 04:55 1211 查看

新进入一个docker的时候,没有vi命令,这种情况已经遇见好几次了,记录一下。

vi train_mv2.py
bash: vi: command not found

按照网上的方法,运行apt-get install vim:

apt-get install vimReading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libgpm2 vim-common vim-runtime
Suggested packages:
gpm ctags vim-doc vim-scripts vim-gnome-py2 | vim-gtk-py2 | vim-gtk3-py2 | vim-athena-py2 | vim-nox-py2
The following NEW packages will be installed:
libgpm2 vim vim-common vim-runtime
0 upgraded, 4 newly installed, 0 to remove and 2 not upgraded.
Need to get 6303 kB/6319 kB of archives.
After this operation, 30.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.2
404  Not Found [IP: 91.189.88.152 80]
Err:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.2
404  Not Found [IP: 91.189.88.152 80]
Err:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2
404  Not Found [IP: 91.189.88.152 80]
Ign:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim amd64 2:7.4.1689-3ubuntu1.2
Err:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2
404  Not Found [IP: 91.189.88.152 80]
Err:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim amd64 2:7.4.1689-3ubuntu1.2
404  Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/v/vim/vim-common_7.4.1689-3ubuntu1.2_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/v/vim/vim-runtime_7.4.1689-3ubuntu1.2_all.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/v/vim/vim_7.4.1689-3ubuntu1.2_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

然后

apt-get update

结果报错:

Get:1 file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0  InRelease
Ign:1 file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0  InRelease
Get:2 file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0  Release [574 B]
Get:2 file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0  Release [574 B]
Err:3 file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0  Release.gpg
At least one invalid signature was encountered.
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Err:4 http://security.ubuntu.com/ubuntu xenial-security InReleaseuldn't create tempfiles for splitting up /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_InRelease
Could not execute 'apt-key' to verify signature (is gnupg installed?)
Hit:5 http://archive.ubuntu.com/ubuntu xenial InRelease
Err:5 http://archive.ubuntu.com/ubuntu xenial InReleasen't create tempfiles for splitting up /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_xenial_InRelease
Could not execute 'apt-key' to verify signature (is gnupg installed?)
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Ign:7 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  InRelease
0% [6 InRelease gpgv 109 kB] [Waiting for headers]                                                                                                                                 3819 B/s 28sCErr:6 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Could not execute 'apt-key' to verify signature (is gnupg installed?)
Get:8 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
0% [8 InRelease gpgv 107 kB]                                                                                                                                                       3819 B/s 57sCErr:8 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Could not execute 'apt-key' to verify signature (is gnupg installed?)
Ign:9 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  InRelease
Get:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release [169 B]
Get:12 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Release.gpg [169 B]
Err:12 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Release.gpg
At least one invalid signature was encountered.
Get:13 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release.gpg [169 B]
Err:13 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release.gpg
At least one invalid signature was encountered.
Fetched 327 kB in 31s (10.5 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0  Release: At least one invalid signature was encountered.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://security.ubuntu.com/ubuntu xenial-security InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.ubuntu.com/ubuntu xenial InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.ubuntu.com/ubuntu xenial-updates InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.ubuntu.com/ubuntu xenial-backports InRelease: Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Release: At least one invalid signature was encountered.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: shttps://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release: At least one invalid signature was encountered.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Could not execute 'apt-key' to verify signature (is gnupg installed?)
W: Failed to fetch file:/var/nvinfer-runtime-trt-repo-4.0.1-ga-cuda9.0/Release.gpg  At least one invalid signature was encountered.
W: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/Release.gpg  At least one invalid signature was encountered.
W: Failed to fetch https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/Release.gpg  At least one invalid signature was encountered.
W: Some index files failed to download. They have been ignored, or old ones used instead.

试了各种源,都不行,发现不是源的问题,其实这个是由于 tmp 文件夹权限不够的原因,解决方法:
运行命令

chmod 777 /tmp
apt-get update --allow-unauthenticated
apt-get update
apt-get install vim

源的话我是把所有的都删了,只留下了aliyun的

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
终于解决啦,开心~

参考博客

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: